All of lore.kernel.org
 help / color / mirror / Atom feed
* general protection fault in do_move_mount
@ 2019-05-09  5:40 syzbot
  2019-05-09  6:30 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2019-05-09  5:40 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel, syzkaller-bugs, viro

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+494c7ddf66acac0ad747@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 syzkaller@googlegroups.com.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: general protection fault in do_move_mount
  2019-05-09  5:40 general protection fault in do_move_mount syzbot
@ 2019-05-09  6:30 ` Al Viro
  2019-05-09  6:33   ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2019-05-09  6:30 UTC (permalink / raw)
  To: syzbot; +Cc: linux-fsdevel, linux-kernel, syzkaller-bugs, 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+494c7ddf66acac0ad747@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+494c7ddf66acac0ad747@syzkaller.appspotmail.com
Signed-off-by: Al Viro <viro@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)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: general protection fault in do_move_mount
  2019-05-09  6:30 ` Al Viro
@ 2019-05-09  6:33   ` Al Viro
  0 siblings, 0 replies; 3+ messages in thread
From: Al Viro @ 2019-05-09  6:33 UTC (permalink / raw)
  To: syzbot; +Cc: linux-fsdevel, linux-kernel, syzkaller-bugs, 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+494c7ddf66acac0ad747@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...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-09  6:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-09  5:40 general protection fault in do_move_mount syzbot
2019-05-09  6:30 ` Al Viro
2019-05-09  6:33   ` Al Viro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.