Skip to content

sysctl: deprecate register_sysctl_paths()

Luis Chamberlain linux-csky linux-fsdevel linux-patches linux-security-module lkml 1 version Applied

Status from this message: Applied to https://git.kernel.org/pub/scm/fs/fsverity/linux.git/log/?h=for-next

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 16 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/11proc_sysctl: update docs for __register_sysctl_table()fs/proc/proc_sysctl.c+11 -30 replies
2/11proc_sysctl: move helper which creates required subdirectoriesfs/proc/proc_sysctl.c+32 -241 reply
3/11sysctl: clarify register_sysctl_init() base directory orderfs/proc/proc_sysctl.c+1 -40 replies
4/11apparmor: simplify sysctls with register_sysctl_init()security/apparmor/lsm.c+1 -72 replies
5/11loadpin: simplify sysctls use with register_sysctl()security/loadpin/loadpin.c+1 -72 replies
6/11yama: simplfy sysctls with register_sysctl()security/yama/yama_lsm.c+1 -71 reply
7/11seccomp: simplify sysctls with register_sysctl_init()kernel/seccomp.c+1 -141 reply
8/11kernel: pid_namespace: simplify sysctls with register_sysctl()kernel/pid_namespace.c kernel/pid_sysctl.h+2 -46 replies
9/11fs-verity: simplify sysctls with register_sysctl()fs/verity/signature.c+1 -81 reply
10/11csky: simplify alignment sysctl registrationarch/csky/abiv1/alignment.c+1 -140 replies
11/11proc_sysctl: deprecate register_sysctl_paths()fs/proc/proc_sysctl.c include/linux/sysctl.h+9 -322 replies

Reviews trailers per patch

6 of 11 patches have a Reviewed-by or Acked-by.

PatchGeorgia GarciaJohn JohansenKees CookJeff Xu
1/11
2/11R-b
3/11
4/11R-b A-b
5/11R-b A-b
6/11A-b
7/11A-b
8/11A-b
9/11
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH 00/11] sysctl: deprecate register_sysctl_paths()

As we trim down the insane kernel/sysctl.c large array and move sysctls out we're looking to optimize the way we do syctl registrations so we deal with just flat entries so to make the registration code much easier to maintain and so it does not recurse. In dealing with some of these things it reminded us that we will eventually get to the point of just passing in the ARRAY_SIZE() we want, to get there we should strive to move away from the older callers that do need the recursion. Turns out tons of users don't need the recursion already so we can start converting those over.

register_sysctl_paths() can do recursion when its users have sysctl entries with directories and and then subdirectories with other entries. This *typically* was the use case in the large sysctl array in kernel/sysctl.c but as we trim that down we're phasing out the users that have subdirectories. This means that the code path that can do recursion is being mitigated over time and the code can be simplified as well.

There are however many existing users of register_sysctl_paths() which don't need to deal with subdirectories, and register_sysctl() and the init version register_sysctl_init() (used when you don't care for the initial return value / need to de-register) can create subdirectories for you if you have no entries in between. So just convert these users to the simpler APIs and deprecate out register_sysctl_paths().

The next step after this is to to start deprecating slowly the callers of register_sysctl_table(). I'll send a out second batch for those that apply on top of this.

Unless folks have an issue, I can offer to take these in the sysctl-next tree as we sweep these out, but I'm happy for folks to take these into their tree as well if they want. The only possible conflict would be timing, ie, if the final patch which removes the API call. That patch could also just wait another or two cycles later.

Luis Chamberlain (11):
proc_sysctl: update docs for __register_sysctl_table()
proc_sysctl: move helper which creates required subdirectories
sysctl: clarify register_sysctl_init() base directory order
apparmor: simplify sysctls with register_sysctl_init()
loadpin: simplify sysctls use with register_sysctl()
yama: simplfy sysctls with register_sysctl()
seccomp: simplify sysctls with register_sysctl_init()
kernel: pid_namespace: simplify sysctls with register_sysctl()
fs-verity: simplify sysctls with register_sysctl()
csky: simplify alignment sysctl registration
proc_sysctl: deprecate register_sysctl_paths()

 arch/csky/abiv1/alignment.c | 15 +-----
 fs/proc/proc_sysctl.c       | 95 +++++++++++++++++++------------------
 fs/verity/signature.c       |  9 +---
 include/linux/sysctl.h      | 11 -----
 kernel/pid_namespace.c      |  3 +-
 kernel/pid_sysctl.h         |  3 +-
 kernel/seccomp.c            | 15 +-----
 security/apparmor/lsm.c     |  8 +---
 security/loadpin/loadpin.c  |  8 +---
 security/yama/yama_lsm.c    |  8 +---
 10 files changed, 56 insertions(+), 119 deletions(-)
Signature · 1 line
2.39.1