elastio / elastio-snap

kernel module for taking block-level snapshots and incremental backups of Linux block devices
GNU General Public License v2.0
19 stars 7 forks source link

Segmentation fault encountered when running 'insmod elastio-snap' #304

Open hongyuntw opened 6 months ago

hongyuntw commented 6 months ago

Hi there,

I've noticed that a Segmentation fault occurs when running 'insmod elastio-snap'.

Environment: Kernel: 4.19.0-26-amd64 Distribution: Debian 10 (with Xen hypervisor)

Error message:

root@debian-xen:~/elastio-snap# insmod src/elastio-snap.ko debug=1
Segmentation fault

dmesg:

[Wed Apr 17 22:01:01 2024] elastio-snap: module init
[Wed Apr 17 22:01:01 2024] elastio-snap: get major number
[Wed Apr 17 22:01:01 2024] elastio-snap: allocate global device array
[Wed Apr 17 22:01:01 2024] elastio-snap: registering proc file
[Wed Apr 17 22:01:01 2024] elastio-snap: registering control device
[Wed Apr 17 22:01:01 2024] elastio-snap: locating system call table
[Wed Apr 17 22:01:01 2024] elastio-snap: system call table located at 0x0000000079ea7a70
[Wed Apr 17 22:01:01 2024] general protection fault: 0000 [#1] SMP NOPTI
[Wed Apr 17 22:01:01 2024] CPU: 0 PID: 12399 Comm: insmod Tainted: G           OE     4.19.0-26-amd64 #1 Debian 4.19.304-1
[Wed Apr 17 22:01:01 2024] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Virtualization-2.5.1-11303-200428-0-gfff70e7 04/01/2014
[Wed Apr 17 22:01:01 2024] RIP: e030:disable_page_protection+0x11/0x20 [elastio_snap]
[Wed Apr 17 22:01:01 2024] Code: ff ff 89 0d 49 04 01 00 89 35 47 04 01 00 c3 66 2e 0f 1f 84 00 00 00 00 00 e8 5b 57 b0 c0 66 90 48 89 c2 48 81 e2 ff ff fe ff <0f> 22 c2 c3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 8b
[Wed Apr 17 22:01:01 2024] RSP: e02b:ffffc9004539fca0 EFLAGS: 00010206
[Wed Apr 17 22:01:01 2024] RAX: 0000000080050033 RBX: 0000000000000000 RCX: 0000000000000006
[Wed Apr 17 22:01:01 2024] RDX: 0000000080040033 RSI: 0000000000000001 RDI: ffff888073c1b6b0
[Wed Apr 17 22:01:01 2024] RBP: ffffffff81c00280 R08: 0000000000000213 R09: 0000000000000004
[Wed Apr 17 22:01:01 2024] R10: 0000000000000000 R11: 0000000000000001 R12: ffffffffc05232c0
[Wed Apr 17 22:01:01 2024] R13: ffffffffc0523158 R14: ffffc9004539fe98 R15: ffffffffc0523140
[Wed Apr 17 22:01:01 2024] FS:  00007ff9b29584c0(0000) GS:ffff888073c00000(0000) knlGS:0000000000000000
[Wed Apr 17 22:01:01 2024] CS:  e033 DS: 0000 ES: 0000 CR0: 0000000080050033
[Wed Apr 17 22:01:01 2024] CR2: 000055d1ad158aa0 CR3: 0000000067b90000 CR4: 0000000000040660
[Wed Apr 17 22:01:01 2024] Call Trace:
[Wed Apr 17 22:01:01 2024]  ? __die+0x81/0xc3
[Wed Apr 17 22:01:01 2024]  ? die+0x2a/0x50
[Wed Apr 17 22:01:01 2024]  ? general_protection+0x1e/0x30
[Wed Apr 17 22:01:01 2024]  ? disable_page_protection+0x11/0x20 [elastio_snap]
[Wed Apr 17 22:01:01 2024]  agent_init+0x253/0x1000 [elastio_snap]
[Wed Apr 17 22:01:01 2024]  ? 0xffffffffc0527000
[Wed Apr 17 22:01:01 2024]  do_one_initcall+0x46/0x1d0
[Wed Apr 17 22:01:01 2024]  ? free_unref_page_commit+0x91/0x100
[Wed Apr 17 22:01:01 2024]  ? _cond_resched+0x15/0x30
[Wed Apr 17 22:01:01 2024]  ? kmem_cache_alloc_trace+0x15e/0x1e0
[Wed Apr 17 22:01:01 2024]  do_init_module+0x4a/0x200
[Wed Apr 17 22:01:01 2024]  load_module+0x21d9/0x2420
[Wed Apr 17 22:01:01 2024]  ? __do_sys_finit_module+0xad/0x110
[Wed Apr 17 22:01:01 2024]  __do_sys_finit_module+0xad/0x110
[Wed Apr 17 22:01:01 2024]  do_syscall_64+0x53/0x110
[Wed Apr 17 22:01:01 2024]  entry_SYSCALL_64_after_hwframe+0x5c/0xc1
[Wed Apr 17 22:01:01 2024] RIP: 0033:0x7ff9b2a72af9
[Wed Apr 17 22:01:01 2024] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 67 63 0c 00 f7 d8 64 89 01 48
[Wed Apr 17 22:01:01 2024] RSP: 002b:00007fff70193168 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[Wed Apr 17 22:01:01 2024] RAX: ffffffffffffffda RBX: 000055d1ae7627b0 RCX: 00007ff9b2a72af9
[Wed Apr 17 22:01:01 2024] RDX: 0000000000000000 RSI: 000055d1ae762260 RDI: 0000000000000003
[Wed Apr 17 22:01:01 2024] RBP: 000055d1ae762260 R08: 0000000000000000 R09: 0000000000000000
[Wed Apr 17 22:01:01 2024] R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
[Wed Apr 17 22:01:01 2024] R13: 000055d1ae762780 R14: 0000000000000000 R15: 000055d1ae762260
[Wed Apr 17 22:01:01 2024] Modules linked in: elastio_snap(OE+) rfkill bridge stp llc xen_gntdev xen_evtchn xenfs xen_privcmd sb_edac crct10dif_pclmul crc32_pclmul ghash_clmulni_intel joydev pcspkr virtio_balloon virtio_console serio_raw sg evdev qemu_fw_cfg dm_mod parport_pc ppdev lp parport ip_tables x_tables autofs4 ext4 crc16 mbcache jbd2 crc32c_generic fscrypto ecb hid_generic usbhid hid sd_mod virtio_net sr_mod cdrom virtio_scsi net_failover failover bochs_drm crc32c_intel ata_generic ttm drm_kms_helper drm ata_piix uhci_hcd aesni_intel ehci_hcd aes_x86_64 crypto_simd libata cryptd glue_helper psmouse virtio_pci virtio_ring virtio i2c_piix4 scsi_mod usbcore usb_common floppy button [last unloaded: dattobd]
[Wed Apr 17 22:01:01 2024] ---[ end trace 9f343a71de52d316 ]---
[Wed Apr 17 22:01:01 2024] RIP: e030:disable_page_protection+0x11/0x20 [elastio_snap]
[Wed Apr 17 22:01:01 2024] Code: ff ff 89 0d 49 04 01 00 89 35 47 04 01 00 c3 66 2e 0f 1f 84 00 00 00 00 00 e8 5b 57 b0 c0 66 90 48 89 c2 48 81 e2 ff ff fe ff <0f> 22 c2 c3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 8b
[Wed Apr 17 22:01:01 2024] RSP: e02b:ffffc9004539fca0 EFLAGS: 00010206
[Wed Apr 17 22:01:01 2024] RAX: 0000000080050033 RBX: 0000000000000000 RCX: 0000000000000006
[Wed Apr 17 22:01:01 2024] RDX: 0000000080040033 RSI: 0000000000000001 RDI: ffff888073c1b6b0
[Wed Apr 17 22:01:01 2024] RBP: ffffffff81c00280 R08: 0000000000000213 R09: 0000000000000004
[Wed Apr 17 22:01:01 2024] R10: 0000000000000000 R11: 0000000000000001 R12: ffffffffc05232c0
[Wed Apr 17 22:01:01 2024] R13: ffffffffc0523158 R14: ffffc9004539fe98 R15: ffffffffc0523140
[Wed Apr 17 22:01:01 2024] FS:  00007ff9b29584c0(0000) GS:ffff888073c00000(0000) knlGS:0000000000000000
[Wed Apr 17 22:01:01 2024] CS:  e033 DS: 0000 ES: 0000 CR0: 0000000080050033
[Wed Apr 17 22:01:01 2024] CR2: 000055d1ad158aa0 CR3: 0000000067b90000 CR4: 0000000000040660

The error message seems to be related to the special kernel of Debian Xen hypervisor. It appears to be encountering an error while handling inject syscall table, specifically 'disable_page_protection'. I'm noting this down for reference, and will provide updates if there are any developments.