lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALAgD-4n=bgzbLyyw1Q3C=2aa=wh8FimDgS30ud_ay53hDgYBQ@mail.gmail.com>
Date: Sat, 24 Aug 2024 22:04:54 -0700
From: Xingyu Li <xli399@....edu>
To: mcgrof@...nel.org, kees@...nel.org, j.granados@...sung.com, 
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: BUG: general protection fault in put_links

Hi,

We found a bug in Linux 6.10. It is probably a null pointer reference bug.
The reason is probably that before line 123 of
fs/proc/proc_sysctl.c(entry = &head->ctl_table[ctl_node -
head->node];), there is no null pointer check for `head`.
The bug report is as follow:

Bug report:

Oops: general protection fault, probably for non-canonical address
0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 0 PID: 8491 Comm: kworker/0:5 Not tainted 6.10.0 #13
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Workqueue: events free_ipc
RIP: 0010:find_entry fs/proc/proc_sysctl.c:123 [inline]
RIP: 0010:put_links+0x19e/0x4f0 fs/proc/proc_sysctl.c:1472
Code: 0f 84 33 02 00 00 49 8d 5f 18 48 89 d8 48 c1 e8 03 42 80 3c 28
00 74 08 48 89 df e8 bc 94 c6 ff 48 8b 1b 48 89 d8 48 c1 e8 03 <42> 80
3c 28 00 74 08 48 89 df e8 a3 94 c6 ff 48 8b 2b 48 89 5c 24
RSP: 0018:ffffc9000bf87980 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff888026909e00
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: 0000000000000000
RBP: 000000000000000b R08: ffffffff822dc888 R09: ffffffff822dc93a
R10: 0000000000000002 R11: ffff888026909e00 R12: ffffffff8d9d70d0
R13: dffffc0000000000 R14: ffffffff8ba0d080 R15: ffff888018108058
FS:  0000000000000000(0000) GS:ffff888063a00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f4e64ba9930 CR3: 0000000020a88000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 drop_sysctl_table+0xed/0x4f0 fs/proc/proc_sysctl.c:1494
 unregister_sysctl_table+0x3d/0x60 fs/proc/proc_sysctl.c:1520
 retire_ipc_sysctls+0x5a/0x80 ipc/ipc_sysctl.c:310
 free_ipc_ns ipc/namespace.c:158 [inline]
 free_ipc+0x139/0x280 ipc/namespace.c:179
 process_one_work kernel/workqueue.c:3248 [inline]
 process_scheduled_works+0x977/0x1410 kernel/workqueue.c:3329
 worker_thread+0xaa0/0x1020 kernel/workqueue.c:3409
 kthread+0x2eb/0x380 kernel/kthread.c:389
 ret_from_fork+0x49/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:244
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:find_entry fs/proc/proc_sysctl.c:123 [inline]
RIP: 0010:put_links+0x19e/0x4f0 fs/proc/proc_sysctl.c:1472
Code: 0f 84 33 02 00 00 49 8d 5f 18 48 89 d8 48 c1 e8 03 42 80 3c 28
00 74 08 48 89 df e8 bc 94 c6 ff 48 8b 1b 48 89 d8 48 c1 e8 03 <42> 80
3c 28 00 74 08 48 89 df e8 a3 94 c6 ff 48 8b 2b 48 89 5c 24
RSP: 0018:ffffc9000bf87980 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff888026909e00
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: 0000000000000000
RBP: 000000000000000b R08: ffffffff822dc888 R09: ffffffff822dc93a
R10: 0000000000000002 R11: ffff888026909e00 R12: ffffffff8d9d70d0
R13: dffffc0000000000 R14: ffffffff8ba0d080 R15: ffff888018108058
FS:  0000000000000000(0000) GS:ffff888063a00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f4e64ba9930 CR3: 0000000020a88000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0: 0f 84 33 02 00 00     je     0x239
   6: 49 8d 5f 18           lea    0x18(%r15),%rbx
   a: 48 89 d8             mov    %rbx,%rax
   d: 48 c1 e8 03           shr    $0x3,%rax
  11: 42 80 3c 28 00       cmpb   $0x0,(%rax,%r13,1)
  16: 74 08                 je     0x20
  18: 48 89 df             mov    %rbx,%rdi
  1b: e8 bc 94 c6 ff       call   0xffc694dc
  20: 48 8b 1b             mov    (%rbx),%rbx
  23: 48 89 d8             mov    %rbx,%rax
  26: 48 c1 e8 03           shr    $0x3,%rax
* 2a: 42 80 3c 28 00       cmpb   $0x0,(%rax,%r13,1) <-- trapping instruction
  2f: 74 08                 je     0x39
  31: 48 89 df             mov    %rbx,%rdi
  34: e8 a3 94 c6 ff       call   0xffc694dc
  39: 48 8b 2b             mov    (%rbx),%rbp
  3c: 48                   rex.W
  3d: 89                   .byte 0x89
  3e: 5c                   pop    %rsp
  3f: 24                   .byte 0x24

-- 
Yours sincerely,
Xingyu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ