The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 00/10] sysfs: constify struct bin_attribute (Part 1)
Date: Fri, 1 Nov 2024 02:20:41 +0100	[thread overview]
Message-ID: <2024110100-thieving-numerate-e268@gregkh> (raw)
In-Reply-To: <20241031-sysfs-const-bin_attr-v1-0-2281afa7f055@weissschuh.net>

On Thu, Oct 31, 2024 at 02:43:49AM +0000, Thomas Weißschuh wrote:
> struct bin_attribute contains a bunch of pointer members, which when
> overwritten by accident or malice can lead to system instability and
> security problems.
> Moving the definitions of struct bin_attribute to read-only memory
> makes these modifications impossible.
> The same change has been performed for many other structures in the
> past. (struct class, struct ctl_table...)
> 
> For the structure definitions throughout the core to be moved to
> read-only memory the following steps are necessary.
> 
> 1) Change all callbacks invoked from the sysfs core to only pass const
>    pointers
> 2) Adapt the sysfs core to only work in terms of const pointers
> 3) Adapt the sysfs core APIs to allow const pointers
> 4) Change all structure definitions through the core to const
> 
> This series provides the foundation for step 1) above.
> It converts some callbacks in a single step to const and provides a
> foundation for those callbacks where a single step is not possible.
> 
> This series is marked as RFC and only sent to the sysfs maintainers to
> get some feedback on the general aproach.
> The same techniques employed by this series can later be reused for the
> same change for 'struct attribute'.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

At a quick glance, this is great!  I'll review it "better" next week
when my travel calms down, so if you want to resend this as a non-rfc
patch, and it looks sane, I'll be glad to queue it up.

thanks!

greg k-h

      parent reply	other threads:[~2024-11-01  1:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31  2:43 [PATCH RFC 00/10] sysfs: constify struct bin_attribute (Part 1) Thomas Weißschuh
2024-10-31  2:43 ` [PATCH RFC 01/10] sysfs: explicitly pass size to sysfs_add_bin_file_mode_ns() Thomas Weißschuh
2024-10-31  2:43 ` [PATCH RFC 02/10] sysfs: introduce callback attribute_group::bin_size Thomas Weißschuh
2024-10-31  2:43 ` [PATCH RFC 03/10] PCI/sysfs: Calculate bin_attribute size through bin_size() Thomas Weißschuh
2024-10-31  2:43 ` [PATCH RFC 04/10] nvmem: core: calculate " Thomas Weißschuh
2024-10-31  2:43 ` [PATCH RFC 05/10] sysfs: treewide: constify attribute callback of bin_is_visible() Thomas Weißschuh
2024-10-31  2:43 ` [PATCH RFC 06/10] sysfs: treewide: constify attribute callback of bin_attribute::mmap() Thomas Weißschuh
2024-10-31  2:43 ` [PATCH RFC 07/10] sysfs: drop callback bin_attribute::llseek Thomas Weißschuh
2024-10-31  2:43 ` [PATCH RFC 08/10] sysfs: implement all BIN_ATTR_* macros in terms of __BIN_ATTR() Thomas Weißschuh
2024-10-31  2:43 ` [PATCH RFC 09/10] sysfs: bin_attribute: add const read/write callback variants Thomas Weißschuh
2024-10-31  2:43 ` [PATCH RFC 10/10] driver core: Constify attribute arguments of binary attributes Thomas Weißschuh
2024-11-01  1:20 ` Greg Kroah-Hartman [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=2024110100-thieving-numerate-e268@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=rafael@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