KSPP / linux

Linux kernel source tree (Kernel Self Protection Project)
https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project
Other
80 stars 5 forks source link

UBSAN: signed-integer-overflow in ../kernel/time/ntp.c:738:18 #352

Open JustinStitt opened 2 months ago

JustinStitt commented 2 months ago

syzkaller report:

[   46.809326] ------------[ cut here ]------------
[   46.812882] UBSAN: signed-integer-overflow in ../kernel/time/ntp.c:738:18
[   46.817676] 9223372036854775806 + 4 cannot be represented in type 'long'
[   46.822346] CPU: 1 PID: 685 Comm: syz-executor.0 Not tainted 6.8.0-rc2-00036-g679ee73ec453 #2
[   46.828270] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   46.834836] Call Trace:
[   46.836625]  <TASK>
[   46.838147]  dump_stack_lvl+0x93/0xd0
[   46.840771]  handle_overflow+0x171/0x1b0
[   46.843516]  __do_adjtimex+0x1236/0x1440
[   46.846275]  do_adjtimex+0x2be/0x740
[   46.848864]  __x64_sys_clock_adjtime+0x154/0x1d0
[   46.852164]  do_syscall_64+0xd7/0x1b0
[   46.854783]  ? arch_exit_to_user_mode_prepare+0x11/0x60
[   46.858426]  entry_SYSCALL_64_after_hwframe+0x6f/0x77
[   46.861914] RIP: 0033:0x7fde90aaf539
[   46.864500] Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 14 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 c7 c1 8
[   46.877151] RSP: 002b:00007ffebfe63358 EFLAGS: 00000246 ORIG_RAX: 0000000000000131
[   46.882279] RAX: ffffffffffffffda RBX: 00007fde90be3f80 RCX: 00007fde90aaf539
[   46.887270] RDX: 0000000000000000 RSI: 0000000020000280 RDI: 0000000000000000
[   46.892174] RBP: 00007fde90b0e496 R08: 0000000000000000 R09: 0000000000000000
[   46.897061] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
[   46.902020] R13: 0000000000000095 R14: 00007fde90be3f80 R15: 00007fde90be3f80
[   46.906946]  </TASK>
[   46.908537] ---[ end trace ]---

patch coming shortly.

JustinStitt commented 2 months ago

~patch: https://lore.kernel.org/r/20240506-b4-sio-ntp-c-v1-1-a01281aa01ba@google.com~ v2: https://lore.kernel.org/r/20240517-b4-sio-ntp-c-v2-1-f3a80096f36f@google.com