balena-io-modules/node-lkl

Segfault after mounting a partition 128 times.

Closed this issue · 1 comments

zvin commented

You can mount a partition 127 times.

The 128th try will cause a SEGFAULT in lkl_disk_add .

More precisely in lkl_sys_virtio_mmio_device_add
with

  • dev->base being negative (it is calculated in register_iomem and overflows)
  • dev->irq = 129

This is problematic because node-lkl calls lkl_disk_add for each partition it mounts (even one on a disk which already has a partition mounted) and never calls lkl_disk_remove

I've added a test that causes this segfault in the segfault-on-128th-mount branch

zvin commented

This is partially fixed by #29.
But we still can't attach more than 128 disks at the same time.