* [syzbot] [afs?] general protection fault in afs_atcell_get_link
@ 2025-03-18 8:10 syzbot
2025-03-18 9:10 ` [syzbot] " syzbot
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: syzbot @ 2025-03-18 8:10 UTC (permalink / raw)
To: dhowells, linux-afs, linux-kernel, marc.dionne, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: b35233e7bfa0 Merge tag 'for-6.14/dm-fixes-2' of git://git...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1232704c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=317038cbd53153e8
dashboard link: https://syzkaller.appspot.com/bug?extid=76a6f18e3af82e84f264
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17d3fc78580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=169fb874580000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-b35233e7.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1b21b01e0ec9/vmlinux-b35233e7.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d08ea80ce857/bzImage-b35233e7.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+76a6f18e3af82e84f264@syzkaller.appspotmail.com
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000056: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x00000000000002b0-0x00000000000002b7]
CPU: 2 UID: 0 PID: 5932 Comm: syz-executor998 Not tainted 6.14.0-rc6-syzkaller-00189-gb35233e7bfa0 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:afs_atcell_get_link+0x33e/0x480 fs/afs/dynroot.c:321
Code: 89 c3 89 c6 e8 53 af 3b fe 85 db 75 64 e8 4a b4 3b fe 48 8d bd b0 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 1f 01 00 00 4c 89 f6 bf 03 00 00 00 4c 8b a5 b0
RSP: 0018:ffffc90004c3f988 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000001 RCX: ffffffff837e3e8a
RDX: 0000000000000056 RSI: ffffffff837e3e16 RDI: 00000000000002b0
RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
R13: ffff8881082b6000 R14: 0000000000000003 R15: ffff8880345a1480
FS: 000055559399f380(0000) GS:ffff88806a800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005555939b0738 CR3: 000000002712e000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
pick_link fs/namei.c:1914 [inline]
step_into+0x1982/0x2220 fs/namei.c:1984
open_last_lookups fs/namei.c:3777 [inline]
path_openat+0x74c/0x2d80 fs/namei.c:3986
do_filp_open+0x20c/0x470 fs/namei.c:4016
do_sys_openat2+0x17a/0x1e0 fs/open.c:1428
do_sys_open fs/open.c:1443 [inline]
__do_sys_openat fs/open.c:1459 [inline]
__se_sys_openat fs/open.c:1454 [inline]
__x64_sys_openat+0x175/0x210 fs/open.c:1454
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f2317244161
Code: 75 57 89 f0 25 00 00 41 00 3d 00 00 41 00 74 49 80 3d 0a 8f 07 00 00 74 6d 89 da 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 93 00 00 00 48 8b 54 24 28 64 48 2b 14 25
RSP: 002b:00007ffd89f6cc50 EFLAGS: 00000202 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f2317244161
RDX: 0000000000000000 RSI: 00007ffd89f6cd80 RDI: 00000000ffffff9c
RBP: 00007ffd89f6cd80 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007ffd89f6de70
R13: 00005555939a8700 R14: 000055559399f338 R15: 0000000000000001
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:afs_atcell_get_link+0x33e/0x480 fs/afs/dynroot.c:321
Code: 89 c3 89 c6 e8 53 af 3b fe 85 db 75 64 e8 4a b4 3b fe 48 8d bd b0 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 1f 01 00 00 4c 89 f6 bf 03 00 00 00 4c 8b a5 b0
RSP: 0018:ffffc90004c3f988 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000001 RCX: ffffffff837e3e8a
RDX: 0000000000000056 RSI: ffffffff837e3e16 RDI: 00000000000002b0
RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
R13: ffff8881082b6000 R14: 0000000000000003 R15: ffff8880345a1480
FS: 000055559399f380(0000) GS:ffff88806a800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005555939b0738 CR3: 000000002712e000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 89 c3 mov %eax,%ebx
2: 89 c6 mov %eax,%esi
4: e8 53 af 3b fe call 0xfe3baf5c
9: 85 db test %ebx,%ebx
b: 75 64 jne 0x71
d: e8 4a b4 3b fe call 0xfe3bb45c
12: 48 8d bd b0 02 00 00 lea 0x2b0(%rbp),%rdi
19: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
20: fc ff df
23: 48 89 fa mov %rdi,%rdx
26: 48 c1 ea 03 shr $0x3,%rdx
* 2a: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2e: 0f 85 1f 01 00 00 jne 0x153
34: 4c 89 f6 mov %r14,%rsi
37: bf 03 00 00 00 mov $0x3,%edi
3c: 4c rex.WR
3d: 8b .byte 0x8b
3e: a5 movsl %ds:(%rsi),%es:(%rdi)
3f: b0 .byte 0xb0
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [syzbot] Re: [syzbot] [afs?] general protection fault in afs_atcell_get_link
2025-03-18 8:10 [syzbot] [afs?] general protection fault in afs_atcell_get_link syzbot
@ 2025-03-18 9:10 ` syzbot
2025-03-18 9:17 ` Edward Adam Davis
2025-03-18 9:26 ` [PATCH] afs: Fix a null-ptr-deref " Edward Adam Davis
2 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2025-03-18 9:10 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: Re: [syzbot] [afs?] general protection fault in afs_atcell_get_link
Author: enjuk@amazon.com
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: b35233e7bfa0 Merge tag 'for-6.14/dm-fixes-2' of git://git...
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1232704c580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=317038cbd53153e8
> dashboard link: https://syzkaller.appspot.com/bug?extid=76a6f18e3af82e84f264
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17d3fc78580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=169fb874580000
#syz test
diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
index 9732a1e17db3..3ea5e388ee16 100644
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -213,6 +213,9 @@ static const char *afs_atcell_get_link(struct dentry *dentry, struct inode *inod
if (!dentry) {
/* We're in RCU-pathwalk. */
cell = rcu_dereference(net->ws_cell);
+ if (!cell)
+ return ERR_PTR(-ENOENT);
+
if (dotted)
name = cell->name - 1;
else
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [syzbot] [afs?] general protection fault in afs_atcell_get_link
2025-03-18 8:10 [syzbot] [afs?] general protection fault in afs_atcell_get_link syzbot
2025-03-18 9:10 ` [syzbot] " syzbot
@ 2025-03-18 9:17 ` Edward Adam Davis
2025-03-18 9:51 ` syzbot
2025-03-18 9:26 ` [PATCH] afs: Fix a null-ptr-deref " Edward Adam Davis
2 siblings, 1 reply; 5+ messages in thread
From: Edward Adam Davis @ 2025-03-18 9:17 UTC (permalink / raw)
To: syzbot+76a6f18e3af82e84f264; +Cc: linux-kernel, syzkaller-bugs
#syz test
diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
index 008698d706ca..7d997f7a8028 100644
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -314,6 +314,9 @@ static const char *afs_atcell_get_link(struct dentry *dentry, struct inode *inod
const char *name;
bool dotted = vnode->fid.vnode == 3;
+ if (!rcu_access_pointer(net->ws_cell))
+ return ERR_PTR(-ENOENT);
+
if (!dentry) {
/* We're in RCU-pathwalk. */
cell = rcu_dereference(net->ws_cell);
@@ -325,9 +328,6 @@ static const char *afs_atcell_get_link(struct dentry *dentry, struct inode *inod
return name;
}
- if (!rcu_access_pointer(net->ws_cell))
- return ERR_PTR(-ENOENT);
-
down_read(&net->cells_lock);
cell = rcu_dereference_protected(net->ws_cell, lockdep_is_held(&net->cells_lock));
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH] afs: Fix a null-ptr-deref in afs_atcell_get_link
2025-03-18 8:10 [syzbot] [afs?] general protection fault in afs_atcell_get_link syzbot
2025-03-18 9:10 ` [syzbot] " syzbot
2025-03-18 9:17 ` Edward Adam Davis
@ 2025-03-18 9:26 ` Edward Adam Davis
2 siblings, 0 replies; 5+ messages in thread
From: Edward Adam Davis @ 2025-03-18 9:26 UTC (permalink / raw)
To: syzbot+76a6f18e3af82e84f264
Cc: dhowells, linux-afs, linux-kernel, marc.dionne, syzkaller-bugs
syzbot report a null-ptr-deref in afs_atcell_get_link. [1]
Before accessing ws_cell, we need to confirm that it is valid.
[1]
KASAN: null-ptr-deref in range [0x00000000000002b0-0x00000000000002b7]
CPU: 2 UID: 0 PID: 5932 Comm: syz-executor998 Not tainted 6.14.0-rc6-syzkaller-00189-gb35233e7bfa0 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:afs_atcell_get_link+0x33e/0x480 fs/afs/dynroot.c:321
Code: 89 c3 89 c6 e8 53 af 3b fe 85 db 75 64 e8 4a b4 3b fe 48 8d bd b0 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 1f 01 00 00 4c 89 f6 bf 03 00 00 00 4c 8b a5 b0
RSP: 0018:ffffc90004c3f988 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000001 RCX: ffffffff837e3e8a
RDX: 0000000000000056 RSI: ffffffff837e3e16 RDI: 00000000000002b0
RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
R13: ffff8881082b6000 R14: 0000000000000003 R15: ffff8880345a1480
FS: 000055559399f380(0000) GS:ffff88806a800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005555939b0738 CR3: 000000002712e000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
pick_link fs/namei.c:1914 [inline]
step_into+0x1982/0x2220 fs/namei.c:1984
open_last_lookups fs/namei.c:3777 [inline]
path_openat+0x74c/0x2d80 fs/namei.c:3986
do_filp_open+0x20c/0x470 fs/namei.c:4016
do_sys_openat2+0x17a/0x1e0 fs/open.c:1428
do_sys_open fs/open.c:1443 [inline]
__do_sys_openat fs/open.c:1459 [inline]
__se_sys_openat fs/open.c:1454 [inline]
__x64_sys_openat+0x175/0x210 fs/open.c:1454
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
Fixes: 823869e1e616 ("afs: Fix afs_atcell_get_link() to handle RCU pathwalk")
Reported-by: syzbot+76a6f18e3af82e84f264@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=76a6f18e3af82e84f264
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
fs/afs/dynroot.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
index 008698d706ca..7d997f7a8028 100644
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -314,6 +314,9 @@ static const char *afs_atcell_get_link(struct dentry *dentry, struct inode *inod
const char *name;
bool dotted = vnode->fid.vnode == 3;
+ if (!rcu_access_pointer(net->ws_cell))
+ return ERR_PTR(-ENOENT);
+
if (!dentry) {
/* We're in RCU-pathwalk. */
cell = rcu_dereference(net->ws_cell);
@@ -325,9 +328,6 @@ static const char *afs_atcell_get_link(struct dentry *dentry, struct inode *inod
return name;
}
- if (!rcu_access_pointer(net->ws_cell))
- return ERR_PTR(-ENOENT);
-
down_read(&net->cells_lock);
cell = rcu_dereference_protected(net->ws_cell, lockdep_is_held(&net->cells_lock));
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-03-18 9:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18 8:10 [syzbot] [afs?] general protection fault in afs_atcell_get_link syzbot
2025-03-18 9:10 ` [syzbot] " syzbot
2025-03-18 9:17 ` Edward Adam Davis
2025-03-18 9:51 ` syzbot
2025-03-18 9:26 ` [PATCH] afs: Fix a null-ptr-deref " Edward Adam Davis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox