linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] WARNING in ovl_create_real
@ 2021-08-31 10:36 syzbot
  2021-09-07 14:03 ` Miklos Szeredi
  0 siblings, 1 reply; 5+ messages in thread
From: syzbot @ 2021-08-31 10:36 UTC (permalink / raw)
  To: linux-kernel, linux-unionfs, miklos, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    4ccc9e2db7ac Add linux-next specific files for 20210729
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=13891f5c300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=75a5bed89b5c0fd2
dashboard link: https://syzkaller.appspot.com/bug?extid=75eab84fd0af9e8bf66b
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1085e076300000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14247a56300000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+75eab84fd0af9e8bf66b@syzkaller.appspotmail.com

------------[ cut here ]------------
WARNING: CPU: 1 PID: 6576 at fs/overlayfs/dir.c:212 ovl_create_real+0x272/0x520 fs/overlayfs/dir.c:212
Modules linked in:
CPU: 1 PID: 6576 Comm: syz-executor088 Not tainted 5.14.0-rc3-next-20210729-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:ovl_create_real+0x272/0x520 fs/overlayfs/dir.c:212
Code: 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 80 02 00 00 49 83 7c 24 68 00 0f 85 7a fe ff ff e8 de b6 c3 fe <0f> 0b 4c 89 e5 49 c7 c4 fb ff ff ff e9 57 fe ff ff 66 81 eb 00 10
RSP: 0018:ffffc90002bef958 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000004000 RCX: 0000000000000000
RDX: ffff88807b10b900 RSI: ffffffff82b20102 RDI: ffff88806f971208
RBP: ffff88806f9711a0 R08: 0000000000000000 R09: 0000000000000000
R10: ffffffff82b2018b R11: 0000000000000000 R12: ffff88806f9711a0
R13: 0000000000004000 R14: ffff8880715c8a20 R15: ffff8880715c8b00
FS:  00007fe7eef6d700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f49bbacf000 CR3: 000000001eea6000 CR4: 00000000001506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 ovl_workdir_create+0x3a9/0x5b0 fs/overlayfs/super.c:790
 ovl_make_workdir fs/overlayfs/super.c:1364 [inline]
 ovl_get_workdir fs/overlayfs/super.c:1511 [inline]
 ovl_fill_super+0x199a/0x5fb0 fs/overlayfs/super.c:2067
 mount_nodev+0x60/0x110 fs/super.c:1414
 legacy_get_tree+0x105/0x220 fs/fs_context.c:610
 vfs_get_tree+0x89/0x2f0 fs/super.c:1498
 do_new_mount fs/namespace.c:2978 [inline]
 path_mount+0x132a/0x1fa0 fs/namespace.c:3308
 do_mount fs/namespace.c:3321 [inline]
 __do_sys_mount fs/namespace.c:3529 [inline]
 __se_sys_mount fs/namespace.c:3506 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3506
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x4458d9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe7eef6d2f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00000000004ca400 RCX: 00000000004458d9
RDX: 00000000200000c0 RSI: 0000000020000000 RDI: 000000000040000d
RBP: 000000000049a074 R08: 0000000020000100 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 0079616c7265766f R14: 003270756f726763 R15: 00000000004ca408


---
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.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

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

* Re: [syzbot] WARNING in ovl_create_real
  2021-08-31 10:36 [syzbot] WARNING in ovl_create_real syzbot
@ 2021-09-07 14:03 ` Miklos Szeredi
  2021-09-07 15:15   ` syzbot
  2021-09-08  8:05   ` Miklos Szeredi
  0 siblings, 2 replies; 5+ messages in thread
From: Miklos Szeredi @ 2021-09-07 14:03 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, overlayfs, syzkaller-bugs

[-- Attachment #1: Type: text/plain, Size: 82 bytes --]

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master

[-- Attachment #2: ovl-test.patch --]
[-- Type: text/x-patch, Size: 920 bytes --]

diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 1fefb2b8960e..0f6c10ec56c1 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -150,6 +150,9 @@ static int ovl_mkdir_real(struct inode *dir, struct dentry **newdentry,
 	if (likely(!d_unhashed(dentry)))
 		return 0;
 
+	pr_info("unhashed dentry after mkdir (%s)\n",
+		dentry->d_sb->s_type->name);
+
 	/*
 	 * vfs_mkdir() may succeed and leave the dentry passed
 	 * to it unhashed and negative. If that happens, try to
@@ -209,7 +212,10 @@ struct dentry *ovl_create_real(struct inode *dir, struct dentry *newdentry,
 			err = -EPERM;
 		}
 	}
-	if (!err && WARN_ON(!newdentry->d_inode)) {
+	if (!err && !newdentry->d_inode) {
+		pr_warn("negative dentry after mkdir (%s)\n",
+			newdentry->d_sb->s_type->name);
+		WARN_ON(1);
 		/*
 		 * Not quite sure if non-instantiated dentry is legal or not.
 		 * VFS doesn't seem to care so check and warn here.

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

* Re: [syzbot] WARNING in ovl_create_real
  2021-09-07 14:03 ` Miklos Szeredi
@ 2021-09-07 15:15   ` syzbot
  2021-09-08  8:05   ` Miklos Szeredi
  1 sibling, 0 replies; 5+ messages in thread
From: syzbot @ 2021-09-07 15:15 UTC (permalink / raw)
  To: linux-kernel, linux-unionfs, miklos, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in ovl_create_real

overlayfs: negative dentry after mkdir (cgroup2)
------------[ cut here ]------------
WARNING: CPU: 0 PID: 10918 at fs/overlayfs/dir.c:218 ovl_create_real.cold+0x80/0x1e3 fs/overlayfs/dir.c:216
Modules linked in:
CPU: 0 PID: 10918 Comm: syz-executor.0 Not tainted 5.14.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:ovl_create_real.cold+0x80/0x1e3 fs/overlayfs/dir.c:218
Code: 37 00 48 c1 e0 2a 48 89 da 48 c1 ea 03 80 3c 02 00 74 08 48 89 df e8 81 90 c3 f8 48 8b 33 48 c7 c7 20 0f c4 89 e8 90 73 f9 ff <0f> 0b 4c 89 e5 49 c7 c4 fb ff ff ff e9 5f c7 bb f9 e8 fc 4f 7c f8
RSP: 0018:ffffc9000cd47958 EFLAGS: 00010282
RAX: 0000000000000030 RBX: ffffffff8b9bea20 RCX: 0000000000000000
RDX: ffff8880131c3900 RSI: ffffffff815dcd38 RDI: fffff520019a8f1d
RBP: ffff88806ee38d38 R08: 0000000000000030 R09: 0000000000000000
R10: ffffffff815d6ade R11: 0000000000000000 R12: ffff88806ee38d38
R13: 0000000000004000 R14: ffff88806dd2ed90 R15: ffff88806dd2ee70
FS:  00007fb3f7195700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055e370d81a70 CR3: 000000002184a000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 ovl_workdir_create+0x3a9/0x5b0 fs/overlayfs/super.c:790
 ovl_make_workdir fs/overlayfs/super.c:1364 [inline]
 ovl_get_workdir fs/overlayfs/super.c:1511 [inline]
 ovl_fill_super+0x199a/0x5fb0 fs/overlayfs/super.c:2067
 mount_nodev+0x60/0x110 fs/super.c:1414
 legacy_get_tree+0x105/0x220 fs/fs_context.c:610
 vfs_get_tree+0x89/0x2f0 fs/super.c:1498
 do_new_mount fs/namespace.c:2988 [inline]
 path_mount+0x1320/0x1fa0 fs/namespace.c:3318
 do_mount fs/namespace.c:3331 [inline]
 __do_sys_mount fs/namespace.c:3539 [inline]
 __se_sys_mount fs/namespace.c:3516 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3516
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x4665e9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fb3f7195188 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9
RDX: 00000000200000c0 RSI: 0000000020000000 RDI: 000000000040000d
RBP: 00000000004bfcc4 R08: 0000000020000100 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80
R13: 00007ffd2744f94f R14: 00007fb3f7195300 R15: 0000000000022000


Tested on:

commit:         4b93c544 thunderbolt: test: split up test cases in tb_..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13249aed300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=6f8c28906b7bb02d
dashboard link: https://syzkaller.appspot.com/bug?extid=75eab84fd0af9e8bf66b
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
patch:          https://syzkaller.appspot.com/x/patch.diff?x=10fc0943300000


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

* Re: [syzbot] WARNING in ovl_create_real
  2021-09-07 14:03 ` Miklos Szeredi
  2021-09-07 15:15   ` syzbot
@ 2021-09-08  8:05   ` Miklos Szeredi
  2021-09-08  8:26     ` syzbot
  1 sibling, 1 reply; 5+ messages in thread
From: Miklos Szeredi @ 2021-09-08  8:05 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, overlayfs, syzkaller-bugs

[-- Attachment #1: Type: text/plain, Size: 82 bytes --]

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master

[-- Attachment #2: ovl-fix-warning-in-ovl_create_real.patch --]
[-- Type: text/x-patch, Size: 1683 bytes --]

diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 1fefb2b8960e..2f4125399896 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -137,8 +137,7 @@ int ovl_cleanup_and_whiteout(struct ovl_fs *ofs, struct inode *dir,
 	goto out;
 }
 
-static int ovl_mkdir_real(struct inode *dir, struct dentry **newdentry,
-			  umode_t mode)
+int ovl_mkdir_real(struct inode *dir, struct dentry **newdentry, umode_t mode)
 {
 	int err;
 	struct dentry *d, *dentry = *newdentry;
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 3894f3347955..2cd5741c873b 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -570,6 +570,7 @@ struct ovl_cattr {
 
 #define OVL_CATTR(m) (&(struct ovl_cattr) { .mode = (m) })
 
+int ovl_mkdir_real(struct inode *dir, struct dentry **newdentry, umode_t mode);
 struct dentry *ovl_create_real(struct inode *dir, struct dentry *newdentry,
 			       struct ovl_cattr *attr);
 int ovl_cleanup(struct inode *dir, struct dentry *dentry);
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 178daa5e82c9..265181c110ae 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -787,10 +787,14 @@ static struct dentry *ovl_workdir_create(struct ovl_fs *ofs,
 			goto retry;
 		}
 
-		work = ovl_create_real(dir, work, OVL_CATTR(attr.ia_mode));
-		err = PTR_ERR(work);
-		if (IS_ERR(work))
-			goto out_err;
+		err = ovl_mkdir_real(dir, &work, attr.ia_mode);
+		if (err)
+			goto out_dput;
+
+		/* Weird filesystem returning with hashed negative (kernfs)? */
+		err = -EINVAL;
+		if (d_really_is_negative(work))
+			goto out_dput;
 
 		/*
 		 * Try to remove POSIX ACL xattrs from workdir.  We are good if:

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

* Re: [syzbot] WARNING in ovl_create_real
  2021-09-08  8:05   ` Miklos Szeredi
@ 2021-09-08  8:26     ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2021-09-08  8:26 UTC (permalink / raw)
  To: linux-kernel, linux-unionfs, miklos, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+75eab84fd0af9e8bf66b@syzkaller.appspotmail.com

Tested on:

commit:         ac08b1c6 Merge tag 'pci-v5.15-changes' of git://git.ke..
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=3ec7a3d00a9dd6f1
dashboard link: https://syzkaller.appspot.com/bug?extid=75eab84fd0af9e8bf66b
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
patch:          https://syzkaller.appspot.com/x/patch.diff?x=10a55a43300000

Note: testing is done by a robot and is best-effort only.

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

end of thread, other threads:[~2021-09-08  8:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31 10:36 [syzbot] WARNING in ovl_create_real syzbot
2021-09-07 14:03 ` Miklos Szeredi
2021-09-07 15:15   ` syzbot
2021-09-08  8:05   ` Miklos Szeredi
2021-09-08  8:26     ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).