From: Roberto Sassu <roberto.sassu@huaweicloud.com>
To: syzbot <syzbot+8fb64a61fdd96b50f3b8@syzkaller.appspotmail.com>,
hdanton@sina.com, jack@suse.cz, jeffm@suse.com,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
mingo@redhat.com, paul@paul-moore.com, peterz@infradead.org,
reiserfs-devel@vger.kernel.org, roberto.sassu@huawei.com,
syzkaller-bugs@googlegroups.com, will@kernel.org
Subject: Re: [syzbot] [reiserfs?] possible deadlock in open_xa_dir
Date: Fri, 02 Jun 2023 18:18:07 +0200 [thread overview]
Message-ID: <4aa799a0b87d4e2ecf3fa74079402074dc42b3c5.camel@huaweicloud.com> (raw)
In-Reply-To: <0000000000009d322605fd22054a@google.com>
[-- Attachment #1: Type: text/plain, Size: 932 bytes --]
On Fri, 2023-06-02 at 02:17 -0700, syzbot wrote:
> Hello,
>
> syzbot has tested the proposed patch and the reproducer did not trigger any issue:
>
> Reported-and-tested-by: syzbot+8fb64a61fdd96b50f3b8@syzkaller.appspotmail.com
>
> Tested on:
>
> commit: 4432b507 lsm: fix a number of misspellings
> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git next
> console output: https://syzkaller.appspot.com/x/log.txt?x=166c541d280000
> kernel config: https://syzkaller.appspot.com/x/.config?x=38526bf24c8d961b
> dashboard link: https://syzkaller.appspot.com/bug?extid=8fb64a61fdd96b50f3b8
> compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
> patch: https://syzkaller.appspot.com/x/patch.diff?x=1095cd79280000
>
> Note: testing is done by a robot and is best-effort only.
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git next
[-- Attachment #2: 0001-reiserfs-Disable-by-default-security-xattr-init-sinc.patch --]
[-- Type: text/x-patch, Size: 2884 bytes --]
From 73bb02eb7a751c447af43d7cac7c191329b6dd55 Mon Sep 17 00:00:00 2001
From: Roberto Sassu <roberto.sassu@huawei.com>
Date: Fri, 2 Jun 2023 10:10:28 +0200
Subject: [PATCH] reiserfs: Disable by default security xattr init since it
never worked
Commit d82dcd9e21b7 ("reiserfs: Add security prefix to xattr name in
reiserfs_security_write()"), while fixed the security xattr initialization,
it also revealed a circular locking dependency between the reiserfs write
lock and the inode lock.
Add the new config option CONFIG_REISERFS_FS_SECURITY_INIT to
enable/disable the feature. Also, since the bug in security xattr
initialization was introduced since the beginning, disable it by default.
Reported-and-tested-by: syzbot+8fb64a61fdd96b50f3b8@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8fb64a61fdd96b50f3b8
Suggested-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
fs/reiserfs/Kconfig | 15 +++++++++++++++
fs/reiserfs/super.c | 3 +++
fs/reiserfs/xattr_security.c | 3 +++
3 files changed, 21 insertions(+)
diff --git a/fs/reiserfs/Kconfig b/fs/reiserfs/Kconfig
index 4d22ecfe0fa..a618d0bda7b 100644
--- a/fs/reiserfs/Kconfig
+++ b/fs/reiserfs/Kconfig
@@ -88,3 +88,18 @@ config REISERFS_FS_SECURITY
If you are not using a security module that requires using
extended attributes for file security labels, say N.
+
+config REISERFS_FS_SECURITY_INIT
+ bool "ReiserFS Security Labels initialization"
+ depends on REISERFS_FS_XATTR
+ default false
+ help
+ Init new inodes with security labels provided by LSMs.
+
+ It was broken from the beginning, since the xattr name was
+ missing the 'security.' prefix.
+
+ Enabling this option might cause lockdep warnings and
+ ultimately deadlocks.
+
+ If unsure, say N.
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 929acce6e73..b427d03d0ea 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1654,6 +1654,9 @@ static int read_super_block(struct super_block *s, int offset)
reiserfs_warning(NULL, "", "reiserfs filesystem is deprecated and "
"scheduled to be removed from the kernel in 2025");
+ if (IS_ENABLED(CONFIG_REISERFS_FS_SECURITY_INIT))
+ reiserfs_warning(NULL, "", "initializing security xattrs can cause deadlocks");
+
SB_BUFFER_WITH_SB(s) = bh;
SB_DISK_SUPER_BLOCK(s) = rs;
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c
index 078dd8cc312..d82c4507803 100644
--- a/fs/reiserfs/xattr_security.c
+++ b/fs/reiserfs/xattr_security.c
@@ -69,6 +69,9 @@ int reiserfs_security_init(struct inode *dir, struct inode *inode,
sec->value = NULL;
sec->length = 0;
+ if (!IS_ENABLED(CONFIG_REISERFS_FS_SECURITY_INIT))
+ return 0;
+
/* Don't add selinux attributes on xattrs - they'll never get used */
if (IS_PRIVATE(dir))
return 0;
--
2.25.1
next prev parent reply other threads:[~2023-06-02 16:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-31 6:35 [syzbot] [reiserfs?] possible deadlock in open_xa_dir syzbot
2023-05-05 7:10 ` syzbot
2023-05-05 20:51 ` syzbot
2023-05-05 21:36 ` Paul Moore
2023-05-31 9:49 ` Roberto Sassu
2023-05-31 9:52 ` Roberto Sassu
2023-06-01 21:22 ` Jeff Mahoney
2023-06-02 7:20 ` Roberto Sassu
2023-06-02 8:56 ` Roberto Sassu
2023-06-02 9:17 ` syzbot
2023-06-02 16:18 ` Roberto Sassu [this message]
2023-06-02 16:39 ` syzbot
2023-06-02 16:46 ` Roberto Sassu
2023-06-01 20:19 ` Roberto Sassu
2023-06-01 20:38 ` syzbot
2023-06-01 20:30 ` Roberto Sassu
2023-06-01 20:57 ` syzbot
2024-03-09 22:20 ` syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4aa799a0b87d4e2ecf3fa74079402074dc42b3c5.camel@huaweicloud.com \
--to=roberto.sassu@huaweicloud.com \
--cc=hdanton@sina.com \
--cc=jack@suse.cz \
--cc=jeffm@suse.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paul@paul-moore.com \
--cc=peterz@infradead.org \
--cc=reiserfs-devel@vger.kernel.org \
--cc=roberto.sassu@huawei.com \
--cc=syzbot+8fb64a61fdd96b50f3b8@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).