You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some ref-counted pointer defined in this crate causes segmentation fault on leaved from the scope and dropped. While dropping, runtime::objc_release is called by Drop trait tweak and the NSArray get dropped, but autorelease is also active and Foundation framework tries to release the array. In this time the NSArray is already released, so segmentation fault will be occurred.
Also I confirmed this occurs on VZMACAddress, but does not occur on other ones e.g. VZVirtioEntropyDeviceConfiguration.
I think these objects are autoreleased because they are not init ed or alloc ed in this crate; [NSArray arrayWithObjects:] or [VZMACAddress randomLocallyAdministeredAddress:] do enable autorelease on the objects initiated. These are also class methods (+).
How to reproduce
Cargo.toml
[package]
name = "virtualization-rs-segfault"version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cacao = { version = "0.3.2", features = ["appkit"] }
virtualization-rs = { git = "https://github.com/suzusuzu/virtualization-rs.git", rev = "56daf26" }
main.rs
use cacao::appkit::{App,AppDelegate};use virtualization_rs::base::NSArray;use virtualization_rs::virtualization::entropy_device::{VZEntropyDeviceConfiguration,VZVirtioEntropyDeviceConfiguration};#[derive(Default)]structMyApp{}implAppDelegateforMyApp{fndid_finish_launching(&self){let entropy = VZVirtioEntropyDeviceConfiguration::new();let arr:NSArray<VZVirtioEntropyDeviceConfiguration> = NSArray::array_with_objects(vec![entropy.id()]);}}fnmain(){App::new("jp.s6n.virtualization-rs-segfault",MyApp::default()).run();}
Log
Finished dev [unoptimized + debuginfo] target(s) in 0.02s Running `target/debug/virtualization-rs-segfault`Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
Some ref-counted pointer defined in this crate causes segmentation fault on leaved from the scope and dropped. While dropping,
runtime::objc_release
is called byDrop
trait tweak and the NSArray get dropped, but autorelease is also active and Foundation framework tries to release the array. In this time the NSArray is already released, so segmentation fault will be occurred.Also I confirmed this occurs on VZMACAddress, but does not occur on other ones e.g. VZVirtioEntropyDeviceConfiguration.
I think these objects are autoreleased because they are not
init
ed oralloc
ed in this crate;[NSArray arrayWithObjects:]
or[VZMACAddress randomLocallyAdministeredAddress:]
do enable autorelease on the objects initiated. These are also class methods (+).How to reproduce
Cargo.toml
main.rs
Log
LLDB
System
macOS 13.4, MacBook Air (M2), Arm64
The text was updated successfully, but these errors were encountered: