Bug#1055881: virtualbox-dkms: Linux 6.7-rc1 throws "invalid opcode" during module loading

2023-11-16 Thread Ingo Saitz
retitle 1055881 Linux 6.7-rc1 / Linux 6.6.1 UBSan errors
forwarded 1055881 https://www.virtualbox.org/ticket/21877
thanks

I found the "invalid opcode" was caused by CONFIG_UBSAN_TRAP=y, that was
set by the hardening.config from linux 6.7-rc1. Using the same options I
can reproduce the bug on 6.6.1, too.

This is also reported upstream as https://www.virtualbox.org/ticket/21877

Changing CONFIG_UBSAN_TRAP to no shows these errors in the log (see
attachment.

Sorry for the wrong noise, but I suggest to keep this bug open, since
there is no similar bug reported.

Ingo
-- 
const_cast(Λ)
[   17.127943] vboxdrv: loading out-of-tree module taints kernel.
[   17.132074] vboxdrv: Found 2 processor cores/threads
[   17.133888] 

[   17.134091] UBSAN: array-index-out-of-bounds in 
/var/lib/dkms/virtualbox/7.0.12/build/vboxdrv/common/log/log.c:1791:41
[   17.134304] index 1 is out of range for type 'uint32_t [1]'
[   17.134521] CPU: 1 PID: 1988 Comm: modprobe Tainted: G   O   
6.6.1-pinguin20231116 #1
[   17.134755] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./H97 
Anniversary, BIOS P1.20 12/15/2014
[   17.135004] Call Trace:
[   17.135259]  
[   17.135516]  dump_stack_lvl+0x32/0x40
[   17.135782]  __ubsan_handle_out_of_bounds+0xc3/0x100
[   17.136055]  VBoxHost_RTLogGroupSettings+0x472/0x490 [vboxdrv]
[   17.136347]  ? rtR0MemAllocEx+0x52/0xc0 [vboxdrv]
[   17.136573]  VBoxHost_RTLogCreateExV+0x27a/0x480 [vboxdrv]
[   17.136800]  VBoxHost_RTLogCreate+0x6a/0x90 [vboxdrv]
[   17.137030]  ? rtR0MemAllocEx+0x52/0xc0 [vboxdrv]
[   17.137263]  supdrvInitDevExt+0x54/0x320 [vboxdrv]
[   17.137498]  VBoxDrvLinuxInit+0x82/0x1000 [vboxdrv]
[   17.137738]  ? 0xc05f5000
[   17.137962]  do_one_initcall+0x8e/0x2c0
[   17.138190]  do_init_module+0x7d/0x230
[   17.138423]  init_module_from_file+0x81/0xc0
[   17.138658]  idempotent_init_module+0x119/0x230
[   17.138897]  __x64_sys_finit_module+0x4d/0x80
[   17.139140]  do_syscall_64+0x56/0xb0
[   17.139385]  entry_SYSCALL_64_after_hwframe+0x46/0xb0
[   17.139636] RIP: 0033:0x7fb8a591eee9
[   17.139888] Code: 08 89 e8 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 90 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 ff 1e 0d 00 f7 d8 64 89 01 48
[   17.140183] RSP: 002b:7fff225703a8 EFLAGS: 0246 ORIG_RAX: 
0139
[   17.140496] RAX: ffda RBX: 555e4ea0e600 RCX: 7fb8a591eee9
[   17.140814] RDX:  RSI: 555e4d89598b RDI: 0003
[   17.141137] RBP:  R08: 0060 R09: 555e4ea0f340
[   17.141464] R10: 0038 R11: 0246 R12: 555e4d89598b
[   17.141794] R13: 0004 R14: 555e4ea0e680 R15: 
[   17.142130]  
[   17.142471] 

[   17.142843] 

[   17.143196] UBSAN: array-index-out-of-bounds in 
/var/lib/dkms/virtualbox/7.0.12/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.c:399:33
[   17.143561] index 1 is out of range for type 'page *[1]'
[   17.143933] CPU: 1 PID: 1988 Comm: modprobe Tainted: G   O   
6.6.1-pinguin20231116 #1
[   17.144313] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./H97 
Anniversary, BIOS P1.20 12/15/2014
[   17.144703] Call Trace:
[   17.145097]  
[   17.145495]  dump_stack_lvl+0x32/0x40
[   17.145902]  __ubsan_handle_out_of_bounds+0xc3/0x100
[   17.146311]  rtR0MemObjLinuxAllocPages+0x325/0x340 [vboxdrv]
[   17.146746]  rtR0MemObjNativeAllocCont+0x5a/0x110 [vboxdrv]
[   17.147183]  supdrvGipCreate+0x59/0xc30 [vboxdrv]
[   17.147623]  ? rtR0MemAllocEx+0x52/0xc0 [vboxdrv]
[   17.148068]  supdrvInitDevExt+0x148/0x320 [vboxdrv]
[   17.148516]  VBoxDrvLinuxInit+0x82/0x1000 [vboxdrv]
[   17.148966]  ? 0xc05f5000
[   17.149401]  do_one_initcall+0x8e/0x2c0
[   17.149839]  do_init_module+0x7d/0x230
[   17.150280]  init_module_from_file+0x81/0xc0
[   17.150725]  idempotent_init_module+0x119/0x230
[   17.151177]  __x64_sys_finit_module+0x4d/0x80
[   17.151621]  do_syscall_64+0x56/0xb0
[   17.152065]  entry_SYSCALL_64_after_hwframe+0x46/0xb0
[   17.152510] RIP: 0033:0x7fb8a591eee9
[   17.152951] Code: 08 89 e8 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 90 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 ff 1e 0d 00 f7 d8 64 89 01 48
[   17.153431] RSP: 002b:7fff225703a8 EFLAGS: 0246 ORIG_RAX: 
0139
[   17.153925] RAX: ffda RBX: 555e4ea0e600 RCX: 7fb8a591eee9
[   17.154416] RDX:  RSI: 555e4d89598b RDI: 0003
[   17.154904] RBP:  R08: 0060 R09: 555e4ea0f340
[   17.155388] R10: 0038 R11: 0246 

Bug#1055881: virtualbox-dkms: Linux 6.7-rc1 throws "invalid opcode" during module loading

2023-11-13 Thread Ingo Saitz
Package: virtualbox-dkms
Version: 7.0.12-dfsg-1
Severity: normal

On linux 6.7-rc1 the virtualbox kernelmodules do build without problem,
but during boot the kernel throws an "illegal instruction" while loading
vboxdrv:

[   18.036170] vboxdrv: loading out-of-tree module taints kernel.
[   18.039745] vboxdrv: Found 2 processor cores/threads
[   18.040619] invalid opcode:  [#1] SMP
[   18.040828] CPU: 0 PID: 1974 Comm: modprobe Tainted: G   O   
6.7.0-rc1-pinguin20231113 #1
[   18.041044] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./H97 
Anniversary, BIOS P1.20 12/15/2014
[   18.041272] RIP: 0010:VBoxHost_RTLogGroupSettings+0x376/0x3f0 [vboxdrv]
[   18.041546] Code: d0 0f 84 8d fe ff ff 89 c6 85 f6 74 e5 0f 0b 41 09 8c 80 
bc 00 00 00 48 83 c0 01 48 39 d0 0f 84 70 fe ff ff 89 c6 85 f6 74 e5 <0f> 0b b9 
11 00 00 00 eb a0 8b 05 db ed 02 00 85 c0 75 1a 4c 8b 05
[   18.041840] RSP: 0018:a9a2c1e77a68 EFLAGS: 00010202
[   18.042158] RAX: 0001 RBX: c0637424 RCX: 0011
[   18.042488] RDX: 019d RSI: 0001 RDI: 0003
[   18.042822] RBP: a9a2c1e77ac8 R08: 8ee544150010 R09: c062a7e0
[   18.043167] R10: 8ee544150010 R11: 000c R12: c0637427
[   18.043397] R13: 0740 R14: a9a2c1e77c20 R15: 
[   18.043635] FS:  7f04f5145040() GS:8ee84fe0() 
knlGS:
[   18.043879] CS:  0010 DS:  ES:  CR0: 80050033
[   18.044129] CR2: 555689427660 CR3: 00010929b005 CR4: 000706f0
[   18.044386] Call Trace:
[   18.044646]  
[   18.044909]  ? die+0x2d/0x80
[   18.045177]  ? do_trap+0xeb/0xf0
[   18.045444]  ? VBoxHost_RTLogGroupSettings+0x376/0x3f0 [vboxdrv]
[   18.045740]  ? do_error_trap+0x60/0x80
[   18.046019]  ? VBoxHost_RTLogGroupSettings+0x376/0x3f0 [vboxdrv]
[   18.046322]  ? exc_invalid_op+0x49/0x60
[   18.046611]  ? VBoxHost_RTLogGroupSettings+0x376/0x3f0 [vboxdrv]
[   18.046923]  ? asm_exc_invalid_op+0x16/0x20
[   18.047222]  ? VBoxHost_RTLogGroupSettings+0x376/0x3f0 [vboxdrv]
[   18.047544]  ? rtR0MemAllocEx+0x52/0xc0 [vboxdrv]
[   18.047871]  VBoxHost_RTLogCreateExV+0x27b/0x470 [vboxdrv]
[   18.048203]  VBoxHost_RTLogCreate+0x6a/0x90 [vboxdrv]
[   18.048537]  ? rtR0MemAllocEx+0x52/0xc0 [vboxdrv]
[   18.048875]  supdrvInitDevExt+0x54/0x320 [vboxdrv]
[   18.049216]  VBoxDrvLinuxInit+0x82/0x1000 [vboxdrv]
[   18.049561]  ? 0xc05b7000
[   18.049891]  do_one_initcall+0x87/0x2a0
[   18.050223]  do_init_module+0x7d/0x230
[   18.050561]  init_module_from_file+0x81/0xc0
[   18.050901]  idempotent_init_module+0x119/0x230
[   18.051246]  __x64_sys_finit_module+0x4d/0x80
[   18.051592]  do_syscall_64+0x56/0x100
[   18.051944]  ? handle_mm_fault+0xe1/0x1c0
[   18.052298]  ? exc_page_fault+0x276/0x680
[   18.052655]  entry_SYSCALL_64_after_hwframe+0x46/0x4e
[   18.053017] RIP: 0033:0x7f04f4b1eee9
[   18.053381] Code: 08 89 e8 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 90 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 ff 1e 0d 00 f7 d8 64 89 01 48
[   18.053786] RSP: 002b:7ffe7c2cf7b8 EFLAGS: 0246 ORIG_RAX: 
0139
[   18.054207] RAX: ffda RBX: 556c56beb4e0 RCX: 7f04f4b1eee9
[   18.054635] RDX:  RSI: 556c54d7998b RDI: 0003
[   18.055069] RBP:  R08: 0060 R09: 556c56bec340
[   18.055508] R10: 0038 R11: 0246 R12: 556c54d7998b
[   18.055947] R13: 0004 R14: 556c56beb560 R15: 
[   18.056393]  
[   18.056842] Modules linked in: vboxdrv(O+) sha256_ssse3 sha1_ssse3 
sha1_generic
[   18.057310] ---[ end trace  ]---
[   18.057775] RIP: 0010:VBoxHost_RTLogGroupSettings+0x376/0x3f0 [vboxdrv]
[   18.058267] Code: d0 0f 84 8d fe ff ff 89 c6 85 f6 74 e5 0f 0b 41 09 8c 80 
bc 00 00 00 48 83 c0 01 48 39 d0 0f 84 70 fe ff ff 89 c6 85 f6 74 e5 <0f> 0b b9 
11 00 00 00 eb a0 8b 05 db ed 02 00 85 c0 75 1a 4c 8b 05
[   18.058773] RSP: 0018:a9a2c1e77a68 EFLAGS: 00010202
[   18.059290] RAX: 0001 RBX: c0637424 RCX: 0011
[   18.059809] RDX: 019d RSI: 0001 RDI: 0003
[   18.060328] RBP: a9a2c1e77ac8 R08: 8ee544150010 R09: c062a7e0
[   18.060852] R10: 8ee544150010 R11: 000c R12: c0637427
[   18.061373] R13: 0740 R14: a9a2c1e77c20 R15: 
[   18.061895] FS:  7f04f5145040() GS:8ee84fe0() 
knlGS:
[   18.062419] CS:  0010 DS:  ES:  CR0: 80050033
[   18.062939] CR2: 555689427660 CR3: 00010929b005 CR4: 000706f0




-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (800, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.6.1