mbox series

[0/4] firmware: google: Constify 'struct bin_attribute'

Message ID 20241215-sysfs-const-bin_attr-google-v1-0-e5c2808f5833@weissschuh.net (mailing list archive)
Headers show
Series firmware: google: Constify 'struct bin_attribute' | expand

Message

Thomas Weißschuh Dec. 15, 2024, 2:49 p.m. UTC
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.

Please also note the remark at the end of the vpd patch.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (4):
      firmware: google: cbmem: Constify 'struct bin_attribute'
      firmware: google: gsmi: Constify 'struct bin_attribute'
      firmware: google: memconsole: Use const 'struct bin_attribute' callback
      firmware: google: vpd: Use const 'struct bin_attribute' callback

 drivers/firmware/google/cbmem.c      | 10 +++++-----
 drivers/firmware/google/gsmi.c       |  6 +++---
 drivers/firmware/google/memconsole.c |  4 ++--
 drivers/firmware/google/vpd.c        |  8 ++++----
 4 files changed, 14 insertions(+), 14 deletions(-)
---
base-commit: 2d8308bf5b67dff50262d8a9260a50113b3628c6
change-id: 20241215-sysfs-const-bin_attr-google-2af43b3f793e

Best regards,

Comments

Brian Norris Dec. 16, 2024, 10:09 p.m. UTC | #1
On Sun, Dec 15, 2024 at 03:49:08PM +0100, Thomas Weißschuh wrote:
> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.

I'm not in love with all these "_new" transformations that need a second
round of cleanup, but I'm not aware of any better way to do it.

For the series:

Acked-by: Brian Norris <briannorris@chromium.org>

> Please also note the remark at the end of the vpd patch.

I don't have much opinion on the options there. It seems like it's the
difference between an extra cleanup patch or two if we go with the
current series, vs. extra work for you with possible conflicts if we go
with your alternative.

Brian
Tzung-Bi Shih Dec. 17, 2024, 4:06 a.m. UTC | #2
On Sun, Dec 15, 2024 at 03:49:08PM +0100, Thomas Weißschuh wrote:
> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.
> 
> Please also note the remark at the end of the vpd patch.
>
> [...]

Applied to

    https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-firmware-next

[1/4] firmware: google: cbmem: Constify 'struct bin_attribute'
      commit: bf2066caee80c1612cb5a3356dc16a7a298f58ab
[2/4] firmware: google: gsmi: Constify 'struct bin_attribute'
      commit: 7da14dea76fb6a90f62938e6dfa9f34c980af358
[3/4] firmware: google: memconsole: Use const 'struct bin_attribute' callback
      commit: 093d752032f723da665cdaa6077ee62b3931e48b
[4/4] firmware: google: vpd: Use const 'struct bin_attribute' callback
      commit: 7543d5702c2cfe0e8e8bc8bf4fe8cd44f08d6d39

Thanks!
Thomas Weißschuh Dec. 17, 2024, 6:58 p.m. UTC | #3
On 2024-12-16 14:09:04-0800, Brian Norris wrote:
> On Sun, Dec 15, 2024 at 03:49:08PM +0100, Thomas Weißschuh wrote:
> > The sysfs core now allows instances of 'struct bin_attribute' to be
> > moved into read-only memory. Make use of that to protect them against
> > accidental or malicious modifications.
> 
> I'm not in love with all these "_new" transformations that need a second
> round of cleanup, but I'm not aware of any better way to do it.

Absolutely agree. My hope is to get the post-transition cleanup directly
through Linus or Greg in one big commit. At that point the changes are
purely mechanical and trivial.
So I don't have to annoy everyone even more...

> For the series:
> 
> Acked-by: Brian Norris <briannorris@chromium.org>

Thanks.

[..]