From: Ian Kent <raven@themaw.net>
To: Krystian Kaniewski <krystianmkaniewski@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Tejun Heo <tj@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Cc: Danilo Krummrich <dakr@kernel.org>,
Johan Hovold <johan@kernel.org>, Len Brown <lenb@kernel.org>,
Pavel Machek <pavel@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
driver-core@lists.linux.dev, linux-pm@vger.kernel.org,
autofs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
syzbot+002fb7b2d0bc53bf7e75@syzkaller.appspotmail.com
Subject: Re: [PATCH v4 0/2] kernfs, sysfs: refuse splice on /sys/power/resume
Date: Mon, 23 Nov 2026 08:01:11 +0800 [thread overview]
Message-ID: <1f7bba7d478286814d5c5f00c3c14711698e95e4.camel@themaw.net> (raw)
In-Reply-To: <20261116133903.400202-1-krystianmkaniewski@gmail.com>
On Mon, 2026-11-16 at 14:39 +0100, Krystian Kaniewski wrote:
> This series refuses splice on /sys/power/resume and gives writable
> opens of that file separate lockdep classes, as Tejun suggested in
> the
> v1 discussion.
>
> The reported cycle is assembled from two operations. Splice into an
> ordinary writable kernfs file records pipe->mutex before of->mutex. A
> normal write to /sys/power/resume records of->mutex before the autofs
> pipe locks when resume_store() resolves a relative path.
>
> Patch 1 adds SYSFS_NO_SPLICE and kernfs_ops->no_splice. Every open of
> a
> marked file refuses splice. Only writable opens use separate of-
> >mutex
> and seq_file lock classes, because only they can reach the store
> callback which creates the reverse dependency.
>
> Patch 2 marks /sys/power/resume. Normal reads and writes stay
> unchanged,
> including a write which resolves a relative path through autofs.
> Rafael
> acked it to go together with patch 1.
>
> Other stores also look up paths. They remain outside this minimal
> series
> and can be marked in follow-up patches.
>
> Tested on v7.4-rc1 with fresh builds of the exact base and the
> patched
> tree. The original C and syz reproducers report the lockdep cycle on
> the
> base and run without a lockdep report with the series. Splice and
> sendfile from an O_RDONLY open of /sys/power/resume return EINVAL
> with
> the series, while read() still works. All 33 QEMU cases booted and
> completed in both phases. The builds, W=1 checks and Coccinelle
> checks
> introduced no warning or report.
Just to complete the cycle (although a bit late) I appreciate the
effort to come up with a way to resolve this without adversely
affecting autofs.
And while my knowledge of some of the areas these patches touch
is not so good they look sound, as does the description, and it
tries hard to clarify the case at hand.
So to the that extent:
Acked-by: Ian Kent <raven@themaw.net>
Thanks
Ian
>
> v4:
> - Refuse splice for all opens of marked files (Tejun).
> - Keep separate lockdep classes limited to writable opens.
> - Add no-splice operations for read-only regular sysfs attributes.
> - Keep Rafael's Acked-by on patch 2, whose code is unchanged.
>
> v3:
> - Rename SYSFS_LOOKUP and ->may_lookup to SYSFS_NO_SPLICE and
> ->no_splice (Tejun).
> - Drop the mmap, prealloc and binary attribute checks (Tejun).
> - Add Rafael's Acked-by to patch 2.
>
> v2:
> - Replace the v1 locking changes with per-attribute splice control.
> - Preserve splice on read-only opens.
> - Split both the open-file mutex and seq_file lock classes.
> - Reject incompatible mmap and preallocated-buffer combinations.
> - Reject SYSFS_LOOKUP on binary attributes.
> - Rebase onto v7.4-rc1.
>
> v3:
> https://lore.kernel.org/r/cover.1794479968.git.krystianmkaniewski@gmail.com
> v2:
> https://lore.kernel.org/r/cover.1793715774.git.krystianmkaniewski@gmail.com
> v1:
> https://lore.kernel.org/r/cover.1792577179.git.krystianmkaniewski@gmail.com
>
> Krystian Kaniewski (2):
> kernfs, sysfs: add SYSFS_NO_SPLICE to refuse splice
> PM: hibernate: refuse splice on /sys/power/resume
>
> fs/kernfs/file.c | 51 ++++++++++++++++++++++++++++++++++++--
> --
> fs/sysfs/file.c | 23 ++++++++++++++++++
> fs/sysfs/group.c | 4 ++--
> include/linux/kernfs.h | 9 +++++++
> include/linux/sysfs.h | 22 ++++++++++++-----
> kernel/power/hibernate.c | 3 ++-
> 6 files changed, 99 insertions(+), 13 deletions(-)
>
>
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
prev parent reply other threads:[~2026-11-23 0:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 13:39 Krystian Kaniewski
2026-11-16 13:39 ` [PATCH v4 1/2] kernfs, sysfs: add SYSFS_NO_SPLICE to refuse splice Krystian Kaniewski
2026-11-16 13:39 ` [PATCH v4 2/2] PM: hibernate: refuse splice on /sys/power/resume Krystian Kaniewski
2026-11-16 20:43 ` [PATCH v4 0/2] kernfs, sysfs: " Tejun Heo
2026-11-18 13:27 ` Christian Brauner
2026-11-23 0:01 ` Ian Kent [this message]
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=1f7bba7d478286814d5c5f00c3c14711698e95e4.camel@themaw.net \
--to=raven@themaw.net \
--cc=autofs@vger.kernel.org \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=johan@kernel.org \
--cc=krystianmkaniewski@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=syzbot+002fb7b2d0bc53bf7e75@syzkaller.appspotmail.com \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®