vulkano: Segfault when creating a buffer with exportable fd on Linux after updating to 0.22
After updating to 0.22 I get segfault when creating a DeviceLocalBuffer::raw_with_exportable_fd.
- Version of vulkano: 0.22
- OS: Linux
- GPU (the selected PhysicalDevice): GeForce RTX 2070 with Max-Q Design with 7.5 CUDA compute capability
- GPU Driver:
460.32.03 - Upload of a reasonably minimal complete
main.rsfile that demonstrates the issue: TODO
Issue
Segfault after #1510. Segfaulting at:
ptr_chain_iter

It seems to be related to the allocation size somehow. I don’t have much clue what the changes are for in above linked PR that broke the functionality for me, but just reporting this is happening. 34mb size seems to be enough to trigger this.
I’ll use the previous versions meanwhile.
main.rs:
use vulkano::buffer::{BufferUsage, DeviceLocalBuffer};
use vulkano::device::{Device, DeviceExtensions};
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice};
fn main() {
// Add instance extensions based on needs
let instance_extensions = InstanceExtensions {
khr_surface: true,
khr_xlib_surface: true,
khr_get_physical_device_properties2: true,
khr_get_surface_capabilities2: true,
..InstanceExtensions::none()
};
// Create instance
let instance =
Instance::new(None, &instance_extensions, None).expect("Failed to create instance");
// Get most performant device (physical)
let physical = PhysicalDevice::enumerate(&instance)
.fold(None, |acc, val| {
if acc.is_none() {
Some(val)
} else if acc.unwrap().limits().max_compute_shared_memory_size()
>= val.limits().max_compute_shared_memory_size()
{
acc
} else {
Some(val)
}
})
.expect("No physical device found");
println!(
"Using device: {} (type: {:?})",
physical.name(),
physical.ty()
);
let queue_family = physical
.queue_families()
.find(|&q| q.supports_graphics())
.expect("couldn't find a graphical queue family");
let device_extensions = DeviceExtensions::supported_by_device(physical);
let features = physical.supported_features();
// Needed extension for shared buffers
assert!(device_extensions.khr_external_memory_fd);
let (device, mut _queues) = {
Device::new(
physical,
&features,
&device_extensions,
[(queue_family, 0.5)].iter().cloned(),
)
.expect("failed to create device")
};
let vk_buffer = unsafe {
DeviceLocalBuffer::<[u8]>::raw_with_exportable_fd(
device,
34000000, // !ToDo: Try changing this value to see when 11: SIGSEGV happens
BufferUsage::all(),
Vec::new(),
)
.expect("Failed to allocate device local buffer")
};
println!("{:#?}", vk_buffer);
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (14 by maintainers)
A better fix attempt… #1580. Hopefully this would fix it once and for all. Rust can sometimes make ptr play so hard…
It kind of baffles me why this would work in non-release mode and fail in release mode.