LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[PATCH v3 01/11] stackleak: don't modify ctl_table argument

To: Luis Chamberlain <mcgrof@xxxxxxxxxx>, Joel Granados <j.granados@xxxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>
Subject: [PATCH v3 01/11] stackleak: don't modify ctl_table argument
Cc: Eric Dumazet <edumazet@xxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-riscv@xxxxxxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, linux-security-module@xxxxxxxxxxxxxxx, bpf@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-xfs@xxxxxxxxxxxxxxx, linux-trace-kernel@xxxxxxxxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx, coreteam@xxxxxxxxxxxxx, kexec@xxxxxxxxxxxxxxxxxxx, linux-hardening@xxxxxxxxxxxxxxx, bridge@xxxxxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx, linux-rdma@xxxxxxxxxxxxxxx, rds-devel@xxxxxxxxxxxxxx, linux-sctp@xxxxxxxxxxxxxxx, linux-nfs@xxxxxxxxxxxxxxx, apparmor@xxxxxxxxxxxxxxxx, Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
From: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
Date: Tue, 23 Apr 2024 09:54:36 +0200
In a future commit the proc_handlers will change to
"const struct ctl_table".
As a preparation for that adapt the logic to work with a temporary
variable, similar to how it is done in other parts of the kernel.

Fixes: 964c9dff0091 ("stackleak: Allow runtime disabling of kernel stack 
erasing")
Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>
Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
 kernel/stackleak.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/stackleak.c b/kernel/stackleak.c
index d099f3affcf1..558b9d6d28d3 100644
--- a/kernel/stackleak.c
+++ b/kernel/stackleak.c
@@ -27,10 +27,11 @@ static int stack_erasing_sysctl(struct ctl_table *table, 
int write,
        int ret = 0;
        int state = !static_branch_unlikely(&stack_erasing_bypass);
        int prev_state = state;
+       struct ctl_table tmp = *table;
 
-       table->data = &state;
-       table->maxlen = sizeof(int);
-       ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
+       tmp.data = &state;
+       tmp.maxlen = sizeof(int);
+       ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
        state = !!state;
        if (ret || !write || state == prev_state)
                return ret;

-- 
2.44.0



<Prev in Thread] Current Thread [Next in Thread>