-
-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Getting segfault when trying to use MemoryBalloonDevices
To Reproduce
Steps to reproduce the behavior:
- The command runs OK, and size is changed.
- But when the go finalizer runs, it segfaults.
func (d *LimaVzDriver) SetTargetMemory(memory int64) error {
if d.machine == nil {
return fmt.Errorf("no machine!")
}
balloons := d.machine.MemoryBalloonDevices()
if len(balloons) != 1 {
return fmt.Errorf("unexpected number of devices: %d", len(balloons))
}
balloon := vz.AsVirtioTraditionalMemoryBalloonDevice(balloons[0])
if balloon == nil {
return errors.New("unexpected type of balloon")
}
balloon.SetTargetVirtualMachineMemorySize(uint64(memory))
return nil
}runtime.cgocall(0x10394cb0c, 0x14000076508)
/opt/homebrew/Cellar/go/1.25.1/libexec/src/runtime/cgocall.go:167 +0x44 fp=0x140000764d0 sp=0x14000076490 pc=0x102df3bf4
github.com/Code-Hex/vz/v3/internal/objc._Cfunc_releaseNSObject(0x600003cd1350)
_cgo_gotypes.go:204 +0x2c fp=0x14000076500 sp=0x140000764d0 pc=0x10389749c
github.com/Code-Hex/vz/v3/internal/objc.(*Pointer).release.func1(...)
/Users/afb/go/pkg/mod/github.com/!code-!hex/vz/[email protected]/internal/objc/objc.go:85
github.com/Code-Hex/vz/v3/internal/objc.(*Pointer).release(0x1400011c500)
/Users/afb/go/pkg/mod/github.com/!code-!hex/vz/[email protected]/internal/objc/objc.go:85 +0x48 fp=0x14000076540 sp=0x14000076500 pc=0x1038975f8
github.com/Code-Hex/vz/v3/internal/objc.Release(...)
/Users/afb/go/pkg/mod/github.com/!code-!hex/vz/[email protected]/internal/objc/objc.go:112
github.com/Code-Hex/vz/v3.newVirtioTraditionalMemoryBalloonDevice.func1(0x0?)
/Users/afb/go/pkg/mod/github.com/!code-!hex/vz/[email protected]/memory_balloon.go:124 +0x24 fp=0x14000076560 sp=0x14000076540 pc=0x1038a73a4
runtime.call16(0x0, 0x103ecec40, 0x1400015e180, 0x10, 0x10, 0x10, 0x14000076600)
/opt/homebrew/Cellar/go/1.25.1/libexec/src/runtime/asm_arm64.s:554 +0x78 fp=0x14000076580 sp=0x14000076560 pc=0x102dfd598
runtime.runFinalizers()
/opt/homebrew/Cellar/go/1.25.1/libexec/src/runtime/mfinal.go:272 +0x3fc fp=0x140000767d0 sp=0x14000076580 pc=0x102da070c
runtime.goexit({})
/opt/homebrew/Cellar/go/1.25.1/libexec/src/runtime/asm_arm64.s:1268 +0x4 fp=0x140000767d0 sp=0x140000767d0 pc=0x102dff584
Expected behavior
I'm not sure if the devices are supposed to be Released?
func newVirtioTraditionalMemoryBalloonDevice(pointer unsafe.Pointer, vm *VirtualMachine) *VirtioTraditionalMemoryBalloonDevice {
device := &VirtioTraditionalMemoryBalloonDevice{
pointer: objc.NewPointer(pointer),
vm: vm,
}
objc.SetFinalizer(device, func(self *VirtioTraditionalMemoryBalloonDevice) {
objc.Release(self)
})
return device
}Since we didn't allocate the memory, it was given to us.
https://developer.apple.com/documentation/virtualization/vzvirtualmachine/memoryballoondevices
Screenshots
If applicable, add screenshots to help explain your problem.
Environment that you use to compile (please complete the following information):
- Xcode version: 16.4
- macOS Version: 15.7.1
- mac architecture: arm64
- Go Version: 1.25.3
Additional context
Add any other context about the problem here.
msimkunas
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working