OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
Subject: [Devel] [PATCH vz10 29/32] ms/pcmcia: cistpl: Constify 'struct bin_attribute'
Date: Fri, 21 Aug 2026 18:37:15 +0200	[thread overview]
Message-ID: <20260821163718.187766-30-khorenko@virtuozzo.com> (raw)
In-Reply-To: <20260821163718.187766-1-khorenko@virtuozzo.com>

From: Thomas Wei?schuh <linux@weissschuh.net>

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.

Signed-off-by: Thomas Wei?schuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241215-sysfs-const-bin_attr-pcmcia-v1-1-ebb82e47d834@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 05a9896fa9e15466456a1b1dc9d2eacdf3551b79)

Needed here because the RHEL10.2 base carries the sysfs side of the
conversion but not the pcmcia one, so the initializer of pccard_cis_attr
does not compile at all:

  drivers/pcmcia/cistpl.c:1608:17: error: initialization of
    'ssize_t (*)(struct file *, struct kobject *,
                 const struct bin_attribute *, char *, loff_t, size_t)'
    from incompatible pointer type [-Wincompatible-pointer-types]

Our shipped configs have CONFIG_PCCARD=n so it goes unnoticed there,
while plain x86_64 defconfig - which we now want to keep building for
KUnit - enables it.  Applies as is: this tree's struct bin_attribute has
both the ::read/::write and the ::read_new/::write_new members, and
sysfs_kf_bin_read() prefers the latter.

https://virtuozzo.atlassian.net/browse/VSTOR-134732
Feature: fix ms/pcmcia
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 drivers/pcmcia/cistpl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index d018f36f3a89..0c801e4ccc6c 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -1540,7 +1540,7 @@ static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf,
 
 
 static ssize_t pccard_show_cis(struct file *filp, struct kobject *kobj,
-			       struct bin_attribute *bin_attr,
+			       const struct bin_attribute *bin_attr,
 			       char *buf, loff_t off, size_t count)
 {
 	unsigned int size = 0x200;
@@ -1571,7 +1571,7 @@ static ssize_t pccard_show_cis(struct file *filp, struct kobject *kobj,
 
 
 static ssize_t pccard_store_cis(struct file *filp, struct kobject *kobj,
-				struct bin_attribute *bin_attr,
+				const struct bin_attribute *bin_attr,
 				char *buf, loff_t off, size_t count)
 {
 	struct pcmcia_socket *s;
@@ -1605,6 +1605,6 @@ static ssize_t pccard_store_cis(struct file *filp, struct kobject *kobj,
 const struct bin_attribute pccard_cis_attr = {
 	.attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR },
 	.size = 0x200,
-	.read = pccard_show_cis,
-	.write = pccard_store_cis,
+	.read_new = pccard_show_cis,
+	.write_new = pccard_store_cis,
 };
-- 
2.47.1


  parent reply	other threads:[~2026-08-21 16:37 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 01/32] sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 02/32] sched/core: guard cpu_cgrp_subsys.depends_on with CONFIG_CGROUP_CPUACCT Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 03/32] sched: move MAX_CPU_RATE out of CONFIG_CFS_CPULIMIT Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 04/32] sched/cpuacct: guard ve_root_tg() with CONFIG_CFS_CPULIMIT Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 05/32] ve: source Kconfig.openvz from arch/um/Kconfig Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 06/32] ve: select CGROUP_PERF only if PERF_EVENTS Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 07/32] ve: add missing Kconfig selects for CONFIG_VE Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 08/32] mm/oom: build the berserker mode only with CONFIG_MEMCG Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 09/32] proc: build the per-Container oom_score limit lookup " Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 10/32] mm, proc: build the /proc/meminfo virtualization only with CONFIG_VE Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 11/32] mm/vmstat: build the /proc/vmstat " Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 12/32] mm/shmem: build the tmpfs size " Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 13/32] mm/memcg: keep mem_cgroup_per_node::nid available with CONFIG_MEMCG_V1=n Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 14/32] mm/memcontrol: build memory.numa_migrate only with CONFIG_NUMA Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 15/32] ms/percpu: introduce PERCPU_PTR() macro Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 16/32] ms/percpu: cast percpu pointer in PERCPU_PTR() via unsigned long Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 17/32] mm/memcontrol: add missing inline to the mem_cgroup_fill_meminfo() stub Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 18/32] block: guard the cbt_list initialization with CONFIG_BLK_DEV_CBT Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 19/32] ve: include asm/vdso.h on x86 only Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 20/32] ve: compile the per-Container VDSO copies only on x86 Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 21/32] ve: compile the CPUID override propagation " Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 22/32] ve: mark ve0.css with CSS_NO_REF Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:50   ` [Devel] [PATCH vz10 22/32] " Konstantin Khorenko
2026-08-24  8:50     ` Pavel Tikhomirov
2026-08-21 16:37 ` [Devel] [PATCH vz10 23/32] mm/memory: build the page fault latency accounting for x86 only Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 24/32] sched/core: include cgroup-internal.h only where it is used Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 25/32] kernfs: build the KERNFS_GET_NS ioctl only with CONFIG_NET Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 26/32] fs/fs_context: build the mount option formatting only with CONFIG_VE Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 27/32] net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 28/32] redhat: rh_flags: make the !CONFIG_RHEL_DIFFERENCES stubs inline Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` Konstantin Khorenko [this message]
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] ms/pcmcia: cistpl: Constify 'struct bin_attribute' Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 30/32] redhat: rh_waived: add a stub for CONFIG_RHEL_DIFFERENCES=n Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 31/32] ext4: select LIBCRC32C Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 32/32] kunit: add the script dir to sys.path for PYTHONSAFEPATH compatibility Konstantin Khorenko
2026-08-21 16:42   ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko

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=20260821163718.187766-30-khorenko@virtuozzo.com \
    --to=khorenko@virtuozzo.com \
    /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