Skip to content

Commit

Permalink
Check AppleHypervisor before accessing it
Browse files Browse the repository at this point in the history
In GetDefaultDevices(), make sure MachineConfig has an AppleHypervisor
instance before attempting to access it. This fixes a SIGSEGV when
running with libkrun as machine provider.

Signed-off-by: Sergio Lopez <slp@redhat.com>
  • Loading branch information
slp authored and mheon committed Jun 4, 2024
1 parent db5393f commit d79b94c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/machine/apple/vfkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ func GetDefaultDevices(mc *vmconfigs.MachineConfig) ([]vfConfig.VirtioDevice, *d
}
devices = append(devices, disk, rng, serial, readyDevice)

rosettaCfg := mc.AppleHypervisor.Vfkit.Rosetta
if rosettaCfg {
if mc.AppleHypervisor != nil && mc.AppleHypervisor.Vfkit.Rosetta {
rosetta := &vfConfig.RosettaShare{
DirectorySharingConfig: vfConfig.DirectorySharingConfig{
MountTag: define.MountTag,
Expand Down

0 comments on commit d79b94c

Please sign in to comment.