linux-csky.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] sysctl: deprecate register_sysctl_paths()
@ 2023-03-02 20:28 Luis Chamberlain
  2023-03-02 20:28 ` [PATCH 01/11] proc_sysctl: update docs for __register_sysctl_table() Luis Chamberlain
                   ` (10 more replies)
  0 siblings, 11 replies; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

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(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 01/11] proc_sysctl: update docs for __register_sysctl_table()
  2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
@ 2023-03-02 20:28 ` Luis Chamberlain
  2023-03-02 20:28 ` [PATCH 02/11] proc_sysctl: move helper which creates required subdirectories Luis Chamberlain
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

Update the docs for __register_sysctl_table() to make it clear no child
entries can be passed. When the child is true these are non-leaf entries
on the ctl table and sysctl treats these as directories. The point to
__register_sysctl_table() is to deal only with directories not part of
the ctl table where thay may riside, to be simple and avoid recursion.

While at it, hint towards using long on extra1 and extra2 later.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 fs/proc/proc_sysctl.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 5851eb5bc726..1df0beb50dbe 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1287,7 +1287,7 @@ static int insert_links(struct ctl_table_header *head)
  * __register_sysctl_table - register a leaf sysctl table
  * @set: Sysctl tree to register on
  * @path: The path to the directory the sysctl table is in.
- * @table: the top-level table structure
+ * @table: the top-level table structure without any child
  *
  * Register a sysctl table hierarchy. @table should be a filled in ctl_table
  * array. A completely 0 filled entry terminates the table.
@@ -1308,9 +1308,12 @@ static int insert_links(struct ctl_table_header *head)
  * proc_handler - the text handler routine (described below)
  *
  * extra1, extra2 - extra pointers usable by the proc handler routines
+ * XXX: we should eventually modify these to use long min / max [0]
+ * [0] https://lkml.kernel.org/87zgpte9o4.fsf@email.froward.int.ebiederm.org
  *
  * Leaf nodes in the sysctl tree will be represented by a single file
- * under /proc; non-leaf nodes will be represented by directories.
+ * under /proc; non-leaf nodes (where child is not NULL) are not allowed,
+ * sysctl_check_table() verifies this.
  *
  * There must be a proc_handler routine for any terminal nodes.
  * Several default handlers are available to cover common cases -
@@ -1352,7 +1355,7 @@ struct ctl_table_header *__register_sysctl_table(
 
 	spin_lock(&sysctl_lock);
 	dir = &set->dir;
-	/* Reference moved down the diretory tree get_subdir */
+	/* Reference moved down the directory tree get_subdir */
 	dir->header.nreg++;
 	spin_unlock(&sysctl_lock);
 
@@ -1369,6 +1372,11 @@ struct ctl_table_header *__register_sysctl_table(
 		if (namelen == 0)
 			continue;
 
+		/*
+		 * namelen ensures if name is "foo/bar/yay" only foo is
+		 * registered first. We traverse as if using mkdir -p and
+		 * return a ctl_dir for the last directory entry.
+		 */
 		dir = get_subdir(dir, name, namelen);
 		if (IS_ERR(dir))
 			goto fail;
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 02/11] proc_sysctl: move helper which creates required subdirectories
  2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
  2023-03-02 20:28 ` [PATCH 01/11] proc_sysctl: update docs for __register_sysctl_table() Luis Chamberlain
@ 2023-03-02 20:28 ` Luis Chamberlain
  2023-03-02 22:56   ` John Johansen
  2023-03-02 20:28 ` [PATCH 03/11] sysctl: clarify register_sysctl_init() base directory order Luis Chamberlain
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

Move the code which creates the subdirectories for a ctl table
into a helper routine so to make it easier to review. Document
the goal.

This creates no functional changes.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 fs/proc/proc_sysctl.c | 56 ++++++++++++++++++++++++-------------------
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 1df0beb50dbe..6b9b2694d430 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1283,6 +1283,35 @@ static int insert_links(struct ctl_table_header *head)
 	return err;
 }
 
+/* Find the directory for the ctl_table. If one is not found create it. */
+static struct ctl_dir *sysctl_mkdir_p(struct ctl_dir *dir, const char *path)
+{
+	const char *name, *nextname;
+
+	for (name = path; name; name = nextname) {
+		int namelen;
+		nextname = strchr(name, '/');
+		if (nextname) {
+			namelen = nextname - name;
+			nextname++;
+		} else {
+			namelen = strlen(name);
+		}
+		if (namelen == 0)
+			continue;
+
+		/*
+		 * namelen ensures if name is "foo/bar/yay" only foo is
+		 * registered first. We traverse as if using mkdir -p and
+		 * return a ctl_dir for the last directory entry.
+		 */
+		dir = get_subdir(dir, name, namelen);
+		if (IS_ERR(dir))
+			break;
+	}
+	return dir;
+}
+
 /**
  * __register_sysctl_table - register a leaf sysctl table
  * @set: Sysctl tree to register on
@@ -1334,7 +1363,6 @@ struct ctl_table_header *__register_sysctl_table(
 {
 	struct ctl_table_root *root = set->dir.header.root;
 	struct ctl_table_header *header;
-	const char *name, *nextname;
 	struct ctl_dir *dir;
 	struct ctl_table *entry;
 	struct ctl_node *node;
@@ -1359,29 +1387,9 @@ struct ctl_table_header *__register_sysctl_table(
 	dir->header.nreg++;
 	spin_unlock(&sysctl_lock);
 
-	/* Find the directory for the ctl_table */
-	for (name = path; name; name = nextname) {
-		int namelen;
-		nextname = strchr(name, '/');
-		if (nextname) {
-			namelen = nextname - name;
-			nextname++;
-		} else {
-			namelen = strlen(name);
-		}
-		if (namelen == 0)
-			continue;
-
-		/*
-		 * namelen ensures if name is "foo/bar/yay" only foo is
-		 * registered first. We traverse as if using mkdir -p and
-		 * return a ctl_dir for the last directory entry.
-		 */
-		dir = get_subdir(dir, name, namelen);
-		if (IS_ERR(dir))
-			goto fail;
-	}
-
+	dir = sysctl_mkdir_p(dir, path);
+	if (IS_ERR(dir))
+		goto fail;
 	spin_lock(&sysctl_lock);
 	if (insert_header(dir, header))
 		goto fail_put_dir_locked;
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 03/11] sysctl: clarify register_sysctl_init() base directory order
  2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
  2023-03-02 20:28 ` [PATCH 01/11] proc_sysctl: update docs for __register_sysctl_table() Luis Chamberlain
  2023-03-02 20:28 ` [PATCH 02/11] proc_sysctl: move helper which creates required subdirectories Luis Chamberlain
@ 2023-03-02 20:28 ` Luis Chamberlain
  2023-03-02 20:28 ` [PATCH 04/11] apparmor: simplify sysctls with register_sysctl_init() Luis Chamberlain
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

Relatively new docs which I added which hinted the base directories needed
to be created before is wrong, remove that incorrect comment. This has been
hinted before by Eric twice already [0] [1], I had just not verified that
until now. Now that I've verified that updates the docs to relax the context
described.

[0] https://lkml.kernel.org/r/875ys0azt8.fsf@email.froward.int.ebiederm.org
[1] https://lkml.kernel.org/r/87ftbiud6s.fsf@x220.int.ebiederm.org
Suggested-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 fs/proc/proc_sysctl.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 6b9b2694d430..15d5e02f1ec0 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1440,10 +1440,7 @@ EXPORT_SYMBOL(register_sysctl);
  * register_sysctl() failing on init are extremely low, and so for both reasons
  * this function does not return any error as it is used by initialization code.
  *
- * Context: Can only be called after your respective sysctl base path has been
- * registered. So for instance, most base directories are registered early on
- * init before init levels are processed through proc_sys_init() and
- * sysctl_init_bases().
+ * Context: if your base directory does not exist it will be created for you.
  */
 void __init __register_sysctl_init(const char *path, struct ctl_table *table,
 				 const char *table_name)
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 04/11] apparmor: simplify sysctls with register_sysctl_init()
  2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
                   ` (2 preceding siblings ...)
  2023-03-02 20:28 ` [PATCH 03/11] sysctl: clarify register_sysctl_init() base directory order Luis Chamberlain
@ 2023-03-02 20:28 ` Luis Chamberlain
  2023-03-02 20:42   ` Georgia Garcia
  2023-03-02 22:51   ` John Johansen
  2023-03-02 20:28 ` [PATCH 05/11] loadpin: simplify sysctls use with register_sysctl() Luis Chamberlain
                   ` (6 subsequent siblings)
  10 siblings, 2 replies; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

Using register_sysctl_paths() is really only needed if you have
subdirectories with entries. We can use the simple register_sysctl()
instead.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 security/apparmor/lsm.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index d6cc4812ca53..47c7ec7e5a80 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -1764,11 +1764,6 @@ static int apparmor_dointvec(struct ctl_table *table, int write,
 	return proc_dointvec(table, write, buffer, lenp, ppos);
 }
 
-static struct ctl_path apparmor_sysctl_path[] = {
-	{ .procname = "kernel", },
-	{ }
-};
-
 static struct ctl_table apparmor_sysctl_table[] = {
 	{
 		.procname       = "unprivileged_userns_apparmor_policy",
@@ -1790,8 +1785,7 @@ static struct ctl_table apparmor_sysctl_table[] = {
 
 static int __init apparmor_init_sysctl(void)
 {
-	return register_sysctl_paths(apparmor_sysctl_path,
-				     apparmor_sysctl_table) ? 0 : -ENOMEM;
+	return register_sysctl("kernel", apparmor_sysctl_table) ? 0 : -ENOMEM;
 }
 #else
 static inline int apparmor_init_sysctl(void)
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 05/11] loadpin: simplify sysctls use with register_sysctl()
  2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
                   ` (3 preceding siblings ...)
  2023-03-02 20:28 ` [PATCH 04/11] apparmor: simplify sysctls with register_sysctl_init() Luis Chamberlain
@ 2023-03-02 20:28 ` Luis Chamberlain
  2023-03-02 22:56   ` Kees Cook
  2023-03-02 22:58   ` John Johansen
  2023-03-02 20:28 ` [PATCH 06/11] yama: simplfy sysctls " Luis Chamberlain
                   ` (5 subsequent siblings)
  10 siblings, 2 replies; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

register_sysctl_paths() is not required, we can just use
register_sysctl() with the required path specified.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 security/loadpin/loadpin.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/security/loadpin/loadpin.c b/security/loadpin/loadpin.c
index d73a281adf86..c971464b4ad5 100644
--- a/security/loadpin/loadpin.c
+++ b/security/loadpin/loadpin.c
@@ -52,12 +52,6 @@ static bool deny_reading_verity_digests;
 #endif
 
 #ifdef CONFIG_SYSCTL
-static struct ctl_path loadpin_sysctl_path[] = {
-	{ .procname = "kernel", },
-	{ .procname = "loadpin", },
-	{ }
-};
-
 static struct ctl_table loadpin_sysctl_table[] = {
 	{
 		.procname       = "enforce",
@@ -262,7 +256,7 @@ static int __init loadpin_init(void)
 		enforce ? "" : "not ");
 	parse_exclude();
 #ifdef CONFIG_SYSCTL
-	if (!register_sysctl_paths(loadpin_sysctl_path, loadpin_sysctl_table))
+	if (!register_sysctl("kernel/loadpin", loadpin_sysctl_table))
 		pr_notice("sysctl registration failed!\n");
 #endif
 	security_add_hooks(loadpin_hooks, ARRAY_SIZE(loadpin_hooks), "loadpin");
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 06/11] yama: simplfy sysctls with register_sysctl()
  2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
                   ` (4 preceding siblings ...)
  2023-03-02 20:28 ` [PATCH 05/11] loadpin: simplify sysctls use with register_sysctl() Luis Chamberlain
@ 2023-03-02 20:28 ` Luis Chamberlain
  2023-03-02 22:56   ` Kees Cook
  2023-03-02 20:28 ` [PATCH 07/11] seccomp: simplify sysctls with register_sysctl_init() Luis Chamberlain
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

register_sysctl_paths() is only need if you have directories with
entries, simplify this by using register_sysctl().

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 security/yama/yama_lsm.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c
index 06e226166aab..90dd012b0db5 100644
--- a/security/yama/yama_lsm.c
+++ b/security/yama/yama_lsm.c
@@ -447,12 +447,6 @@ static int yama_dointvec_minmax(struct ctl_table *table, int write,
 
 static int max_scope = YAMA_SCOPE_NO_ATTACH;
 
-static struct ctl_path yama_sysctl_path[] = {
-	{ .procname = "kernel", },
-	{ .procname = "yama", },
-	{ }
-};
-
 static struct ctl_table yama_sysctl_table[] = {
 	{
 		.procname       = "ptrace_scope",
@@ -467,7 +461,7 @@ static struct ctl_table yama_sysctl_table[] = {
 };
 static void __init yama_init_sysctl(void)
 {
-	if (!register_sysctl_paths(yama_sysctl_path, yama_sysctl_table))
+	if (!register_sysctl("kernel/yama", yama_sysctl_table))
 		panic("Yama: sysctl registration failed.\n");
 }
 #else
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 07/11] seccomp: simplify sysctls with register_sysctl_init()
  2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
                   ` (5 preceding siblings ...)
  2023-03-02 20:28 ` [PATCH 06/11] yama: simplfy sysctls " Luis Chamberlain
@ 2023-03-02 20:28 ` Luis Chamberlain
  2023-03-02 22:56   ` Kees Cook
  2023-03-02 20:28 ` [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl() Luis Chamberlain
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

register_sysctl_paths() is only needed if you have childs (directories)
with entries. Just use register_sysctl_init() as it also does the
kmemleak check for you.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 kernel/seccomp.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index cebf26445f9e..d3e584065c7f 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -2368,12 +2368,6 @@ static int seccomp_actions_logged_handler(struct ctl_table *ro_table, int write,
 	return ret;
 }
 
-static struct ctl_path seccomp_sysctl_path[] = {
-	{ .procname = "kernel", },
-	{ .procname = "seccomp", },
-	{ }
-};
-
 static struct ctl_table seccomp_sysctl_table[] = {
 	{
 		.procname	= "actions_avail",
@@ -2392,14 +2386,7 @@ static struct ctl_table seccomp_sysctl_table[] = {
 
 static int __init seccomp_sysctl_init(void)
 {
-	struct ctl_table_header *hdr;
-
-	hdr = register_sysctl_paths(seccomp_sysctl_path, seccomp_sysctl_table);
-	if (!hdr)
-		pr_warn("sysctl registration failed\n");
-	else
-		kmemleak_not_leak(hdr);
-
+	register_sysctl_init("kernel/seccomp", seccomp_sysctl_table);
 	return 0;
 }
 
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl()
  2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
                   ` (6 preceding siblings ...)
  2023-03-02 20:28 ` [PATCH 07/11] seccomp: simplify sysctls with register_sysctl_init() Luis Chamberlain
@ 2023-03-02 20:28 ` Luis Chamberlain
  2023-03-02 23:13   ` Jeff Xu
  2023-03-02 20:28 ` [PATCH 09/11] fs-verity: " Luis Chamberlain
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

register_sysctl_paths() is only required if your child (directories)
have entries and pid_namespace does not. So use register_sysctl_init()
instead where we don't care about the return value and use
register_sysctl() where we do.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 kernel/pid_namespace.c | 3 +--
 kernel/pid_sysctl.h    | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index 46e0d5a3f91f..b43eee07b00c 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -314,7 +314,6 @@ static struct ctl_table pid_ns_ctl_table[] = {
 	},
 	{ }
 };
-static struct ctl_path kern_path[] = { { .procname = "kernel", }, { } };
 #endif	/* CONFIG_CHECKPOINT_RESTORE */
 
 int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)
@@ -473,7 +472,7 @@ static __init int pid_namespaces_init(void)
 	pid_ns_cachep = KMEM_CACHE(pid_namespace, SLAB_PANIC | SLAB_ACCOUNT);
 
 #ifdef CONFIG_CHECKPOINT_RESTORE
-	register_sysctl_paths(kern_path, pid_ns_ctl_table);
+	register_sysctl_init("kernel", pid_ns_ctl_table);
 #endif
 
 	register_pid_ns_sysctl_table_vm();
diff --git a/kernel/pid_sysctl.h b/kernel/pid_sysctl.h
index e22d072e1e24..d67a4d45bb42 100644
--- a/kernel/pid_sysctl.h
+++ b/kernel/pid_sysctl.h
@@ -46,10 +46,9 @@ static struct ctl_table pid_ns_ctl_table_vm[] = {
 	},
 	{ }
 };
-static struct ctl_path vm_path[] = { { .procname = "vm", }, { } };
 static inline void register_pid_ns_sysctl_table_vm(void)
 {
-	register_sysctl_paths(vm_path, pid_ns_ctl_table_vm);
+	register_sysctl("vm", pid_ns_ctl_table_vm);
 }
 #else
 static inline void initialize_memfd_noexec_scope(struct pid_namespace *ns) {}
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 09/11] fs-verity: simplify sysctls with register_sysctl()
  2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
                   ` (7 preceding siblings ...)
  2023-03-02 20:28 ` [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl() Luis Chamberlain
@ 2023-03-02 20:28 ` Luis Chamberlain
  2023-03-07 19:47   ` Eric Biggers
  2023-03-02 20:28 ` [PATCH 10/11] csky: simplify alignment sysctl registration Luis Chamberlain
  2023-03-02 20:28 ` [PATCH 11/11] proc_sysctl: deprecate register_sysctl_paths() Luis Chamberlain
  10 siblings, 1 reply; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

register_sysctl_paths() is only needed if your child (directories) have
entries but this does not so just use register_sysctl() so to do away
with the path specification.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 fs/verity/signature.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/fs/verity/signature.c b/fs/verity/signature.c
index e7d3ca919a1e..b8c51ad40d3a 100644
--- a/fs/verity/signature.c
+++ b/fs/verity/signature.c
@@ -88,12 +88,6 @@ int fsverity_verify_signature(const struct fsverity_info *vi,
 #ifdef CONFIG_SYSCTL
 static struct ctl_table_header *fsverity_sysctl_header;
 
-static const struct ctl_path fsverity_sysctl_path[] = {
-	{ .procname = "fs", },
-	{ .procname = "verity", },
-	{ }
-};
-
 static struct ctl_table fsverity_sysctl_table[] = {
 	{
 		.procname       = "require_signatures",
@@ -109,8 +103,7 @@ static struct ctl_table fsverity_sysctl_table[] = {
 
 static int __init fsverity_sysctl_init(void)
 {
-	fsverity_sysctl_header = register_sysctl_paths(fsverity_sysctl_path,
-						       fsverity_sysctl_table);
+	fsverity_sysctl_header = register_sysctl("fs/verity", fsverity_sysctl_table);
 	if (!fsverity_sysctl_header) {
 		pr_err("sysctl registration failed!\n");
 		return -ENOMEM;
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 10/11] csky: simplify alignment sysctl registration
  2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
                   ` (8 preceding siblings ...)
  2023-03-02 20:28 ` [PATCH 09/11] fs-verity: " Luis Chamberlain
@ 2023-03-02 20:28 ` Luis Chamberlain
  2023-03-02 20:28 ` [PATCH 11/11] proc_sysctl: deprecate register_sysctl_paths() Luis Chamberlain
  10 siblings, 0 replies; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

Using register_sysctl_paths() is only required if we are using
leafs with entries but all we are doing is creates leafs with
just one leaf and then entries and register_sysctl_init() works
well with that already.

The 555 permission is already retained by the new_dir() proc
sysctl directory creator.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 arch/csky/abiv1/alignment.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/arch/csky/abiv1/alignment.c b/arch/csky/abiv1/alignment.c
index 2df115d0e210..b60259daed1b 100644
--- a/arch/csky/abiv1/alignment.c
+++ b/arch/csky/abiv1/alignment.c
@@ -332,22 +332,9 @@ static struct ctl_table alignment_tbl[5] = {
 	{}
 };
 
-static struct ctl_table sysctl_table[2] = {
-	{
-	 .procname = "csky_alignment",
-	 .mode = 0555,
-	 .child = alignment_tbl},
-	{}
-};
-
-static struct ctl_path sysctl_path[2] = {
-	{.procname = "csky"},
-	{}
-};
-
 static int __init csky_alignment_init(void)
 {
-	register_sysctl_paths(sysctl_path, sysctl_table);
+	register_sysctl_init("csky/csky_alignment", alignment_tbl);
 	return 0;
 }
 
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 11/11] proc_sysctl: deprecate register_sysctl_paths()
  2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
                   ` (9 preceding siblings ...)
  2023-03-02 20:28 ` [PATCH 10/11] csky: simplify alignment sysctl registration Luis Chamberlain
@ 2023-03-02 20:28 ` Luis Chamberlain
  2023-03-10  4:17   ` Eric Biggers
  10 siblings, 1 reply; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-02 20:28 UTC (permalink / raw)
  To: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel, Luis Chamberlain

Now that all users are removed, drop the export for register_sysctl_paths()

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 fs/proc/proc_sysctl.c  | 30 +++++++++---------------------
 include/linux/sysctl.h | 11 -----------
 2 files changed, 9 insertions(+), 32 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 15d5e02f1ec0..ff06434f7be1 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1486,6 +1486,7 @@ static int count_subheaders(struct ctl_table *table)
 	return nr_subheaders + has_files;
 }
 
+/* Note: this can recurse and call itself when dealing with subdirectories */
 static int register_leaf_sysctl_tables(const char *path, char *pos,
 	struct ctl_table_header ***subheader, struct ctl_table_set *set,
 	struct ctl_table *table)
@@ -1571,9 +1572,10 @@ static int register_leaf_sysctl_tables(const char *path, char *pos,
  * Register a sysctl table hierarchy. @table should be a filled in ctl_table
  * array. A completely 0 filled entry terminates the table.
  *
- * See __register_sysctl_table for more details.
+ * See __register_sysctl_table for more details. This routine can
+ * recurse by having register_leaf_sysctl_tables() call itself.
  */
-struct ctl_table_header *__register_sysctl_paths(
+static struct ctl_table_header *__register_sysctl_paths(
 	struct ctl_table_set *set,
 	const struct ctl_path *path, struct ctl_table *table)
 {
@@ -1613,6 +1615,7 @@ struct ctl_table_header *__register_sysctl_paths(
 		subheader = subheaders;
 		header->ctl_table_arg = ctl_table_arg;
 
+		/* this can recurse */
 		if (register_leaf_sysctl_tables(new_path, pos, &subheader,
 						set, table))
 			goto err_register_leaves;
@@ -1635,37 +1638,22 @@ struct ctl_table_header *__register_sysctl_paths(
 }
 
 /**
- * register_sysctl_paths - register a sysctl table hierarchy
- * @path: The path to the directory the sysctl table is in.
+ * register_sysctl_table - register a sysctl table hierarchy
  * @table: the top-level table structure
  *
  * Register a sysctl table hierarchy. @table should be a filled in ctl_table
  * array. A completely 0 filled entry terminates the table.
  *
  * See __register_sysctl_paths for more details.
- */
-struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
-						struct ctl_table *table)
-{
-	return __register_sysctl_paths(&sysctl_table_root.default_set,
-					path, table);
-}
-EXPORT_SYMBOL(register_sysctl_paths);
-
-/**
- * register_sysctl_table - register a sysctl table hierarchy
- * @table: the top-level table structure
- *
- * Register a sysctl table hierarchy. @table should be a filled in ctl_table
- * array. A completely 0 filled entry terminates the table.
  *
- * See register_sysctl_paths for more details.
+ * This is a deprecated compatibility wrapper. You should avoid adding new
+ * users of this into the kernel.
  */
 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
 {
 	static const struct ctl_path null_path[] = { {} };
 
-	return register_sysctl_paths(null_path, table);
+	return __register_sysctl_paths(&sysctl_table_root.default_set, null_path, table);
 }
 EXPORT_SYMBOL(register_sysctl_table);
 
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 780690dc08cd..e8459fc56b50 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -221,13 +221,8 @@ extern void retire_sysctl_set(struct ctl_table_set *set);
 struct ctl_table_header *__register_sysctl_table(
 	struct ctl_table_set *set,
 	const char *path, struct ctl_table *table);
-struct ctl_table_header *__register_sysctl_paths(
-	struct ctl_table_set *set,
-	const struct ctl_path *path, struct ctl_table *table);
 struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table);
 struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
-struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
-						struct ctl_table *table);
 
 void unregister_sysctl_table(struct ctl_table_header * table);
 
@@ -277,12 +272,6 @@ static inline struct ctl_table_header *register_sysctl_mount_point(const char *p
 	return NULL;
 }
 
-static inline struct ctl_table_header *register_sysctl_paths(
-			const struct ctl_path *path, struct ctl_table *table)
-{
-	return NULL;
-}
-
 static inline struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table)
 {
 	return NULL;
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH 04/11] apparmor: simplify sysctls with register_sysctl_init()
  2023-03-02 20:28 ` [PATCH 04/11] apparmor: simplify sysctls with register_sysctl_init() Luis Chamberlain
@ 2023-03-02 20:42   ` Georgia Garcia
  2023-03-02 22:51   ` John Johansen
  1 sibling, 0 replies; 28+ messages in thread
From: Georgia Garcia @ 2023-03-02 20:42 UTC (permalink / raw)
  To: Luis Chamberlain, ebiederm, keescook, yzaikin, john.johansen,
	paul, jmorris, serge, luto, wad, dverkamp, paulmck, baihaowen,
	frederic, jeffxu, ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel

On Thu, 2023-03-02 at 12:28 -0800, Luis Chamberlain wrote:
> Using register_sysctl_paths() is really only needed if you have
> subdirectories with entries. We can use the simple register_sysctl()
> instead.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  security/apparmor/lsm.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
> index d6cc4812ca53..47c7ec7e5a80 100644
> --- a/security/apparmor/lsm.c
> +++ b/security/apparmor/lsm.c
> @@ -1764,11 +1764,6 @@ static int apparmor_dointvec(struct ctl_table *table, int write,
>  	return proc_dointvec(table, write, buffer, lenp, ppos);
>  }
>  
> -static struct ctl_path apparmor_sysctl_path[] = {
> -	{ .procname = "kernel", },
> -	{ }
> -};
> -
>  static struct ctl_table apparmor_sysctl_table[] = {
>  	{
>  		.procname       = "unprivileged_userns_apparmor_policy",
> @@ -1790,8 +1785,7 @@ static struct ctl_table apparmor_sysctl_table[] = {
>  
>  static int __init apparmor_init_sysctl(void)
>  {
> -	return register_sysctl_paths(apparmor_sysctl_path,
> -				     apparmor_sysctl_table) ? 0 : -ENOMEM;
> +	return register_sysctl("kernel", apparmor_sysctl_table) ? 0 : -ENOMEM;
>  }
>  #else
>  static inline int apparmor_init_sysctl(void)

Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com>


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 04/11] apparmor: simplify sysctls with register_sysctl_init()
  2023-03-02 20:28 ` [PATCH 04/11] apparmor: simplify sysctls with register_sysctl_init() Luis Chamberlain
  2023-03-02 20:42   ` Georgia Garcia
@ 2023-03-02 22:51   ` John Johansen
  1 sibling, 0 replies; 28+ messages in thread
From: John Johansen @ 2023-03-02 22:51 UTC (permalink / raw)
  To: Luis Chamberlain, ebiederm, keescook, yzaikin, paul, jmorris,
	serge, luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel

On 3/2/23 12:28, Luis Chamberlain wrote:
> Using register_sysctl_paths() is really only needed if you have
> subdirectories with entries. We can use the simple register_sysctl()
> instead.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Acked-by: John Johansen <john.johansen@canonical.com>

> ---
>   security/apparmor/lsm.c | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
> index d6cc4812ca53..47c7ec7e5a80 100644
> --- a/security/apparmor/lsm.c
> +++ b/security/apparmor/lsm.c
> @@ -1764,11 +1764,6 @@ static int apparmor_dointvec(struct ctl_table *table, int write,
>   	return proc_dointvec(table, write, buffer, lenp, ppos);
>   }
>   
> -static struct ctl_path apparmor_sysctl_path[] = {
> -	{ .procname = "kernel", },
> -	{ }
> -};
> -
>   static struct ctl_table apparmor_sysctl_table[] = {
>   	{
>   		.procname       = "unprivileged_userns_apparmor_policy",
> @@ -1790,8 +1785,7 @@ static struct ctl_table apparmor_sysctl_table[] = {
>   
>   static int __init apparmor_init_sysctl(void)
>   {
> -	return register_sysctl_paths(apparmor_sysctl_path,
> -				     apparmor_sysctl_table) ? 0 : -ENOMEM;
> +	return register_sysctl("kernel", apparmor_sysctl_table) ? 0 : -ENOMEM;
>   }
>   #else
>   static inline int apparmor_init_sysctl(void)


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 05/11] loadpin: simplify sysctls use with register_sysctl()
  2023-03-02 20:28 ` [PATCH 05/11] loadpin: simplify sysctls use with register_sysctl() Luis Chamberlain
@ 2023-03-02 22:56   ` Kees Cook
  2023-03-02 22:58   ` John Johansen
  1 sibling, 0 replies; 28+ messages in thread
From: Kees Cook @ 2023-03-02 22:56 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: ebiederm, yzaikin, john.johansen, paul, jmorris, serge, luto,
	wad, dverkamp, paulmck, baihaowen, frederic, jeffxu, ebiggers,
	tytso, guoren, j.granados, zhangpeng362, tangmeng, willy,
	nixiaoming, sujiaxun, patches, linux-fsdevel, apparmor,
	linux-security-module, linux-csky, linux-kernel

On Thu, Mar 02, 2023 at 12:28:20PM -0800, Luis Chamberlain wrote:
> register_sysctl_paths() is not required, we can just use
> register_sysctl() with the required path specified.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Acked-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 02/11] proc_sysctl: move helper which creates required subdirectories
  2023-03-02 20:28 ` [PATCH 02/11] proc_sysctl: move helper which creates required subdirectories Luis Chamberlain
@ 2023-03-02 22:56   ` John Johansen
  0 siblings, 0 replies; 28+ messages in thread
From: John Johansen @ 2023-03-02 22:56 UTC (permalink / raw)
  To: Luis Chamberlain, ebiederm, keescook, yzaikin, paul, jmorris,
	serge, luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel

On 3/2/23 12:28, Luis Chamberlain wrote:
> Move the code which creates the subdirectories for a ctl table
> into a helper routine so to make it easier to review. Document
> the goal.
> 
> This creates no functional changes.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Reviewed-by: John Johansen <john.johansen@canonical.com>

> ---
>   fs/proc/proc_sysctl.c | 56 ++++++++++++++++++++++++-------------------
>   1 file changed, 32 insertions(+), 24 deletions(-)
> 
> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> index 1df0beb50dbe..6b9b2694d430 100644
> --- a/fs/proc/proc_sysctl.c
> +++ b/fs/proc/proc_sysctl.c
> @@ -1283,6 +1283,35 @@ static int insert_links(struct ctl_table_header *head)
>   	return err;
>   }
>   
> +/* Find the directory for the ctl_table. If one is not found create it. */
> +static struct ctl_dir *sysctl_mkdir_p(struct ctl_dir *dir, const char *path)
> +{
> +	const char *name, *nextname;
> +
> +	for (name = path; name; name = nextname) {
> +		int namelen;
> +		nextname = strchr(name, '/');
> +		if (nextname) {
> +			namelen = nextname - name;
> +			nextname++;
> +		} else {
> +			namelen = strlen(name);
> +		}
> +		if (namelen == 0)
> +			continue;
> +
> +		/*
> +		 * namelen ensures if name is "foo/bar/yay" only foo is
> +		 * registered first. We traverse as if using mkdir -p and
> +		 * return a ctl_dir for the last directory entry.
> +		 */
> +		dir = get_subdir(dir, name, namelen);
> +		if (IS_ERR(dir))
> +			break;
> +	}
> +	return dir;
> +}
> +
>   /**
>    * __register_sysctl_table - register a leaf sysctl table
>    * @set: Sysctl tree to register on
> @@ -1334,7 +1363,6 @@ struct ctl_table_header *__register_sysctl_table(
>   {
>   	struct ctl_table_root *root = set->dir.header.root;
>   	struct ctl_table_header *header;
> -	const char *name, *nextname;
>   	struct ctl_dir *dir;
>   	struct ctl_table *entry;
>   	struct ctl_node *node;
> @@ -1359,29 +1387,9 @@ struct ctl_table_header *__register_sysctl_table(
>   	dir->header.nreg++;
>   	spin_unlock(&sysctl_lock);
>   
> -	/* Find the directory for the ctl_table */
> -	for (name = path; name; name = nextname) {
> -		int namelen;
> -		nextname = strchr(name, '/');
> -		if (nextname) {
> -			namelen = nextname - name;
> -			nextname++;
> -		} else {
> -			namelen = strlen(name);
> -		}
> -		if (namelen == 0)
> -			continue;
> -
> -		/*
> -		 * namelen ensures if name is "foo/bar/yay" only foo is
> -		 * registered first. We traverse as if using mkdir -p and
> -		 * return a ctl_dir for the last directory entry.
> -		 */
> -		dir = get_subdir(dir, name, namelen);
> -		if (IS_ERR(dir))
> -			goto fail;
> -	}
> -
> +	dir = sysctl_mkdir_p(dir, path);
> +	if (IS_ERR(dir))
> +		goto fail;
>   	spin_lock(&sysctl_lock);
>   	if (insert_header(dir, header))
>   		goto fail_put_dir_locked;


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 07/11] seccomp: simplify sysctls with register_sysctl_init()
  2023-03-02 20:28 ` [PATCH 07/11] seccomp: simplify sysctls with register_sysctl_init() Luis Chamberlain
@ 2023-03-02 22:56   ` Kees Cook
  0 siblings, 0 replies; 28+ messages in thread
From: Kees Cook @ 2023-03-02 22:56 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: ebiederm, yzaikin, john.johansen, paul, jmorris, serge, luto,
	wad, dverkamp, paulmck, baihaowen, frederic, jeffxu, ebiggers,
	tytso, guoren, j.granados, zhangpeng362, tangmeng, willy,
	nixiaoming, sujiaxun, patches, linux-fsdevel, apparmor,
	linux-security-module, linux-csky, linux-kernel

On Thu, Mar 02, 2023 at 12:28:22PM -0800, Luis Chamberlain wrote:
> register_sysctl_paths() is only needed if you have childs (directories)
> with entries. Just use register_sysctl_init() as it also does the
> kmemleak check for you.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Acked-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 06/11] yama: simplfy sysctls with register_sysctl()
  2023-03-02 20:28 ` [PATCH 06/11] yama: simplfy sysctls " Luis Chamberlain
@ 2023-03-02 22:56   ` Kees Cook
  0 siblings, 0 replies; 28+ messages in thread
From: Kees Cook @ 2023-03-02 22:56 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: ebiederm, yzaikin, john.johansen, paul, jmorris, serge, luto,
	wad, dverkamp, paulmck, baihaowen, frederic, jeffxu, ebiggers,
	tytso, guoren, j.granados, zhangpeng362, tangmeng, willy,
	nixiaoming, sujiaxun, patches, linux-fsdevel, apparmor,
	linux-security-module, linux-csky, linux-kernel

On Thu, Mar 02, 2023 at 12:28:21PM -0800, Luis Chamberlain wrote:
> register_sysctl_paths() is only need if you have directories with
> entries, simplify this by using register_sysctl().
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Acked-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 05/11] loadpin: simplify sysctls use with register_sysctl()
  2023-03-02 20:28 ` [PATCH 05/11] loadpin: simplify sysctls use with register_sysctl() Luis Chamberlain
  2023-03-02 22:56   ` Kees Cook
@ 2023-03-02 22:58   ` John Johansen
  1 sibling, 0 replies; 28+ messages in thread
From: John Johansen @ 2023-03-02 22:58 UTC (permalink / raw)
  To: Luis Chamberlain, ebiederm, keescook, yzaikin, paul, jmorris,
	serge, luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu,
	ebiggers, tytso, guoren
  Cc: j.granados, zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun,
	patches, linux-fsdevel, apparmor, linux-security-module,
	linux-csky, linux-kernel

On 3/2/23 12:28, Luis Chamberlain wrote:
> register_sysctl_paths() is not required, we can just use
> register_sysctl() with the required path specified.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>

> ---
>   security/loadpin/loadpin.c | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/security/loadpin/loadpin.c b/security/loadpin/loadpin.c
> index d73a281adf86..c971464b4ad5 100644
> --- a/security/loadpin/loadpin.c
> +++ b/security/loadpin/loadpin.c
> @@ -52,12 +52,6 @@ static bool deny_reading_verity_digests;
>   #endif
>   
>   #ifdef CONFIG_SYSCTL
> -static struct ctl_path loadpin_sysctl_path[] = {
> -	{ .procname = "kernel", },
> -	{ .procname = "loadpin", },
> -	{ }
> -};
> -
>   static struct ctl_table loadpin_sysctl_table[] = {
>   	{
>   		.procname       = "enforce",
> @@ -262,7 +256,7 @@ static int __init loadpin_init(void)
>   		enforce ? "" : "not ");
>   	parse_exclude();
>   #ifdef CONFIG_SYSCTL
> -	if (!register_sysctl_paths(loadpin_sysctl_path, loadpin_sysctl_table))
> +	if (!register_sysctl("kernel/loadpin", loadpin_sysctl_table))
>   		pr_notice("sysctl registration failed!\n");
>   #endif
>   	security_add_hooks(loadpin_hooks, ARRAY_SIZE(loadpin_hooks), "loadpin");


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl()
  2023-03-02 20:28 ` [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl() Luis Chamberlain
@ 2023-03-02 23:13   ` Jeff Xu
  2023-03-09 22:11     ` Luis Chamberlain
  0 siblings, 1 reply; 28+ messages in thread
From: Jeff Xu @ 2023-03-02 23:13 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, ebiggers,
	tytso, guoren, j.granados, zhangpeng362, tangmeng, willy,
	nixiaoming, sujiaxun, patches, linux-fsdevel, apparmor,
	linux-security-module, linux-csky, linux-kernel

On Thu, Mar 2, 2023 at 12:28 PM Luis Chamberlain <mcgrof@kernel.org> wrote:
>
> register_sysctl_paths() is only required if your child (directories)
> have entries and pid_namespace does not. So use register_sysctl_init()
> instead where we don't care about the return value and use
> register_sysctl() where we do.
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  kernel/pid_namespace.c | 3 +--
>  kernel/pid_sysctl.h    | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
> index 46e0d5a3f91f..b43eee07b00c 100644
> --- a/kernel/pid_namespace.c
> +++ b/kernel/pid_namespace.c
> @@ -314,7 +314,6 @@ static struct ctl_table pid_ns_ctl_table[] = {
>         },
>         { }
>  };
> -static struct ctl_path kern_path[] = { { .procname = "kernel", }, { } };
>  #endif /* CONFIG_CHECKPOINT_RESTORE */
>
>  int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)
> @@ -473,7 +472,7 @@ static __init int pid_namespaces_init(void)
>         pid_ns_cachep = KMEM_CACHE(pid_namespace, SLAB_PANIC | SLAB_ACCOUNT);
>
>  #ifdef CONFIG_CHECKPOINT_RESTORE
> -       register_sysctl_paths(kern_path, pid_ns_ctl_table);
> +       register_sysctl_init("kernel", pid_ns_ctl_table);
>  #endif
>
>         register_pid_ns_sysctl_table_vm();
> diff --git a/kernel/pid_sysctl.h b/kernel/pid_sysctl.h
> index e22d072e1e24..d67a4d45bb42 100644
> --- a/kernel/pid_sysctl.h
> +++ b/kernel/pid_sysctl.h
> @@ -46,10 +46,9 @@ static struct ctl_table pid_ns_ctl_table_vm[] = {
>         },
>         { }
>  };
> -static struct ctl_path vm_path[] = { { .procname = "vm", }, { } };
>  static inline void register_pid_ns_sysctl_table_vm(void)
>  {
> -       register_sysctl_paths(vm_path, pid_ns_ctl_table_vm);
> +       register_sysctl("vm", pid_ns_ctl_table_vm);
>  }
>  #else
>  static inline void initialize_memfd_noexec_scope(struct pid_namespace *ns) {}
> --
> 2.39.1
>
Acked-by: Jeff Xu <jeffxu@google.com>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 09/11] fs-verity: simplify sysctls with register_sysctl()
  2023-03-02 20:28 ` [PATCH 09/11] fs-verity: " Luis Chamberlain
@ 2023-03-07 19:47   ` Eric Biggers
  0 siblings, 0 replies; 28+ messages in thread
From: Eric Biggers @ 2023-03-07 19:47 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu, tytso,
	guoren, j.granados, zhangpeng362, tangmeng, willy, nixiaoming,
	sujiaxun, patches, linux-fsdevel, apparmor,
	linux-security-module, linux-csky, linux-kernel

On Thu, Mar 02, 2023 at 12:28:24PM -0800, Luis Chamberlain wrote:
> register_sysctl_paths() is only needed if your child (directories) have
> entries but this does not so just use register_sysctl() so to do away
> with the path specification.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  fs/verity/signature.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)

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

- Eric

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl()
  2023-03-02 23:13   ` Jeff Xu
@ 2023-03-09 22:11     ` Luis Chamberlain
  2023-03-09 22:27       ` Andrew Morton
  2023-03-10  4:14       ` Eric Biggers
  0 siblings, 2 replies; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-09 22:11 UTC (permalink / raw)
  To: Jeff Xu, Andrew Morton, Eric Biggers
  Cc: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, ebiggers,
	tytso, guoren, j.granados, zhangpeng362, tangmeng, willy,
	nixiaoming, sujiaxun, patches, linux-fsdevel, apparmor,
	linux-security-module, linux-csky, linux-kernel

On Thu, Mar 02, 2023 at 03:13:54PM -0800, Jeff Xu wrote:
> On Thu, Mar 2, 2023 at 12:28 PM Luis Chamberlain <mcgrof@kernel.org> wrote:
> >  kernel/pid_sysctl.h    | 3 +--
> >  2 files changed, 2 insertions(+), 4 deletions(-)
> >
> Acked-by: Jeff Xu <jeffxu@google.com>

Andrew, kernel/pid_sysctl.h is new, not on v6.3-rc1 and so I cannot
carry this on sysctl-next. Can you carry this patch on your tree?

I see Eric Biggers already took in the fs-verity patch, so I will drop
that from my queue.

I can take the rest in this series.

I will also hold off on the last patch which deprecates the routine
register_sysctl_paths() until after say the first part of the merge
window.

This will allow all of our trees to work on linux-next without conflict.

Let me know if this is OK with you and Eric!

  Luis

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl()
  2023-03-09 22:11     ` Luis Chamberlain
@ 2023-03-09 22:27       ` Andrew Morton
  2023-03-19 20:47         ` Luis Chamberlain
  2023-03-10  4:14       ` Eric Biggers
  1 sibling, 1 reply; 28+ messages in thread
From: Andrew Morton @ 2023-03-09 22:27 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: Jeff Xu, Eric Biggers, ebiederm, keescook, yzaikin,
	john.johansen, paul, jmorris, serge, luto, wad, dverkamp,
	paulmck, baihaowen, frederic, tytso, guoren, j.granados,
	zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun, patches,
	linux-fsdevel, apparmor, linux-security-module, linux-csky,
	linux-kernel

On Thu, 9 Mar 2023 14:11:27 -0800 Luis Chamberlain <mcgrof@kernel.org> wrote:

> Andrew, kernel/pid_sysctl.h is new, not on v6.3-rc1 and so I cannot
> carry this on sysctl-next. Can you carry this patch on your tree?

Sure, no probs.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl()
  2023-03-09 22:11     ` Luis Chamberlain
  2023-03-09 22:27       ` Andrew Morton
@ 2023-03-10  4:14       ` Eric Biggers
  2023-03-10  7:00         ` Luis Chamberlain
  1 sibling, 1 reply; 28+ messages in thread
From: Eric Biggers @ 2023-03-10  4:14 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: Jeff Xu, Andrew Morton, ebiederm, keescook, yzaikin,
	john.johansen, paul, jmorris, serge, luto, wad, dverkamp,
	paulmck, baihaowen, frederic, tytso, guoren, j.granados,
	zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun, patches,
	linux-fsdevel, apparmor, linux-security-module, linux-csky,
	linux-kernel

On Thu, Mar 09, 2023 at 02:11:27PM -0800, Luis Chamberlain wrote:
> On Thu, Mar 02, 2023 at 03:13:54PM -0800, Jeff Xu wrote:
> > On Thu, Mar 2, 2023 at 12:28 PM Luis Chamberlain <mcgrof@kernel.org> wrote:
> > >  kernel/pid_sysctl.h    | 3 +--
> > >  2 files changed, 2 insertions(+), 4 deletions(-)
> > >
> > Acked-by: Jeff Xu <jeffxu@google.com>
> 
> Andrew, kernel/pid_sysctl.h is new, not on v6.3-rc1 and so I cannot
> carry this on sysctl-next. Can you carry this patch on your tree?
> 
> I see Eric Biggers already took in the fs-verity patch, so I will drop
> that from my queue.
> 
> I can take the rest in this series.
> 
> I will also hold off on the last patch which deprecates the routine
> register_sysctl_paths() until after say the first part of the merge
> window.
> 
> This will allow all of our trees to work on linux-next without conflict.
> 
> Let me know if this is OK with you and Eric!
> 

That's fine with me.  I applied the fsverity patch based on your cover letter
that said it was okay
(https://lore.kernel.org/r/20230302202826.776286-1-mcgrof@kernel.org).  If you'd
like to take all the patches so that you can remove register_sysctl_paths() in
the same cycle, that would be fine too; it's up to you.

- Eric

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 11/11] proc_sysctl: deprecate register_sysctl_paths()
  2023-03-02 20:28 ` [PATCH 11/11] proc_sysctl: deprecate register_sysctl_paths() Luis Chamberlain
@ 2023-03-10  4:17   ` Eric Biggers
  2023-03-10  7:01     ` Luis Chamberlain
  0 siblings, 1 reply; 28+ messages in thread
From: Eric Biggers @ 2023-03-10  4:17 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu, tytso,
	guoren, j.granados, zhangpeng362, tangmeng, willy, nixiaoming,
	sujiaxun, patches, linux-fsdevel, apparmor,
	linux-security-module, linux-csky, linux-kernel

On Thu, Mar 02, 2023 at 12:28:26PM -0800, Luis Chamberlain wrote:
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index 780690dc08cd..e8459fc56b50 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -221,13 +221,8 @@ extern void retire_sysctl_set(struct ctl_table_set *set);
>  struct ctl_table_header *__register_sysctl_table(
>  	struct ctl_table_set *set,
>  	const char *path, struct ctl_table *table);
> -struct ctl_table_header *__register_sysctl_paths(
> -	struct ctl_table_set *set,
> -	const struct ctl_path *path, struct ctl_table *table);
>  struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table);
>  struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
> -struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
> -						struct ctl_table *table);
>  
>  void unregister_sysctl_table(struct ctl_table_header * table);
>  
> @@ -277,12 +272,6 @@ static inline struct ctl_table_header *register_sysctl_mount_point(const char *p
>  	return NULL;
>  }
>  
> -static inline struct ctl_table_header *register_sysctl_paths(
> -			const struct ctl_path *path, struct ctl_table *table)
> -{
> -	return NULL;
> -}
> -

Seems that this patch should be titled "remove register_sysctl_paths()", not
"deprecate register_sysctl_paths()"?

- Eric

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl()
  2023-03-10  4:14       ` Eric Biggers
@ 2023-03-10  7:00         ` Luis Chamberlain
  0 siblings, 0 replies; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-10  7:00 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Jeff Xu, Andrew Morton, ebiederm, keescook, yzaikin,
	john.johansen, paul, jmorris, serge, luto, wad, dverkamp,
	paulmck, baihaowen, frederic, tytso, guoren, j.granados,
	zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun, patches,
	linux-fsdevel, apparmor, linux-security-module, linux-csky,
	linux-kernel

On Thu, Mar 09, 2023 at 08:14:33PM -0800, Eric Biggers wrote:
> On Thu, Mar 09, 2023 at 02:11:27PM -0800, Luis Chamberlain wrote:
> > On Thu, Mar 02, 2023 at 03:13:54PM -0800, Jeff Xu wrote:
> > > On Thu, Mar 2, 2023 at 12:28 PM Luis Chamberlain <mcgrof@kernel.org> wrote:
> > > >  kernel/pid_sysctl.h    | 3 +--
> > > >  2 files changed, 2 insertions(+), 4 deletions(-)
> > > >
> > > Acked-by: Jeff Xu <jeffxu@google.com>
> > 
> > Andrew, kernel/pid_sysctl.h is new, not on v6.3-rc1 and so I cannot
> > carry this on sysctl-next. Can you carry this patch on your tree?
> > 
> > I see Eric Biggers already took in the fs-verity patch, so I will drop
> > that from my queue.
> > 
> > I can take the rest in this series.
> > 
> > I will also hold off on the last patch which deprecates the routine
> > register_sysctl_paths() until after say the first part of the merge
> > window.
> > 
> > This will allow all of our trees to work on linux-next without conflict.
> > 
> > Let me know if this is OK with you and Eric!
> > 
> 
> That's fine with me.  I applied the fsverity patch based on your cover letter
> that said it was okay
> (https://lore.kernel.org/r/20230302202826.776286-1-mcgrof@kernel.org).

Yeah it perfectly fine!

> If you'd
> like to take all the patches so that you can remove register_sysctl_paths() in
> the same cycle, that would be fine too; it's up to you.

Nah it's fine, no rush in this. One small step at a time.

  Luis

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 11/11] proc_sysctl: deprecate register_sysctl_paths()
  2023-03-10  4:17   ` Eric Biggers
@ 2023-03-10  7:01     ` Luis Chamberlain
  0 siblings, 0 replies; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-10  7:01 UTC (permalink / raw)
  To: Eric Biggers
  Cc: ebiederm, keescook, yzaikin, john.johansen, paul, jmorris, serge,
	luto, wad, dverkamp, paulmck, baihaowen, frederic, jeffxu, tytso,
	guoren, j.granados, zhangpeng362, tangmeng, willy, nixiaoming,
	sujiaxun, patches, linux-fsdevel, apparmor,
	linux-security-module, linux-csky, linux-kernel

On Thu, Mar 09, 2023 at 08:17:07PM -0800, Eric Biggers wrote:
> On Thu, Mar 02, 2023 at 12:28:26PM -0800, Luis Chamberlain wrote:
> > diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> > index 780690dc08cd..e8459fc56b50 100644
> > --- a/include/linux/sysctl.h
> > +++ b/include/linux/sysctl.h
> > @@ -221,13 +221,8 @@ extern void retire_sysctl_set(struct ctl_table_set *set);
> >  struct ctl_table_header *__register_sysctl_table(
> >  	struct ctl_table_set *set,
> >  	const char *path, struct ctl_table *table);
> > -struct ctl_table_header *__register_sysctl_paths(
> > -	struct ctl_table_set *set,
> > -	const struct ctl_path *path, struct ctl_table *table);
> >  struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table);
> >  struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
> > -struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
> > -						struct ctl_table *table);
> >  
> >  void unregister_sysctl_table(struct ctl_table_header * table);
> >  
> > @@ -277,12 +272,6 @@ static inline struct ctl_table_header *register_sysctl_mount_point(const char *p
> >  	return NULL;
> >  }
> >  
> > -static inline struct ctl_table_header *register_sysctl_paths(
> > -			const struct ctl_path *path, struct ctl_table *table)
> > -{
> > -	return NULL;
> > -}
> > -
> 
> Seems that this patch should be titled "remove register_sysctl_paths()", not
> "deprecate register_sysctl_paths()"?

Good call! Will adjust.

  Luis

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl()
  2023-03-09 22:27       ` Andrew Morton
@ 2023-03-19 20:47         ` Luis Chamberlain
  0 siblings, 0 replies; 28+ messages in thread
From: Luis Chamberlain @ 2023-03-19 20:47 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Jeff Xu, Eric Biggers, ebiederm, keescook, yzaikin,
	john.johansen, paul, jmorris, serge, luto, wad, dverkamp,
	paulmck, baihaowen, frederic, tytso, guoren, j.granados,
	zhangpeng362, tangmeng, willy, nixiaoming, sujiaxun, patches,
	linux-fsdevel, apparmor, linux-security-module, linux-csky,
	linux-kernel

On Thu, Mar 09, 2023 at 02:27:46PM -0800, Andrew Morton wrote:
> On Thu, 9 Mar 2023 14:11:27 -0800 Luis Chamberlain <mcgrof@kernel.org> wrote:
> 
> > Andrew, kernel/pid_sysctl.h is new, not on v6.3-rc1 and so I cannot
> > carry this on sysctl-next. Can you carry this patch on your tree?
> 
> Sure, no probs.

Andrew, this one patch will have to go through your tree as kernel/pid_sysctl.h
only exist on your tree. I'll drop it on my end!

Thanks!

  Luis

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2023-03-19 20:47 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-02 20:28 [PATCH 00/11] sysctl: deprecate register_sysctl_paths() Luis Chamberlain
2023-03-02 20:28 ` [PATCH 01/11] proc_sysctl: update docs for __register_sysctl_table() Luis Chamberlain
2023-03-02 20:28 ` [PATCH 02/11] proc_sysctl: move helper which creates required subdirectories Luis Chamberlain
2023-03-02 22:56   ` John Johansen
2023-03-02 20:28 ` [PATCH 03/11] sysctl: clarify register_sysctl_init() base directory order Luis Chamberlain
2023-03-02 20:28 ` [PATCH 04/11] apparmor: simplify sysctls with register_sysctl_init() Luis Chamberlain
2023-03-02 20:42   ` Georgia Garcia
2023-03-02 22:51   ` John Johansen
2023-03-02 20:28 ` [PATCH 05/11] loadpin: simplify sysctls use with register_sysctl() Luis Chamberlain
2023-03-02 22:56   ` Kees Cook
2023-03-02 22:58   ` John Johansen
2023-03-02 20:28 ` [PATCH 06/11] yama: simplfy sysctls " Luis Chamberlain
2023-03-02 22:56   ` Kees Cook
2023-03-02 20:28 ` [PATCH 07/11] seccomp: simplify sysctls with register_sysctl_init() Luis Chamberlain
2023-03-02 22:56   ` Kees Cook
2023-03-02 20:28 ` [PATCH 08/11] kernel: pid_namespace: simplify sysctls with register_sysctl() Luis Chamberlain
2023-03-02 23:13   ` Jeff Xu
2023-03-09 22:11     ` Luis Chamberlain
2023-03-09 22:27       ` Andrew Morton
2023-03-19 20:47         ` Luis Chamberlain
2023-03-10  4:14       ` Eric Biggers
2023-03-10  7:00         ` Luis Chamberlain
2023-03-02 20:28 ` [PATCH 09/11] fs-verity: " Luis Chamberlain
2023-03-07 19:47   ` Eric Biggers
2023-03-02 20:28 ` [PATCH 10/11] csky: simplify alignment sysctl registration Luis Chamberlain
2023-03-02 20:28 ` [PATCH 11/11] proc_sysctl: deprecate register_sysctl_paths() Luis Chamberlain
2023-03-10  4:17   ` Eric Biggers
2023-03-10  7:01     ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).