general protection fault in do_move_mount

8 views
Skip to first unread message

syzbot

unread,
May 9, 2019, 1:40:07 AM5/9/19
to linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, vi...@zeniv.linux.org.uk
Hello,

syzbot found the following crash on:

HEAD commit: 80f23212 Merge git://git.kernel.org/pub/scm/linux/kernel/g..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11ab8dd0a00000
kernel config: https://syzkaller.appspot.com/x/.config?x=40a58b399941db7e
dashboard link: https://syzkaller.appspot.com/bug?extid=494c7ddf66acac0ad747
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+494c7d...@syzkaller.appspotmail.com

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 8663 Comm: syz-executor.3 Not tainted 5.1.0+ #3
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
RIP: 0010:do_move_mount.isra.0+0x5eb/0xe00 fs/namespace.c:2602
Code: ff 45 89 e6 e9 a0 fb ff ff e8 d1 df b5 ff 48 8b 85 50 ff ff ff 48 8d
78 48 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f
85 6d 07 00 00 48 8b 85 50 ff ff ff 31 ff 4c 8b 78
RSP: 0018:ffff888067d97ca8 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffff888067d97e18 RCX: ffffc9000c432000
RDX: 0000000000000009 RSI: ffffffff81baa93f RDI: 0000000000000048
RBP: ffff888067d97d88 R08: ffff88808a6020c0 R09: ffffed1015d26be0
R10: ffffed1015d26bdf R11: ffff8880ae935efb R12: ffff88809e88f700
R13: ffff88808a079620 R14: ffff888067d97e40 R15: ffff8880a99cf8f0
FS: 00007fb568cc3700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff9870ffff4bb8 CR3: 000000008e438000 CR4: 00000000001426e0
Call Trace:
do_move_mount_old fs/namespace.c:2662 [inline]
do_mount+0xee7/0x1c00 fs/namespace.c:3108
ksys_mount+0xdb/0x150 fs/namespace.c:3319
__do_sys_mount fs/namespace.c:3333 [inline]
__se_sys_mount fs/namespace.c:3330 [inline]
__x64_sys_mount+0xbe/0x150 fs/namespace.c:3330
do_syscall_64+0x103/0x670 arch/x86/entry/common.c:298
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x458da9
Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fb568cc2c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 0000000000458da9
RDX: 0000000000000000 RSI: 0000000020000340 RDI: 0000000020000000
RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000002002 R11: 0000000000000246 R12: 00007fb568cc36d4
R13: 00000000004c4dfd R14: 00000000004d8ac8 R15: 00000000ffffffff
Modules linked in:
---[ end trace f3c85670e73e74c9 ]---
RIP: 0010:do_move_mount.isra.0+0x5eb/0xe00 fs/namespace.c:2602
Code: ff 45 89 e6 e9 a0 fb ff ff e8 d1 df b5 ff 48 8b 85 50 ff ff ff 48 8d
78 48 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f
85 6d 07 00 00 48 8b 85 50 ff ff ff 31 ff 4c 8b 78
RSP: 0018:ffff888067d97ca8 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffff888067d97e18 RCX: ffffc9000c432000
RDX: 0000000000000009 RSI: ffffffff81baa93f RDI: 0000000000000048
RBP: ffff888067d97d88 R08: ffff88808a6020c0 R09: ffffed1015d26be0
R10: ffffed1015d26bdf R11: ffff8880ae935efb R12: ffff88809e88f700
R13: ffff88808a079620 R14: ffff888067d97e40 R15: ffff8880a99cf8f0
FS: 00007fb568cc3700(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000070d158 CR3: 000000008e438000 CR4: 00000000001426f0


---
This bug 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 syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

Al Viro

unread,
May 9, 2019, 2:30:41 AM5/9/19
to syzbot, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, Linus Torvalds
On Wed, May 08, 2019 at 10:40:06PM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: 80f23212 Merge git://git.kernel.org/pub/scm/linux/kernel/g..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=11ab8dd0a00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=40a58b399941db7e
> dashboard link: https://syzkaller.appspot.com/bug?extid=494c7ddf66acac0ad747
> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
>
> Unfortunately, I don't have any reproducer for this crash yet.
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+494c7d...@syzkaller.appspotmail.com

*Ugh*

That's a bloody dumb leftover from very old variant of that thing;
the following should fix it.

do_move_mount(): fix an unsafe use of is_anon_ns()

What triggers it is a race between mount --move and umount -l
of the source; we should reject it (the source is parentless *and*
not the root of anon namespace at that), but the check for namespace
being an anon one is broken in that case - is_anon_ns() needs
ns to be non-NULL. Better fixed here than in is_anon_ns(), since
the rest of the callers is guaranteed to get a non-NULL argument...

Reported-by: syzbot+494c7d...@syzkaller.appspotmail.com
Signed-off-by: Al Viro <vi...@zeniv.linux.org.uk>
---
diff --git a/fs/namespace.c b/fs/namespace.c
index 3357c3d65475..ffb13f0562b0 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2599,7 +2599,7 @@ static int do_move_mount(struct path *old_path, struct path *new_path)
if (attached && !check_mnt(old))
goto out;

- if (!attached && !is_anon_ns(ns))
+ if (!attached && !(ns && is_anon_ns(ns)))
goto out;

if (old->mnt.mnt_flags & MNT_LOCKED)

Al Viro

unread,
May 9, 2019, 2:33:56 AM5/9/19
to syzbot, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, Linus Torvalds
On Thu, May 09, 2019 at 07:30:34AM +0100, Al Viro wrote:
> On Wed, May 08, 2019 at 10:40:06PM -0700, syzbot wrote:
> > Hello,
> >
> > syzbot found the following crash on:
> >
> > HEAD commit: 80f23212 Merge git://git.kernel.org/pub/scm/linux/kernel/g..
> > git tree: upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=11ab8dd0a00000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=40a58b399941db7e
> > dashboard link: https://syzkaller.appspot.com/bug?extid=494c7ddf66acac0ad747
> > compiler: gcc (GCC) 9.0.0 20181231 (experimental)
> >
> > Unfortunately, I don't have any reproducer for this crash yet.
> >
> > IMPORTANT: if you fix the bug, please add the following tag to the commit:
> > Reported-by: syzbot+494c7d...@syzkaller.appspotmail.com
>
> *Ugh*
>
> That's a bloody dumb leftover from very old variant of that thing;
> the following should fix it.

In vfs.git#fixes, will send a pull request tomorrow...
Reply all
Reply to author
Forward
0 new messages