lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 23 Aug 2023 16:37:49 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Valentine Sinitsyn <valesini@...dex-team.ru>
Cc:     Tejun Heo <tj@...nel.org>, Daniel Vetter <daniel.vetter@...ll.ch>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Dan Williams <dan.j.williams@...el.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 1/2] kernfs: sysfs: support custom llseek method for
 sysfs entries

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@...r.kernel.org
> Signed-off-by: Valentine Sinitsyn <valesini@...dex-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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ