* general protection fault in make_kuid
@ 2019-07-22 14:38 syzbot
2019-08-22 5:16 ` [PATCH] vfs: set fs_context::user_ns for reconfigure Eric Biggers
0 siblings, 1 reply; 4+ messages in thread
From: syzbot @ 2019-07-22 14:38 UTC (permalink / raw)
To: allison, davem, gregkh, jic23, knaack.h, kstewart, lars,
linus.walleij, linux-iio, linux-kernel, mchehab+samsung,
nicolas.ferre, paulmck, pmeerw, rfontana, syzkaller-bugs, tglx,
torvalds
Hello,
syzbot found the following crash on:
HEAD commit: 6d21a41b Add linux-next specific files for 20190718
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=15200158600000
kernel config: https://syzkaller.appspot.com/x/.config?x=3430a151e1452331
dashboard link: https://syzkaller.appspot.com/bug?extid=7d6a57304857423318a5
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1688da20600000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16de4894600000
The bug was bisected to:
commit e786741ff1b52769b044b7f4407f39cd13ee5d2d
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Thu Jul 11 22:36:02 2019 +0000
Merge tag 'staging-5.3-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=16610cf0600000
final crash: https://syzkaller.appspot.com/x/report.txt?x=15610cf0600000
console output: https://syzkaller.appspot.com/x/log.txt?x=11610cf0600000
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+7d6a57304857423318a5@syzkaller.appspotmail.com
Fixes: e786741ff1b5 ("Merge tag 'staging-5.3-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging")
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: 0 PID: 9000 Comm: syz-executor213 Not tainted 5.2.0-next-20190718 #41
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
RIP: 0010:map_id_range_down+0x87/0x370 /kernel/user_namespace.c:293
Code: 6e 81 c7 00 f1 f1 f1 f1 c7 40 04 00 04 f3 f3 65 48 8b 04 25 28 00 00
00 48 89 45 d0 31 c0 e8 c0 a5 03 00 4c 89 f8 48 c1 e8 03 <42> 0f b6 04 28
84 c0 74 08 3c 03 0f 8e 9f 02 00 00 4c 8b ad 68 ff
RSP: 0018:ffff88809a567a30 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff88809a567aa8 RCX: ffffffff825b97b5
RDX: 0000000000000000 RSI: ffffffff816edf30 RDI: 0000000000000000
RBP: ffff88809a567ad0 R08: ffff88808e4d2600 R09: ffffed1014af1713
R10: ffffed1014af1712 R11: 0000000000000003 R12: 0000000000000001
R13: dffffc0000000000 R14: 0000000000000000 R15: 0000000000000000
FS: 0000555555618880(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000084 CR3: 000000008b2ec000 CR4: 00000000001406f0
Call Trace:
map_id_down /kernel/user_namespace.c:312 [inline]
make_kuid+0x23/0x30 /kernel/user_namespace.c:389
fuse_parse_param+0x2cb/0x750 /fs/fuse/inode.c:523
vfs_parse_fs_param+0x2ca/0x540 /fs/fs_context.c:145
vfs_parse_fs_string+0x105/0x170 /fs/fs_context.c:188
generic_parse_monolithic+0x181/0x200 /fs/fs_context.c:228
parse_monolithic_mount_data+0x69/0x90 /fs/fs_context.c:708
do_remount /fs/namespace.c:2520 [inline]
do_mount+0x924/0x1c30 /fs/namespace.c:3102
ksys_mount+0xdb/0x150 /fs/namespace.c:3320
__do_sys_mount /fs/namespace.c:3334 [inline]
__se_sys_mount /fs/namespace.c:3331 [inline]
__x64_sys_mount+0xbe/0x150 /fs/namespace.c:3331
do_syscall_64+0xfd/0x6a0 /arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4406e9
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 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 5b 14 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffdf71f73c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000007275 RCX: 00000000004406e9
RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000000
RBP: 00000000006cb018 R08: 0000000020000300 R09: 65732f636f72702f
R10: 0000000000000070 R11: 0000000000000246 R12: 0000000000401fd0
R13: 0000000000402060 R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
---[ end trace 4fbbc963024437d2 ]---
RIP: 0010:map_id_range_down+0x87/0x370 /kernel/user_namespace.c:293
Code: 6e 81 c7 00 f1 f1 f1 f1 c7 40 04 00 04 f3 f3 65 48 8b 04 25 28 00 00
00 48 89 45 d0 31 c0 e8 c0 a5 03 00 4c 89 f8 48 c1 e8 03 <42> 0f b6 04 28
84 c0 74 08 3c 03 0f 8e 9f 02 00 00 4c 8b ad 68 ff
RSP: 0018:ffff88809a567a30 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff88809a567aa8 RCX: ffffffff825b97b5
RDX: 0000000000000000 RSI: ffffffff816edf30 RDI: 0000000000000000
RBP: ffff88809a567ad0 R08: ffff88808e4d2600 R09: ffffed1014af1713
R10: ffffed1014af1712 R11: 0000000000000003 R12: 0000000000000001
R13: dffffc0000000000 R14: 0000000000000000 R15: 0000000000000000
FS: 0000555555618880(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000084 CR3: 000000008b2ec000 CR4: 00000000001406f0
---
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.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] vfs: set fs_context::user_ns for reconfigure
2019-07-22 14:38 general protection fault in make_kuid syzbot
@ 2019-08-22 5:16 ` Eric Biggers
2019-08-31 3:12 ` Eric Biggers
0 siblings, 1 reply; 4+ messages in thread
From: Eric Biggers @ 2019-08-22 5:16 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel
Cc: syzkaller-bugs, syzbot+7d6a57304857423318a5, David Howells,
Miklos Szeredi
From: Eric Biggers <ebiggers@google.com>
fs_context::user_ns is used by fuse_parse_param(), even during remount,
so it needs to be set to the existing value for reconfigure.
Reproducer:
#include <fcntl.h>
#include <sys/mount.h>
int main()
{
char opts[128];
int fd = open("/dev/fuse", O_RDWR);
sprintf(opts, "fd=%d,rootmode=040000,user_id=0,group_id=0", fd);
mkdir("mnt", 0777);
mount("foo", "mnt", "fuse.foo", 0, opts);
mount("foo", "mnt", "fuse.foo", MS_REMOUNT, opts);
}
Crash:
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 0 P4D 0
Oops: 0000 [#1] SMP
CPU: 0 PID: 129 Comm: syz_make_kuid Not tainted 5.3.0-rc5-next-20190821 #3
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-20181126_142135-anatol 04/01/2014
RIP: 0010:map_id_range_down+0xb/0xc0 kernel/user_namespace.c:291
[...]
Call Trace:
map_id_down kernel/user_namespace.c:312 [inline]
make_kuid+0xe/0x10 kernel/user_namespace.c:389
fuse_parse_param+0x116/0x210 fs/fuse/inode.c:523
vfs_parse_fs_param+0xdb/0x1b0 fs/fs_context.c:145
vfs_parse_fs_string+0x6a/0xa0 fs/fs_context.c:188
generic_parse_monolithic+0x85/0xc0 fs/fs_context.c:228
parse_monolithic_mount_data+0x1b/0x20 fs/fs_context.c:708
do_remount fs/namespace.c:2525 [inline]
do_mount+0x39a/0xa60 fs/namespace.c:3107
ksys_mount+0x7d/0xd0 fs/namespace.c:3325
__do_sys_mount fs/namespace.c:3339 [inline]
__se_sys_mount fs/namespace.c:3336 [inline]
__x64_sys_mount+0x20/0x30 fs/namespace.c:3336
do_syscall_64+0x4a/0x1a0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Reported-by: syzbot+7d6a57304857423318a5@syzkaller.appspotmail.com
Fixes: 408cbe695350 ("vfs: Convert fuse to use the new mount API")
Cc: David Howells <dhowells@redhat.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
fs/fs_context.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/fs_context.c b/fs/fs_context.c
index cc61d305dc4b..44c4174b250a 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -279,10 +279,8 @@ static struct fs_context *alloc_fs_context(struct file_system_type *fs_type,
fc->user_ns = get_user_ns(reference->d_sb->s_user_ns);
break;
case FS_CONTEXT_FOR_RECONFIGURE:
- /* We don't pin any namespaces as the superblock's
- * subscriptions cannot be changed at this point.
- */
atomic_inc(&reference->d_sb->s_active);
+ fc->user_ns = get_user_ns(reference->d_sb->s_user_ns);
fc->root = dget(reference);
break;
}
--
2.22.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] vfs: set fs_context::user_ns for reconfigure
2019-08-22 5:16 ` [PATCH] vfs: set fs_context::user_ns for reconfigure Eric Biggers
@ 2019-08-31 3:12 ` Eric Biggers
2019-09-06 2:59 ` Eric Biggers
0 siblings, 1 reply; 4+ messages in thread
From: Eric Biggers @ 2019-08-31 3:12 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel
Cc: syzkaller-bugs, syzbot+7d6a57304857423318a5, David Howells,
Miklos Szeredi
On Wed, Aug 21, 2019 at 10:16:33PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> fs_context::user_ns is used by fuse_parse_param(), even during remount,
> so it needs to be set to the existing value for reconfigure.
>
> Reproducer:
>
> #include <fcntl.h>
> #include <sys/mount.h>
>
> int main()
> {
> char opts[128];
> int fd = open("/dev/fuse", O_RDWR);
>
> sprintf(opts, "fd=%d,rootmode=040000,user_id=0,group_id=0", fd);
> mkdir("mnt", 0777);
> mount("foo", "mnt", "fuse.foo", 0, opts);
> mount("foo", "mnt", "fuse.foo", MS_REMOUNT, opts);
> }
>
> Crash:
> BUG: kernel NULL pointer dereference, address: 0000000000000000
> #PF: supervisor read access in kernel mode
> #PF: error_code(0x0000) - not-present page
> PGD 0 P4D 0
> Oops: 0000 [#1] SMP
> CPU: 0 PID: 129 Comm: syz_make_kuid Not tainted 5.3.0-rc5-next-20190821 #3
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-20181126_142135-anatol 04/01/2014
> RIP: 0010:map_id_range_down+0xb/0xc0 kernel/user_namespace.c:291
> [...]
> Call Trace:
> map_id_down kernel/user_namespace.c:312 [inline]
> make_kuid+0xe/0x10 kernel/user_namespace.c:389
> fuse_parse_param+0x116/0x210 fs/fuse/inode.c:523
> vfs_parse_fs_param+0xdb/0x1b0 fs/fs_context.c:145
> vfs_parse_fs_string+0x6a/0xa0 fs/fs_context.c:188
> generic_parse_monolithic+0x85/0xc0 fs/fs_context.c:228
> parse_monolithic_mount_data+0x1b/0x20 fs/fs_context.c:708
> do_remount fs/namespace.c:2525 [inline]
> do_mount+0x39a/0xa60 fs/namespace.c:3107
> ksys_mount+0x7d/0xd0 fs/namespace.c:3325
> __do_sys_mount fs/namespace.c:3339 [inline]
> __se_sys_mount fs/namespace.c:3336 [inline]
> __x64_sys_mount+0x20/0x30 fs/namespace.c:3336
> do_syscall_64+0x4a/0x1a0 arch/x86/entry/common.c:290
> entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> Reported-by: syzbot+7d6a57304857423318a5@syzkaller.appspotmail.com
> Fixes: 408cbe695350 ("vfs: Convert fuse to use the new mount API")
> Cc: David Howells <dhowells@redhat.com>
> Cc: Miklos Szeredi <miklos@szeredi.hu>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
> fs/fs_context.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/fs_context.c b/fs/fs_context.c
> index cc61d305dc4b..44c4174b250a 100644
> --- a/fs/fs_context.c
> +++ b/fs/fs_context.c
> @@ -279,10 +279,8 @@ static struct fs_context *alloc_fs_context(struct file_system_type *fs_type,
> fc->user_ns = get_user_ns(reference->d_sb->s_user_ns);
> break;
> case FS_CONTEXT_FOR_RECONFIGURE:
> - /* We don't pin any namespaces as the superblock's
> - * subscriptions cannot be changed at this point.
> - */
> atomic_inc(&reference->d_sb->s_active);
> + fc->user_ns = get_user_ns(reference->d_sb->s_user_ns);
> fc->root = dget(reference);
> break;
> }
> --
> 2.22.1
Ping.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vfs: set fs_context::user_ns for reconfigure
2019-08-31 3:12 ` Eric Biggers
@ 2019-09-06 2:59 ` Eric Biggers
0 siblings, 0 replies; 4+ messages in thread
From: Eric Biggers @ 2019-09-06 2:59 UTC (permalink / raw)
To: David Howells, Alexander Viro, Miklos Szeredi
Cc: syzkaller-bugs, syzbot+7d6a57304857423318a5, linux-fsdevel
On Fri, Aug 30, 2019 at 10:12:28PM -0500, Eric Biggers wrote:
> On Wed, Aug 21, 2019 at 10:16:33PM -0700, Eric Biggers wrote:
> > From: Eric Biggers <ebiggers@google.com>
> >
> > fs_context::user_ns is used by fuse_parse_param(), even during remount,
> > so it needs to be set to the existing value for reconfigure.
> >
> > Reproducer:
> >
> > #include <fcntl.h>
> > #include <sys/mount.h>
> >
> > int main()
> > {
> > char opts[128];
> > int fd = open("/dev/fuse", O_RDWR);
> >
> > sprintf(opts, "fd=%d,rootmode=040000,user_id=0,group_id=0", fd);
> > mkdir("mnt", 0777);
> > mount("foo", "mnt", "fuse.foo", 0, opts);
> > mount("foo", "mnt", "fuse.foo", MS_REMOUNT, opts);
> > }
> >
> > Crash:
> > BUG: kernel NULL pointer dereference, address: 0000000000000000
> > #PF: supervisor read access in kernel mode
> > #PF: error_code(0x0000) - not-present page
> > PGD 0 P4D 0
> > Oops: 0000 [#1] SMP
> > CPU: 0 PID: 129 Comm: syz_make_kuid Not tainted 5.3.0-rc5-next-20190821 #3
> > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-20181126_142135-anatol 04/01/2014
> > RIP: 0010:map_id_range_down+0xb/0xc0 kernel/user_namespace.c:291
> > [...]
> > Call Trace:
> > map_id_down kernel/user_namespace.c:312 [inline]
> > make_kuid+0xe/0x10 kernel/user_namespace.c:389
> > fuse_parse_param+0x116/0x210 fs/fuse/inode.c:523
> > vfs_parse_fs_param+0xdb/0x1b0 fs/fs_context.c:145
> > vfs_parse_fs_string+0x6a/0xa0 fs/fs_context.c:188
> > generic_parse_monolithic+0x85/0xc0 fs/fs_context.c:228
> > parse_monolithic_mount_data+0x1b/0x20 fs/fs_context.c:708
> > do_remount fs/namespace.c:2525 [inline]
> > do_mount+0x39a/0xa60 fs/namespace.c:3107
> > ksys_mount+0x7d/0xd0 fs/namespace.c:3325
> > __do_sys_mount fs/namespace.c:3339 [inline]
> > __se_sys_mount fs/namespace.c:3336 [inline]
> > __x64_sys_mount+0x20/0x30 fs/namespace.c:3336
> > do_syscall_64+0x4a/0x1a0 arch/x86/entry/common.c:290
> > entry_SYSCALL_64_after_hwframe+0x49/0xbe
> >
> > Reported-by: syzbot+7d6a57304857423318a5@syzkaller.appspotmail.com
> > Fixes: 408cbe695350 ("vfs: Convert fuse to use the new mount API")
> > Cc: David Howells <dhowells@redhat.com>
> > Cc: Miklos Szeredi <miklos@szeredi.hu>
> > Signed-off-by: Eric Biggers <ebiggers@google.com>
> > ---
> > fs/fs_context.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/fs/fs_context.c b/fs/fs_context.c
> > index cc61d305dc4b..44c4174b250a 100644
> > --- a/fs/fs_context.c
> > +++ b/fs/fs_context.c
> > @@ -279,10 +279,8 @@ static struct fs_context *alloc_fs_context(struct file_system_type *fs_type,
> > fc->user_ns = get_user_ns(reference->d_sb->s_user_ns);
> > break;
> > case FS_CONTEXT_FOR_RECONFIGURE:
> > - /* We don't pin any namespaces as the superblock's
> > - * subscriptions cannot be changed at this point.
> > - */
> > atomic_inc(&reference->d_sb->s_active);
> > + fc->user_ns = get_user_ns(reference->d_sb->s_user_ns);
> > fc->root = dget(reference);
> > break;
> > }
> > --
> > 2.22.1
>
> Ping.
>
Ping. This is still broken in linux-next.
- Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-06 2:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-22 14:38 general protection fault in make_kuid syzbot
2019-08-22 5:16 ` [PATCH] vfs: set fs_context::user_ns for reconfigure Eric Biggers
2019-08-31 3:12 ` Eric Biggers
2019-09-06 2:59 ` Eric Biggers
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.