From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Valentine Sinitsyn <valesini@yandex-team.ru>
Cc: Tejun Heo <tj@kernel.org>, Daniel Vetter <daniel.vetter@ffwll.ch>,
Bjorn Helgaas <bhelgaas@google.com>,
Dan Williams <dan.j.williams@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 1/2] kernfs: sysfs: support custom llseek method for sysfs entries
Date: Wed, 23 Aug 2023 16:37:49 +0200 [thread overview]
Message-ID: <2023082313-activator-faceless-422a@gregkh> (raw)
In-Reply-To: <20230823125834.492298-1-valesini@yandex-team.ru>
On Wed, Aug 23, 2023 at 05:58:33PM +0500, Valentine Sinitsyn wrote:
> As of now, seeking in sysfs files is handled by generic_file_llseek().
> There are situations where one may want to customize seeking logic:
>
> - Many sysfs entries are fixed files while generic_file_llseek() accepts
> past-the-end positions. Not only being useless by itself, this
> also means a bug in userspace code will trigger not at lseek(), but at
> some later point making debugging harder.
> - generic_file_llseek() relies on f_mapping->host to get the file size
> which might not be correct for all sysfs entries.
> See commit 636b21b50152 ("PCI: Revoke mappings like devmem") as an example.
>
> Implement llseek method to override this behavior at sysfs attribute
> level. The method is optional, and if it is absent,
> generic_file_llseek() is called to preserve backwards compatibility.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Valentine Sinitsyn <valesini@yandex-team.ru>
> ---
> v5:
> - Fix builds without PCI mmap support (e.g. Alpha)
> v4:
> - Fix builds which #define HAVE_PCI_LEGACY (e.g. PowerPC)
> v3:
> - Grammar fixes
> - Add base-patch: and prerequisite-patch-id: to make kernel test
> robot happy
> v2:
> - Add infrastructure to customize llseek per sysfs entry type
> - Override llseek for PCI sysfs entries with fixed_file_llseek()
> fs/kernfs/file.c | 14 +++++++++++++-
> fs/sysfs/file.c | 13 +++++++++++++
> include/linux/kernfs.h | 1 +
> include/linux/sysfs.h | 2 ++
> 4 files changed, 29 insertions(+), 1 deletion(-)
>
Due to the high rate of errors and respins of this, I'm going to wait
until after 5.7-rc1 is out before adding it to my tree so that things
can calm down a bit...
thanks,
greg k-h
next prev parent reply other threads:[~2023-08-23 14:38 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 19:08 [PATCH] kernfs: implement custom llseek method to fix userspace regression Valentine Sinitsyn
2023-08-14 20:01 ` Dan Williams
2023-08-15 8:25 ` Valentin Sinitsyn
2023-08-15 15:48 ` Dan Williams
2023-08-17 18:53 ` Valentin Sinitsyn
2023-08-21 7:29 ` [RESEND PATCH v2 1/2] kernfs: sysfs: support custom llseek method for sysfs entries Valentine Sinitsyn
2023-08-21 7:29 ` [RESEND PATCH v2 2/2] PCI: implement custom llseek method for PCI resource entries in sysfs Valentine Sinitsyn
2023-08-21 19:55 ` Bjorn Helgaas
2023-08-22 7:51 ` [PATCH v3 1/2] kernfs: sysfs: support custom llseek method for sysfs entries Valentine Sinitsyn
2023-08-22 7:51 ` [PATCH v3 2/2] PCI: Implement custom llseek for sysfs resource entries Valentine Sinitsyn
2023-08-22 11:54 ` [PATCH v4 1/2] kernfs: sysfs: support custom llseek method for sysfs entries Valentine Sinitsyn
2023-08-22 11:54 ` [PATCH v4 2/2] PCI: Implement custom llseek for sysfs resource entries Valentine Sinitsyn
2023-08-22 17:43 ` kernel test robot
2023-08-23 12:58 ` [PATCH v5 1/2] kernfs: sysfs: support custom llseek method for sysfs entries Valentine Sinitsyn
2023-08-23 14:37 ` Greg Kroah-Hartman [this message]
2023-08-23 14:39 ` Greg Kroah-Hartman
2023-08-23 20:11 ` Valentin Sinitsyn
2023-08-23 12:58 ` [PATCH v5 2/2] PCI: Implement custom llseek for sysfs resource entries Valentine Sinitsyn
2023-08-25 14:10 ` kernel test robot
2023-08-28 7:22 ` Valentin Sinitsyn
2023-08-29 20:02 ` Bjorn Helgaas
2023-08-29 20:26 ` Bjorn Helgaas
2023-09-02 15:50 ` [PATCH v6 1/2] kernfs: sysfs: support custom llseek method for sysfs entries Valentine Sinitsyn
2023-09-05 7:02 ` kernel test robot
2023-09-08 13:49 ` [PATCH v7 " Valentine Sinitsyn
2023-09-08 13:49 ` [PATCH v7 2/2] PCI: Implement custom llseek for sysfs resource entries Valentine Sinitsyn
2023-09-08 13:56 ` [PATCH v8 1/2] kernfs: sysfs: support custom llseek method for sysfs entries Valentine Sinitsyn
2023-09-08 13:56 ` [PATCH v8 2/2] PCI: Implement custom llseek for sysfs resource entries Valentine Sinitsyn
2023-09-02 15:50 ` [PATCH v6 " Valentine Sinitsyn
2023-08-21 23:15 ` [RESEND PATCH v2 2/2] PCI: implement custom llseek method for PCI resource entries in sysfs kernel test robot
2023-08-22 8:09 ` Valentin Sinitsyn
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=2023082313-activator-faceless-422a@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=valesini@yandex-team.ru \
/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