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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240315-sysctl-const-handler-v1-0-1322ac7cb03d@weissschuh.net>
Date: Fri, 15 Mar 2024 21:47:58 +0100
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
 Kees Cook <keescook@...omium.org>, Alexei Starovoitov <ast@...nel.org>, 
 Daniel Borkmann <daniel@...earbox.net>, 
 John Fastabend <john.fastabend@...il.com>, 
 Andrii Nakryiko <andrii@...nel.org>, 
 Martin KaFai Lau <martin.lau@...ux.dev>, 
 Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>, 
 Yonghong Song <yonghong.song@...ux.dev>, KP Singh <kpsingh@...nel.org>, 
 Stanislav Fomichev <sdf@...gle.com>, Hao Luo <haoluo@...gle.com>, 
 Jiri Olsa <jolsa@...nel.org>, Muchun Song <muchun.song@...ux.dev>, 
 Andrew Morton <akpm@...ux-foundation.org>, 
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
 David Ahern <dsahern@...nel.org>, Simon Horman <horms@...ge.net.au>, 
 Julian Anastasov <ja@....bg>, Pablo Neira Ayuso <pablo@...filter.org>, 
 Jozsef Kadlecsik <kadlec@...filter.org>, Florian Westphal <fw@...len.de>, 
 Luis Chamberlain <mcgrof@...nel.org>, 
 Joel Granados <j.granados@...sung.com>, 
 Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>, 
 Heiko Carstens <hca@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>, 
 Alexander Gordeev <agordeev@...ux.ibm.com>, 
 Christian Borntraeger <borntraeger@...ux.ibm.com>, 
 Sven Schnelle <svens@...ux.ibm.com>, 
 Gerald Schaefer <gerald.schaefer@...ux.ibm.com>, 
 Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, 
 Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>, 
 x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>, 
 Phillip Potter <phil@...lpotter.co.uk>, Theodore Ts'o <tytso@....edu>, 
 "Jason A. Donenfeld" <Jason@...c4.com>, 
 Sudip Mukherjee <sudipm.mukherjee@...il.com>, 
 Mark Rutland <mark.rutland@....com>, Atish Patra <atishp@...shpatra.org>, 
 Anup Patel <anup@...infault.org>, Paul Walmsley <paul.walmsley@...ive.com>, 
 Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>, 
 Alexander Viro <viro@...iv.linux.org.uk>, 
 Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, 
 Eric Biederman <ebiederm@...ssion.com>, 
 Chandan Babu R <chandan.babu@...cle.com>, 
 "Darrick J. Wong" <djwong@...nel.org>, Steven Rostedt <rostedt@...dmis.org>, 
 Masami Hiramatsu <mhiramat@...nel.org>, 
 Peter Zijlstra <peterz@...radead.org>, 
 Arnaldo Carvalho de Melo <acme@...nel.org>, 
 Namhyung Kim <namhyung@...nel.org>, 
 Alexander Shishkin <alexander.shishkin@...ux.intel.com>, 
 Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>, 
 Balbir Singh <bsingharora@...il.com>, 
 "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>, 
 Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>, 
 Petr Mladek <pmladek@...e.com>, John Ogness <john.ogness@...utronix.de>, 
 Sergey Senozhatsky <senozhatsky@...omium.org>, 
 Juri Lelli <juri.lelli@...hat.com>, 
 Vincent Guittot <vincent.guittot@...aro.org>, 
 Dietmar Eggemann <dietmar.eggemann@....com>, 
 Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>, 
 Daniel Bristot de Oliveira <bristot@...hat.com>, 
 Valentin Schneider <vschneid@...hat.com>, 
 Andy Lutomirski <luto@...capital.net>, Will Drewry <wad@...omium.org>, 
 John Stultz <jstultz@...gle.com>, Stephen Boyd <sboyd@...nel.org>, 
 Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, 
 "Matthew Wilcox (Oracle)" <willy@...radead.org>, 
 Roopa Prabhu <roopa@...dia.com>, Nikolay Aleksandrov <razor@...ckwall.org>, 
 Remi Denis-Courmont <courmisch@...il.com>, 
 Allison Henderson <allison.henderson@...cle.com>, 
 Marcelo Ricardo Leitner <marcelo.leitner@...il.com>, 
 Xin Long <lucien.xin@...il.com>, Chuck Lever <chuck.lever@...cle.com>, 
 Jeff Layton <jlayton@...nel.org>, Neil Brown <neilb@...e.de>, 
 Olga Kornievskaia <kolga@...app.com>, Dai Ngo <Dai.Ngo@...cle.com>, 
 Tom Talpey <tom@...pey.com>, 
 Trond Myklebust <trond.myklebust@...merspace.com>, 
 Anna Schumaker <anna@...nel.org>, 
 John Johansen <john.johansen@...onical.com>, 
 Paul Moore <paul@...l-moore.com>, James Morris <jmorris@...ei.org>, 
 "Serge E. Hallyn" <serge@...lyn.com>, 
 Alexander Popov <alex.popov@...ux.com>
Cc: linux-hardening@...r.kernel.org, linux-kernel@...r.kernel.org, 
 bpf@...r.kernel.org, linux-mm@...ck.org, netdev@...r.kernel.org, 
 lvs-devel@...r.kernel.org, netfilter-devel@...r.kernel.org, 
 coreteam@...filter.org, linux-fsdevel@...r.kernel.org, 
 linux-arm-kernel@...ts.infradead.org, linux-s390@...r.kernel.org, 
 linuxppc-dev@...ts.ozlabs.org, linux-riscv@...ts.infradead.org, 
 linux-xfs@...r.kernel.org, linux-trace-kernel@...r.kernel.org, 
 linux-perf-users@...r.kernel.org, kexec@...ts.infradead.org, 
 bridge@...ts.linux.dev, linux-rdma@...r.kernel.org, 
 rds-devel@....oracle.com, linux-sctp@...r.kernel.org, 
 linux-nfs@...r.kernel.org, apparmor@...ts.ubuntu.com, 
 linux-security-module@...r.kernel.org, 
 Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH 00/11] sysctl: treewide: constify ctl_table argument of
 sysctl handlers

* Patch 1 is a bugfix for the stack_erasing sysctl handler
* Patches 2-10 change various helper functions throughout the kernel to
  be able to handle 'const ctl_table'.
* Patch 11 changes the signatures of all proc handlers through the tree.
  Some other signatures are also adapted, for details see the commit
  message.

Only patch 1 changes any code at all.

The series was compile-tested on top of next-20230315 for
i386, x86_64, arm, arm64, riscv, loongarch and s390.

This series was split from my larger series sysctl-const series [0].
It only focusses on the proc_handlers but is an important step to be
able to move all static definitions of ctl_table into .rodata.

[0] https://lore.kernel.org/lkml/20231204-const-sysctl-v2-0-7a5060b11447@weissschuh.net/

Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
Thomas Weißschuh (11):
      stackleak: don't modify ctl_table argument
      cgroup: bpf: constify ctl_table arguments and fields
      hugetlb: constify ctl_table arguments of utility functions
      utsname: constify ctl_table arguments of utility function
      neighbour: constify ctl_table arguments of utility function
      ipv4/sysctl: constify ctl_table arguments of utility functions
      ipv6/addrconf: constify ctl_table arguments of utility functions
      ipv6/ndisc: constify ctl_table arguments of utility function
      ipvs: constify ctl_table arguments of utility functions
      sysctl: constify ctl_table arguments of utility function
      sysctl: treewide: constify the ctl_table argument of handlers

 arch/arm64/kernel/armv8_deprecated.c      |   2 +-
 arch/arm64/kernel/fpsimd.c                |   2 +-
 arch/s390/appldata/appldata_base.c        |  10 +--
 arch/s390/kernel/debug.c                  |   2 +-
 arch/s390/kernel/topology.c               |   2 +-
 arch/s390/mm/cmm.c                        |   6 +-
 arch/x86/kernel/itmt.c                    |   2 +-
 drivers/cdrom/cdrom.c                     |   6 +-
 drivers/char/random.c                     |   5 +-
 drivers/macintosh/mac_hid.c               |   2 +-
 drivers/net/vrf.c                         |   2 +-
 drivers/parport/procfs.c                  |  14 ++--
 drivers/perf/arm_pmuv3.c                  |   6 +-
 drivers/perf/riscv_pmu_sbi.c              |   2 +-
 fs/coredump.c                             |   4 +-
 fs/dcache.c                               |   3 +-
 fs/drop_caches.c                          |   4 +-
 fs/exec.c                                 |   6 +-
 fs/file_table.c                           |   3 +-
 fs/fs-writeback.c                         |   2 +-
 fs/inode.c                                |   3 +-
 fs/pipe.c                                 |   2 +-
 fs/quota/dquot.c                          |   4 +-
 fs/xfs/xfs_sysctl.c                       |  33 ++++-----
 include/linux/filter.h                    |   2 +-
 include/linux/ftrace.h                    |   4 +-
 include/linux/mm.h                        |   8 +--
 include/linux/perf_event.h                |   6 +-
 include/linux/security.h                  |   2 +-
 include/linux/sysctl.h                    |  36 +++++-----
 include/linux/vmstat.h                    |   6 +-
 include/linux/writeback.h                 |   2 +-
 include/net/ndisc.h                       |   2 +-
 include/net/neighbour.h                   |   6 +-
 include/net/netfilter/nf_hooks_lwtunnel.h |   2 +-
 ipc/ipc_sysctl.c                          |  14 ++--
 kernel/bpf/syscall.c                      |   4 +-
 kernel/delayacct.c                        |   5 +-
 kernel/events/callchain.c                 |   2 +-
 kernel/events/core.c                      |   9 ++-
 kernel/fork.c                             |   2 +-
 kernel/hung_task.c                        |   7 +-
 kernel/kexec_core.c                       |   2 +-
 kernel/kprobes.c                          |   2 +-
 kernel/latencytop.c                       |   5 +-
 kernel/pid_namespace.c                    |   4 +-
 kernel/pid_sysctl.h                       |   2 +-
 kernel/printk/internal.h                  |   2 +-
 kernel/printk/printk.c                    |   2 +-
 kernel/printk/sysctl.c                    |   6 +-
 kernel/sched/core.c                       |  15 ++--
 kernel/sched/rt.c                         |  20 +++---
 kernel/sched/topology.c                   |   6 +-
 kernel/seccomp.c                          |   7 +-
 kernel/stackleak.c                        |  12 ++--
 kernel/sysctl.c                           | 109 ++++++++++++++++--------------
 kernel/time/timer.c                       |   4 +-
 kernel/trace/ftrace.c                     |   2 +-
 kernel/trace/trace.c                      |   2 +-
 kernel/trace/trace_events_user.c          |   3 +-
 kernel/trace/trace_stack.c                |   2 +-
 kernel/umh.c                              |   4 +-
 kernel/utsname_sysctl.c                   |   6 +-
 kernel/watchdog.c                         |  15 ++--
 mm/compaction.c                           |  17 +++--
 mm/hugetlb.c                              |  20 +++---
 mm/page-writeback.c                       |  27 +++++---
 mm/page_alloc.c                           |  43 ++++++++----
 mm/util.c                                 |  15 ++--
 mm/vmstat.c                               |   6 +-
 net/bridge/br_netfilter_hooks.c           |   2 +-
 net/core/neighbour.c                      |  26 ++++---
 net/core/sysctl_net_core.c                |  24 ++++---
 net/ipv4/devinet.c                        |   6 +-
 net/ipv4/route.c                          |   4 +-
 net/ipv4/sysctl_net_ipv4.c                |  40 ++++++-----
 net/ipv6/addrconf.c                       |  38 ++++++-----
 net/ipv6/ndisc.c                          |   7 +-
 net/ipv6/route.c                          |   4 +-
 net/ipv6/sysctl_net_ipv6.c                |   6 +-
 net/mpls/af_mpls.c                        |   4 +-
 net/netfilter/ipvs/ip_vs_ctl.c            |  19 +++---
 net/netfilter/nf_conntrack_standalone.c   |   2 +-
 net/netfilter/nf_hooks_lwtunnel.c         |   2 +-
 net/netfilter/nf_log.c                    |   4 +-
 net/phonet/sysctl.c                       |   2 +-
 net/rds/tcp.c                             |   4 +-
 net/sctp/sysctl.c                         |  30 ++++----
 net/sunrpc/sysctl.c                       |   5 +-
 net/sunrpc/xprtrdma/svc_rdma.c            |   2 +-
 security/apparmor/lsm.c                   |   2 +-
 security/min_addr.c                       |   2 +-
 security/yama/yama_lsm.c                  |   2 +-
 93 files changed, 467 insertions(+), 376 deletions(-)
---
base-commit: a1e7655b77e3391b58ac28256789ea45b1685abb
change-id: 20231226-sysctl-const-handler-883b5eba7e80

Best regards,
-- 
Thomas Weißschuh <linux@...ssschuh.net>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ