LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 11/13] random: simplify sysctl declaration with register_sysctl_subdir()
From: Luis Chamberlain @ 2020-05-29  7:41 UTC (permalink / raw)
  To: keescook, yzaikin, nixiaoming, ebiederm, axboe, clemens, arnd,
	gregkh, jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied,
	daniel, benh, rdna, viro, mark, jlbec, joseph.qi, vbabka, sfr,
	jack, amir73il, rafael, tytso
  Cc: intel-gfx, linux-kernel, dri-devel, julia.lawall,
	Luis Chamberlain, akpm, linuxppc-dev, ocfs2-devel
In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org>

From: Xiaoming Ni <nixiaoming@huawei.com>

Move random_table sysctl from kernel/sysctl.c to drivers/char/random.c
and use register_sysctl_subdir() to help remove the clutter out of
kernel/sysctl.c.

Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/char/random.c  | 14 ++++++++++++--
 include/linux/sysctl.h |  1 -
 kernel/sysctl.c        |  5 -----
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index a7cf6aa65908..73fd4b6e9c18 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -2101,8 +2101,7 @@ static int proc_do_entropy(struct ctl_table *table, int write,
 }
 
 static int sysctl_poolsize = INPUT_POOL_WORDS * 32;
-extern struct ctl_table random_table[];
-struct ctl_table random_table[] = {
+static struct ctl_table random_table[] = {
 	{
 		.procname	= "poolsize",
 		.data		= &sysctl_poolsize,
@@ -2164,6 +2163,17 @@ struct ctl_table random_table[] = {
 #endif
 	{ }
 };
+
+/*
+ * rand_initialize() is called before sysctl_init(),
+ * so we cannot call register_sysctl_init() in rand_initialize()
+ */
+static int __init random_sysctls_init(void)
+{
+	register_sysctl_subdir("kernel", "random", random_table);
+	return 0;
+}
+device_initcall(random_sysctls_init);
 #endif 	/* CONFIG_SYSCTL */
 
 struct batched_entropy {
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index e5364b69dd95..33a471b56345 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -216,7 +216,6 @@ extern int unaligned_dump_stack;
 extern int no_unaligned_warning;
 
 extern struct ctl_table sysctl_mount_point[];
-extern struct ctl_table random_table[];
 
 #else /* CONFIG_SYSCTL */
 static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 5c116904feb7..f9a35325d5d5 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2078,11 +2078,6 @@ static struct ctl_table kern_table[] = {
 		.mode		= 0644,
 		.proc_handler	= sysctl_max_threads,
 	},
-	{
-		.procname	= "random",
-		.mode		= 0555,
-		.child		= random_table,
-	},
 	{
 		.procname	= "usermodehelper",
 		.mode		= 0555,
-- 
2.26.2


^ permalink raw reply related

* [PATCH 09/13] firmware_loader: simplify sysctl declaration with register_sysctl_subdir()
From: Luis Chamberlain @ 2020-05-29  7:41 UTC (permalink / raw)
  To: keescook, yzaikin, nixiaoming, ebiederm, axboe, clemens, arnd,
	gregkh, jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied,
	daniel, benh, rdna, viro, mark, jlbec, joseph.qi, vbabka, sfr,
	jack, amir73il, rafael, tytso
  Cc: intel-gfx, linux-kernel, dri-devel, julia.lawall,
	Luis Chamberlain, akpm, linuxppc-dev, ocfs2-devel
In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org>

From: Xiaoming Ni <nixiaoming@huawei.com>

Move the firmware config sysctl table to fallback_table.c and use the
new register_sysctl_subdir() helper. This removes the clutter from
kernel/sysctl.c.

Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/base/firmware_loader/fallback.c       |  4 ++++
 drivers/base/firmware_loader/fallback.h       | 11 ++++++++++
 drivers/base/firmware_loader/fallback_table.c | 22 +++++++++++++++++--
 include/linux/sysctl.h                        |  1 -
 kernel/sysctl.c                               |  7 ------
 5 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c
index d9ac7296205e..8190653ae9a3 100644
--- a/drivers/base/firmware_loader/fallback.c
+++ b/drivers/base/firmware_loader/fallback.c
@@ -200,12 +200,16 @@ static struct class firmware_class = {
 
 int register_sysfs_loader(void)
 {
+	int ret = register_firmware_config_sysctl();
+	if (ret != 0)
+		return ret;
 	return class_register(&firmware_class);
 }
 
 void unregister_sysfs_loader(void)
 {
 	class_unregister(&firmware_class);
+	unregister_firmware_config_sysctl();
 }
 
 static ssize_t firmware_loading_show(struct device *dev,
diff --git a/drivers/base/firmware_loader/fallback.h b/drivers/base/firmware_loader/fallback.h
index 06f4577733a8..7d2cb5f6ceb8 100644
--- a/drivers/base/firmware_loader/fallback.h
+++ b/drivers/base/firmware_loader/fallback.h
@@ -42,6 +42,17 @@ void fw_fallback_set_default_timeout(void);
 
 int register_sysfs_loader(void);
 void unregister_sysfs_loader(void);
+#ifdef CONFIG_SYSCTL
+extern int register_firmware_config_sysctl(void);
+extern void unregister_firmware_config_sysctl(void);
+#else
+static inline int register_firmware_config_sysctl(void)
+{
+	return 0;
+}
+static inline void unregister_firmware_config_sysctl(void) { }
+#endif /* CONFIG_SYSCTL */
+
 #else /* CONFIG_FW_LOADER_USER_HELPER */
 static inline int firmware_fallback_sysfs(struct firmware *fw, const char *name,
 					  struct device *device,
diff --git a/drivers/base/firmware_loader/fallback_table.c b/drivers/base/firmware_loader/fallback_table.c
index 46a731dede6f..4234aa5ee5df 100644
--- a/drivers/base/firmware_loader/fallback_table.c
+++ b/drivers/base/firmware_loader/fallback_table.c
@@ -24,7 +24,7 @@ struct firmware_fallback_config fw_fallback_config = {
 EXPORT_SYMBOL_NS_GPL(fw_fallback_config, FIRMWARE_LOADER_PRIVATE);
 
 #ifdef CONFIG_SYSCTL
-struct ctl_table firmware_config_table[] = {
+static struct ctl_table firmware_config_table[] = {
 	{
 		.procname	= "force_sysfs_fallback",
 		.data		= &fw_fallback_config.force_sysfs_fallback,
@@ -45,4 +45,22 @@ struct ctl_table firmware_config_table[] = {
 	},
 	{ }
 };
-#endif
+
+static struct ctl_table_header *hdr;
+int register_firmware_config_sysctl(void)
+{
+	if (hdr)
+		return -EEXIST;
+	hdr = register_sysctl_subdir("kernel", "firmware_config",
+				     firmware_config_table);
+	if (!hdr)
+		return -ENOMEM;
+	return 0;
+}
+
+void unregister_firmware_config_sysctl(void)
+{
+	if (hdr)
+		unregister_sysctl_table(hdr);
+}
+#endif /* CONFIG_SYSCTL */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 58bc978d4f03..aa01f54d0442 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -217,7 +217,6 @@ extern int no_unaligned_warning;
 
 extern struct ctl_table sysctl_mount_point[];
 extern struct ctl_table random_table[];
-extern struct ctl_table firmware_config_table[];
 extern struct ctl_table epoll_table[];
 
 #else /* CONFIG_SYSCTL */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 30c2d521502a..e007375c8a11 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2088,13 +2088,6 @@ static struct ctl_table kern_table[] = {
 		.mode		= 0555,
 		.child		= usermodehelper_table,
 	},
-#ifdef CONFIG_FW_LOADER_USER_HELPER
-	{
-		.procname	= "firmware_config",
-		.mode		= 0555,
-		.child		= firmware_config_table,
-	},
-#endif
 	{
 		.procname	= "overflowuid",
 		.data		= &overflowuid,
-- 
2.26.2


^ permalink raw reply related

* [PATCH 12/13] sysctl: add helper to register empty subdir
From: Luis Chamberlain @ 2020-05-29  7:41 UTC (permalink / raw)
  To: keescook, yzaikin, nixiaoming, ebiederm, axboe, clemens, arnd,
	gregkh, jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied,
	daniel, benh, rdna, viro, mark, jlbec, joseph.qi, vbabka, sfr,
	jack, amir73il, rafael, tytso
  Cc: intel-gfx, linux-kernel, dri-devel, julia.lawall,
	Luis Chamberlain, akpm, linuxppc-dev, ocfs2-devel
In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org>

The way to create a subdirectory from the base set of directories
is a bit obscure, so provide a helper which makes this clear, and
also helps remove boiler plate code required to do this work.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 include/linux/sysctl.h |  7 +++++++
 kernel/sysctl.c        | 16 +++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 33a471b56345..89c92390e6de 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -208,6 +208,8 @@ extern void register_sysctl_init(const char *path, struct ctl_table *table,
 extern struct ctl_table_header *register_sysctl_subdir(const char *base,
 						       const char *subdir,
 						       struct ctl_table *table);
+extern void register_sysctl_empty_subdir(const char *base, const char *subdir);
+
 void do_sysctl_args(void);
 
 extern int pwrsw_enabled;
@@ -231,6 +233,11 @@ inline struct ctl_table_header *register_sysctl_subdir(const char *base,
 	return NULL;
 }
 
+static inline void register_sysctl_empty_subdir(const char *base,
+						const char *subdir)
+{
+}
+
 static inline struct ctl_table_header *register_sysctl_paths(
 			const struct ctl_path *path, struct ctl_table *table)
 {
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f9a35325d5d5..460532cd5ac8 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -3188,13 +3188,17 @@ struct ctl_table_header *register_sysctl_subdir(const char *base,
 		{ }
 	};
 
-	if (!table->procname)
+	if (table != sysctl_mount_point && !table->procname)
 		goto out;
 
 	hdr = register_sysctl_table(base_table);
 	if (unlikely(!hdr)) {
-		pr_err("failed when creating subdirectory sysctl %s/%s/%s\n",
-		       base, subdir, table->procname);
+		if (table != sysctl_mount_point)
+			pr_err("failed when creating subdirectory sysctl %s/%s/%s\n",
+			       base, subdir, table->procname);
+		else
+			pr_err("failed when creating empty subddirectory %s/%s\n",
+			       base, subdir);
 		goto out;
 	}
 	kmemleak_not_leak(hdr);
@@ -3202,6 +3206,12 @@ struct ctl_table_header *register_sysctl_subdir(const char *base,
 	return hdr;
 }
 EXPORT_SYMBOL_GPL(register_sysctl_subdir);
+
+void register_sysctl_empty_subdir(const char *base,
+				  const char *subdir)
+{
+	register_sysctl_subdir(base, subdir, sysctl_mount_point);
+}
 #endif /* CONFIG_SYSCTL */
 /*
  * No sense putting this after each symbol definition, twice,
-- 
2.26.2


^ permalink raw reply related

* [PATCH 13/13] fs: move binfmt_misc sysctl to its own file
From: Luis Chamberlain @ 2020-05-29  7:41 UTC (permalink / raw)
  To: keescook, yzaikin, nixiaoming, ebiederm, axboe, clemens, arnd,
	gregkh, jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied,
	daniel, benh, rdna, viro, mark, jlbec, joseph.qi, vbabka, sfr,
	jack, amir73il, rafael, tytso
  Cc: intel-gfx, linux-kernel, dri-devel, julia.lawall,
	Luis Chamberlain, akpm, linuxppc-dev, ocfs2-devel
In-Reply-To: <20200529074108.16928-1-mcgrof@kernel.org>

This moves the binfmt_misc sysctl to its own file to help remove
clutter from kernel/sysctl.c.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 fs/binfmt_misc.c | 1 +
 kernel/sysctl.c  | 7 -------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index f69a043f562b..656b3f5f3bbf 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -821,6 +821,7 @@ static int __init init_misc_binfmt(void)
 	int err = register_filesystem(&bm_fs_type);
 	if (!err)
 		insert_binfmt(&misc_format);
+	register_sysctl_empty_subdir("fs", "binfmt_misc");
 	return err;
 }
 
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 460532cd5ac8..7714e7b476c2 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -3042,13 +3042,6 @@ static struct ctl_table fs_table[] = {
 		.extra1		= SYSCTL_ZERO,
 		.extra2		= SYSCTL_TWO,
 	},
-#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
-	{
-		.procname	= "binfmt_misc",
-		.mode		= 0555,
-		.child		= sysctl_mount_point,
-	},
-#endif
 	{
 		.procname	= "pipe-max-size",
 		.data		= &pipe_max_size,
-- 
2.26.2


^ permalink raw reply related

* Re: [PATCH 01/13] sysctl: add new register_sysctl_subdir() helper
From: Jani Nikula @ 2020-05-29  8:13 UTC (permalink / raw)
  To: Luis Chamberlain, keescook, yzaikin, nixiaoming, ebiederm, axboe,
	clemens, arnd, gregkh, joonas.lahtinen, rodrigo.vivi, airlied,
	daniel, benh, rdna, viro, mark, jlbec, joseph.qi, vbabka, sfr,
	jack, amir73il, rafael, tytso
  Cc: intel-gfx, linux-kernel, dri-devel, julia.lawall,
	Luis Chamberlain, akpm, linuxppc-dev, ocfs2-devel
In-Reply-To: <20200529074108.16928-2-mcgrof@kernel.org>

On Fri, 29 May 2020, Luis Chamberlain <mcgrof@kernel.org> wrote:
> Often enough all we need to do is create a subdirectory so that
> we can stuff sysctls underneath it. However, *if* that directory
> was already created early on the boot sequence we really have no
> need to use the full boiler plate code for it, we can just use
> local variables to help us guide sysctl to place the new leaf files.

I find it hard to figure out the lifetime requirements for the tables
passed in; when it's okay to use local variables and when you need
longer lifetimes. It's not documented, everyone appears to be using
static tables for this. It's far from obvious.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply

* Re: [PATCH 13/13] fs: move binfmt_misc sysctl to its own file
From: Kees Cook @ 2020-05-29  8:14 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: jack, rafael, airlied, amir73il, clemens, dri-devel, joseph.qi,
	sfr, mark, rdna, yzaikin, joonas.lahtinen, arnd, intel-gfx,
	jani.nikula, julia.lawall, jlbec, rodrigo.vivi, nixiaoming,
	vbabka, axboe, tytso, gregkh, linux-kernel, ebiederm, daniel,
	akpm, linuxppc-dev, ocfs2-devel, viro
In-Reply-To: <20200529074108.16928-14-mcgrof@kernel.org>

On Fri, May 29, 2020 at 07:41:08AM +0000, Luis Chamberlain wrote:
> This moves the binfmt_misc sysctl to its own file to help remove
> clutter from kernel/sysctl.c.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  fs/binfmt_misc.c | 1 +
>  kernel/sysctl.c  | 7 -------
>  2 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
> index f69a043f562b..656b3f5f3bbf 100644
> --- a/fs/binfmt_misc.c
> +++ b/fs/binfmt_misc.c
> @@ -821,6 +821,7 @@ static int __init init_misc_binfmt(void)
>  	int err = register_filesystem(&bm_fs_type);
>  	if (!err)
>  		insert_binfmt(&misc_format);
> +	register_sysctl_empty_subdir("fs", "binfmt_misc");
>  	return err;

Nit: let's make the dir before registering the filesystem. I can't
imagine a realistic situation where userspace is reacting so fast it
would actually fail to mount the fs on /proc/sys/fs/binfmt_misc, but why
risk it?

-Kees

>  }
>  
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 460532cd5ac8..7714e7b476c2 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -3042,13 +3042,6 @@ static struct ctl_table fs_table[] = {
>  		.extra1		= SYSCTL_ZERO,
>  		.extra2		= SYSCTL_TWO,
>  	},
> -#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
> -	{
> -		.procname	= "binfmt_misc",
> -		.mode		= 0555,
> -		.child		= sysctl_mount_point,
> -	},
> -#endif
>  	{
>  		.procname	= "pipe-max-size",
>  		.data		= &pipe_max_size,
> -- 
> 2.26.2
> 

-- 
Kees Cook

^ permalink raw reply

* Re: [PATCH 12/13] sysctl: add helper to register empty subdir
From: Kees Cook @ 2020-05-29  8:15 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: jack, rafael, airlied, amir73il, clemens, dri-devel, joseph.qi,
	sfr, mark, rdna, yzaikin, joonas.lahtinen, arnd, intel-gfx,
	jani.nikula, julia.lawall, jlbec, rodrigo.vivi, nixiaoming,
	vbabka, axboe, tytso, gregkh, linux-kernel, ebiederm, daniel,
	akpm, linuxppc-dev, ocfs2-devel, viro
In-Reply-To: <20200529074108.16928-13-mcgrof@kernel.org>

On Fri, May 29, 2020 at 07:41:07AM +0000, Luis Chamberlain wrote:
> The way to create a subdirectory from the base set of directories
> is a bit obscure, so provide a helper which makes this clear, and
> also helps remove boiler plate code required to do this work.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

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

-- 
Kees Cook

^ permalink raw reply

* Re: [PATCH 06/13] ocfs2: use new sysctl subdir helper register_sysctl_subdir()
From: Kees Cook @ 2020-05-29  8:23 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: jack, rafael, airlied, amir73il, clemens, dri-devel, joseph.qi,
	sfr, mark, rdna, yzaikin, joonas.lahtinen, arnd, intel-gfx,
	jani.nikula, julia.lawall, jlbec, rodrigo.vivi, nixiaoming,
	vbabka, axboe, tytso, gregkh, linux-kernel, ebiederm, daniel,
	akpm, linuxppc-dev, ocfs2-devel, viro
In-Reply-To: <20200529074108.16928-7-mcgrof@kernel.org>

On Fri, May 29, 2020 at 07:41:01AM +0000, Luis Chamberlain wrote:
> This simplifies the code considerably. The following coccinelle
> SmPL grammar rule was used to transform this code.
> 
> // pycocci sysctl-subdir.cocci fs/ocfs2/stackglue.c
> 
> @c1@
> expression E1;
> identifier subdir, sysctls;
> @@
> 
> static struct ctl_table subdir[] = {
> 	{
> 		.procname = E1,
> 		.maxlen = 0,
> 		.mode = 0555,
> 		.child = sysctls,
> 	},
> 	{ }
> };
> 
> @c2@
> identifier c1.subdir;
> 
> expression E2;
> identifier base;
> @@
> 
> static struct ctl_table base[] = {
> 	{
> 		.procname = E2,
> 		.maxlen = 0,
> 		.mode = 0555,
> 		.child = subdir,
> 	},
> 	{ }
> };
> 
> @c3@
> identifier c2.base;
> identifier header;
> @@
> 
> header = register_sysctl_table(base);
> 
> @r1 depends on c1 && c2 && c3@
> expression c1.E1;
> identifier c1.subdir, c1.sysctls;
> @@
> 
> -static struct ctl_table subdir[] = {
> -	{
> -		.procname = E1,
> -		.maxlen = 0,
> -		.mode = 0555,
> -		.child = sysctls,
> -	},
> -	{ }
> -};
> 
> @r2 depends on c1 && c2 && c3@
> identifier c1.subdir;
> 
> expression c2.E2;
> identifier c2.base;
> @@
> -static struct ctl_table base[] = {
> -	{
> -		.procname = E2,
> -		.maxlen = 0,
> -		.mode = 0555,
> -		.child = subdir,
> -	},
> -	{ }
> -};
> 
> @r3 depends on c1 && c2 && c3@
> expression c1.E1;
> identifier c1.sysctls;
> expression c2.E2;
> identifier c2.base;
> identifier c3.header;
> @@
> 
> header =
> -register_sysctl_table(base);
> +register_sysctl_subdir(E2, E1, sysctls);
> 
> Generated-by: Coccinelle SmPL
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  fs/ocfs2/stackglue.c | 27 ++++-----------------------
>  1 file changed, 4 insertions(+), 23 deletions(-)
> 
> diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
> index a191094694c6..addafced7f59 100644
> --- a/fs/ocfs2/stackglue.c
> +++ b/fs/ocfs2/stackglue.c
> @@ -677,28 +677,8 @@ static struct ctl_table ocfs2_mod_table[] = {
>  	},
>  	{ }
>  };
> -
> -static struct ctl_table ocfs2_kern_table[] = {
> -	{
> -		.procname	= "ocfs2",
> -		.data		= NULL,
> -		.maxlen		= 0,
> -		.mode		= 0555,
> -		.child		= ocfs2_mod_table
> -	},
> -	{ }
> -};
> -
> -static struct ctl_table ocfs2_root_table[] = {
> -	{
> -		.procname	= "fs",
> -		.data		= NULL,
> -		.maxlen		= 0,
> -		.mode		= 0555,
> -		.child		= ocfs2_kern_table
> -	},
> -	{ }
> -};
> +	.data		= NULL,
> +	.data		= NULL,

The conversion script doesn't like the .data field assignments. ;)

Was this series built with allmodconfig? I would have expected this to
blow up very badly. :)

-- 
Kees Cook

^ permalink raw reply

* Re: [PATCH] powerpc/64/syscall: Disable sanitisers for C syscall entry/exit code
From: Andrew Donnellan @ 2020-05-29  8:24 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev, npiggin
In-Reply-To: <20200529061446.2773-1-dja@axtens.net>

On 29/5/20 4:14 pm, Daniel Axtens wrote:
> syzkaller is picking up a bunch of crashes that look like this:
> 
> Unrecoverable exception 380 at c00000000037ed60 (msr=8000000000001031)
> Oops: Unrecoverable exception, sig: 6 [#1]
> LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
> Modules linked in:
> CPU: 0 PID: 874 Comm: syz-executor.0 Not tainted 5.7.0-rc7-syzkaller-00016-gb0c3ba31be3e #0
> NIP:  c00000000037ed60 LR: c00000000004bac8 CTR: c000000000030990
> REGS: c0000000555a7230 TRAP: 0380   Not tainted  (5.7.0-rc7-syzkaller-00016-gb0c3ba31be3e)
> MSR:  8000000000001031 <SF,ME,IR,DR,LE>  CR: 48222882  XER: 20000000
> CFAR: c00000000004bac4 IRQMASK: 0
> GPR00: c00000000004bb68 c0000000555a74c0 c0000000024b3500 0000000000000005
> GPR04: 0000000000000000 0000000000000000 c00000000004bb88 c008000000910000
> GPR08: 00000000000b0000 c00000000004bac8 0000000000016000 c000000002503500
> GPR12: c000000000030990 c000000003190000 00000000106a5898 00000000106a0000
> GPR16: 00000000106a5890 c000000007a92000 c000000008180e00 c000000007a8f700
> GPR20: c000000007a904b0 0000000010110000 c00000000259d318 5deadbeef0000100
> GPR24: 5deadbeef0000122 c000000078422700 c000000009ee88b8 c000000078422778
> GPR28: 0000000000000001 800000000280b033 0000000000000000 c0000000555a75a0
> NIP [c00000000037ed60] __sanitizer_cov_trace_pc+0x40/0x50
> LR [c00000000004bac8] interrupt_exit_kernel_prepare+0x118/0x310
> Call Trace:
> [c0000000555a74c0] [c00000000004bb68] interrupt_exit_kernel_prepare+0x1b8/0x310 (unreliable)
> [c0000000555a7530] [c00000000000f9a8] interrupt_return+0x118/0x1c0
> --- interrupt: 900 at __sanitizer_cov_trace_pc+0x0/0x50
> ...<random previous call chain>...
> 
> That looks like the KCOV helper accessing memory that's not safe to
> access in the interrupt handling context.
> 
> Do not instrument the new syscall entry/exit code with KCOV, GCOV or
> UBSAN.
> 
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Fixes: 68b34588e202 ("powerpc/64/sycall: Implement syscall entry/exit logic in C")
> Signed-off-by: Daniel Axtens <dja@axtens.net>

This seems reasonable - I've verified that this does indeed suppress the 
kcov trace calls.

Acked-by: Andrew Donnellan <ajd@linux.ibm.com>

(does this need to be tagged for stable? the Fixes: commit is in 5.6 but 
we're at 5.7-rc7 at this point...)

-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd@linux.ibm.com             IBM Australia Limited

^ permalink raw reply

* Re: [RFC PATCH 1/2] libnvdimm: Add prctl control for disabling synchronous fault support.
From: Michal Suchánek @ 2020-05-29  9:33 UTC (permalink / raw)
  To: jack; +Cc: linux-nvdimm, oohall, Aneesh Kumar K.V, dan.j.williams,
	linuxppc-dev
In-Reply-To: <20200529054141.156384-1-aneesh.kumar@linux.ibm.com>

Adding Jan

On Fri, May 29, 2020 at 11:11:39AM +0530, Aneesh Kumar K.V wrote:
> With POWER10, architecture is adding new pmem flush and sync instructions.
> The kernel should prevent the usage of MAP_SYNC if applications are not using
> the new instructions on newer hardware.
> 
> This patch adds a prctl option MAP_SYNC_ENABLE that can be used to enable
> the usage of MAP_SYNC. The kernel config option is added to allow the user
> to control whether MAP_SYNC should be enabled by default or not.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>  include/linux/sched/coredump.h | 13 ++++++++++---
>  include/uapi/linux/prctl.h     |  3 +++
>  kernel/fork.c                  |  8 +++++++-
>  kernel/sys.c                   | 18 ++++++++++++++++++
>  mm/Kconfig                     |  3 +++
>  mm/mmap.c                      |  4 ++++
>  6 files changed, 45 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/sched/coredump.h b/include/linux/sched/coredump.h
> index ecdc6542070f..9ba6b3d5f991 100644
> --- a/include/linux/sched/coredump.h
> +++ b/include/linux/sched/coredump.h
> @@ -72,9 +72,16 @@ static inline int get_dumpable(struct mm_struct *mm)
>  #define MMF_DISABLE_THP		24	/* disable THP for all VMAs */
>  #define MMF_OOM_VICTIM		25	/* mm is the oom victim */
>  #define MMF_OOM_REAP_QUEUED	26	/* mm was queued for oom_reaper */
> -#define MMF_DISABLE_THP_MASK	(1 << MMF_DISABLE_THP)
> +#define MMF_DISABLE_MAP_SYNC	27	/* disable THP for all VMAs */
> +#define MMF_DISABLE_THP_MASK		(1 << MMF_DISABLE_THP)
> +#define MMF_DISABLE_MAP_SYNC_MASK	(1 << MMF_DISABLE_MAP_SYNC)
>  
> -#define MMF_INIT_MASK		(MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK |\
> -				 MMF_DISABLE_THP_MASK)
> +#define MMF_INIT_MASK		(MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK | \
> +			MMF_DISABLE_THP_MASK | MMF_DISABLE_MAP_SYNC_MASK)
> +
> +static inline bool map_sync_enabled(struct mm_struct *mm)
> +{
> +	return !(mm->flags & MMF_DISABLE_MAP_SYNC_MASK);
> +}
>  
>  #endif /* _LINUX_SCHED_COREDUMP_H */
> diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h
> index 07b4f8131e36..ee4cde32d5cf 100644
> --- a/include/uapi/linux/prctl.h
> +++ b/include/uapi/linux/prctl.h
> @@ -238,4 +238,7 @@ struct prctl_mm_map {
>  #define PR_SET_IO_FLUSHER		57
>  #define PR_GET_IO_FLUSHER		58
>  
> +#define PR_SET_MAP_SYNC_ENABLE		59
> +#define PR_GET_MAP_SYNC_ENABLE		60
> +
>  #endif /* _LINUX_PRCTL_H */
> diff --git a/kernel/fork.c b/kernel/fork.c
> index 8c700f881d92..d5a9a363e81e 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -963,6 +963,12 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);
>  
>  static unsigned long default_dump_filter = MMF_DUMP_FILTER_DEFAULT;
>  
> +#ifdef CONFIG_ARCH_MAP_SYNC_DISABLE
> +unsigned long default_map_sync_mask = MMF_DISABLE_MAP_SYNC_MASK;
> +#else
> +unsigned long default_map_sync_mask = 0;
> +#endif
> +
>  static int __init coredump_filter_setup(char *s)
>  {
>  	default_dump_filter =
> @@ -1039,7 +1045,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
>  		mm->flags = current->mm->flags & MMF_INIT_MASK;
>  		mm->def_flags = current->mm->def_flags & VM_INIT_DEF_MASK;
>  	} else {
> -		mm->flags = default_dump_filter;
> +		mm->flags = default_dump_filter | default_map_sync_mask;
>  		mm->def_flags = 0;
>  	}
>  
> diff --git a/kernel/sys.c b/kernel/sys.c
> index d325f3ab624a..f6127cf4128b 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -2450,6 +2450,24 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
>  			clear_bit(MMF_DISABLE_THP, &me->mm->flags);
>  		up_write(&me->mm->mmap_sem);
>  		break;
> +
> +	case PR_GET_MAP_SYNC_ENABLE:
> +		if (arg2 || arg3 || arg4 || arg5)
> +			return -EINVAL;
> +		error = !test_bit(MMF_DISABLE_MAP_SYNC, &me->mm->flags);
> +		break;
> +	case PR_SET_MAP_SYNC_ENABLE:
> +		if (arg3 || arg4 || arg5)
> +			return -EINVAL;
> +		if (down_write_killable(&me->mm->mmap_sem))
> +			return -EINTR;
> +		if (arg2)
> +			clear_bit(MMF_DISABLE_MAP_SYNC, &me->mm->flags);
> +		else
> +			set_bit(MMF_DISABLE_MAP_SYNC, &me->mm->flags);
> +		up_write(&me->mm->mmap_sem);
> +		break;
> +
>  	case PR_MPX_ENABLE_MANAGEMENT:
>  	case PR_MPX_DISABLE_MANAGEMENT:
>  		/* No longer implemented: */
> diff --git a/mm/Kconfig b/mm/Kconfig
> index c1acc34c1c35..38fd7cfbfca8 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -867,4 +867,7 @@ config ARCH_HAS_HUGEPD
>  config MAPPING_DIRTY_HELPERS
>          bool
>  
> +config ARCH_MAP_SYNC_DISABLE
> +	bool
> +
>  endmenu
> diff --git a/mm/mmap.c b/mm/mmap.c
> index f609e9ec4a25..613e5894f178 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1464,6 +1464,10 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
>  		case MAP_SHARED_VALIDATE:
>  			if (flags & ~flags_mask)
>  				return -EOPNOTSUPP;
> +
> +			if ((flags & MAP_SYNC)  && !map_sync_enabled(mm))
> +				return -EOPNOTSUPP;
> +
>  			if (prot & PROT_WRITE) {
>  				if (!(file->f_mode & FMODE_WRITE))
>  					return -EACCES;
> -- 
> 2.26.2
> 

^ permalink raw reply

* Re: [RFC PATCH 1/2] libnvdimm: Add prctl control for disabling synchronous fault support.
From: Aneesh Kumar K.V @ 2020-05-29  9:37 UTC (permalink / raw)
  To: Michal Suchánek, jack
  Cc: linux-nvdimm, Jeff Moyer, oohall, dan.j.williams, linuxppc-dev
In-Reply-To: <20200529093310.GL25173@kitsune.suse.cz>

Hi,


Thanks Michal. I also missed Jeff in this email thread.

-aneesh

On 5/29/20 3:03 PM, Michal Suchánek wrote:
> Adding Jan
> 
> On Fri, May 29, 2020 at 11:11:39AM +0530, Aneesh Kumar K.V wrote:
>> With POWER10, architecture is adding new pmem flush and sync instructions.
>> The kernel should prevent the usage of MAP_SYNC if applications are not using
>> the new instructions on newer hardware.
>>
>> This patch adds a prctl option MAP_SYNC_ENABLE that can be used to enable
>> the usage of MAP_SYNC. The kernel config option is added to allow the user
>> to control whether MAP_SYNC should be enabled by default or not.
>>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>>   include/linux/sched/coredump.h | 13 ++++++++++---
>>   include/uapi/linux/prctl.h     |  3 +++
>>   kernel/fork.c                  |  8 +++++++-
>>   kernel/sys.c                   | 18 ++++++++++++++++++
>>   mm/Kconfig                     |  3 +++
>>   mm/mmap.c                      |  4 ++++
>>   6 files changed, 45 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/linux/sched/coredump.h b/include/linux/sched/coredump.h
>> index ecdc6542070f..9ba6b3d5f991 100644
>> --- a/include/linux/sched/coredump.h
>> +++ b/include/linux/sched/coredump.h
>> @@ -72,9 +72,16 @@ static inline int get_dumpable(struct mm_struct *mm)
>>   #define MMF_DISABLE_THP		24	/* disable THP for all VMAs */
>>   #define MMF_OOM_VICTIM		25	/* mm is the oom victim */
>>   #define MMF_OOM_REAP_QUEUED	26	/* mm was queued for oom_reaper */
>> -#define MMF_DISABLE_THP_MASK	(1 << MMF_DISABLE_THP)
>> +#define MMF_DISABLE_MAP_SYNC	27	/* disable THP for all VMAs */
>> +#define MMF_DISABLE_THP_MASK		(1 << MMF_DISABLE_THP)
>> +#define MMF_DISABLE_MAP_SYNC_MASK	(1 << MMF_DISABLE_MAP_SYNC)
>>   
>> -#define MMF_INIT_MASK		(MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK |\
>> -				 MMF_DISABLE_THP_MASK)
>> +#define MMF_INIT_MASK		(MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK | \
>> +			MMF_DISABLE_THP_MASK | MMF_DISABLE_MAP_SYNC_MASK)
>> +
>> +static inline bool map_sync_enabled(struct mm_struct *mm)
>> +{
>> +	return !(mm->flags & MMF_DISABLE_MAP_SYNC_MASK);
>> +}
>>   
>>   #endif /* _LINUX_SCHED_COREDUMP_H */
>> diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h
>> index 07b4f8131e36..ee4cde32d5cf 100644
>> --- a/include/uapi/linux/prctl.h
>> +++ b/include/uapi/linux/prctl.h
>> @@ -238,4 +238,7 @@ struct prctl_mm_map {
>>   #define PR_SET_IO_FLUSHER		57
>>   #define PR_GET_IO_FLUSHER		58
>>   
>> +#define PR_SET_MAP_SYNC_ENABLE		59
>> +#define PR_GET_MAP_SYNC_ENABLE		60
>> +
>>   #endif /* _LINUX_PRCTL_H */
>> diff --git a/kernel/fork.c b/kernel/fork.c
>> index 8c700f881d92..d5a9a363e81e 100644
>> --- a/kernel/fork.c
>> +++ b/kernel/fork.c
>> @@ -963,6 +963,12 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);
>>   
>>   static unsigned long default_dump_filter = MMF_DUMP_FILTER_DEFAULT;
>>   
>> +#ifdef CONFIG_ARCH_MAP_SYNC_DISABLE
>> +unsigned long default_map_sync_mask = MMF_DISABLE_MAP_SYNC_MASK;
>> +#else
>> +unsigned long default_map_sync_mask = 0;
>> +#endif
>> +
>>   static int __init coredump_filter_setup(char *s)
>>   {
>>   	default_dump_filter =
>> @@ -1039,7 +1045,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
>>   		mm->flags = current->mm->flags & MMF_INIT_MASK;
>>   		mm->def_flags = current->mm->def_flags & VM_INIT_DEF_MASK;
>>   	} else {
>> -		mm->flags = default_dump_filter;
>> +		mm->flags = default_dump_filter | default_map_sync_mask;
>>   		mm->def_flags = 0;
>>   	}
>>   
>> diff --git a/kernel/sys.c b/kernel/sys.c
>> index d325f3ab624a..f6127cf4128b 100644
>> --- a/kernel/sys.c
>> +++ b/kernel/sys.c
>> @@ -2450,6 +2450,24 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
>>   			clear_bit(MMF_DISABLE_THP, &me->mm->flags);
>>   		up_write(&me->mm->mmap_sem);
>>   		break;
>> +
>> +	case PR_GET_MAP_SYNC_ENABLE:
>> +		if (arg2 || arg3 || arg4 || arg5)
>> +			return -EINVAL;
>> +		error = !test_bit(MMF_DISABLE_MAP_SYNC, &me->mm->flags);
>> +		break;
>> +	case PR_SET_MAP_SYNC_ENABLE:
>> +		if (arg3 || arg4 || arg5)
>> +			return -EINVAL;
>> +		if (down_write_killable(&me->mm->mmap_sem))
>> +			return -EINTR;
>> +		if (arg2)
>> +			clear_bit(MMF_DISABLE_MAP_SYNC, &me->mm->flags);
>> +		else
>> +			set_bit(MMF_DISABLE_MAP_SYNC, &me->mm->flags);
>> +		up_write(&me->mm->mmap_sem);
>> +		break;
>> +
>>   	case PR_MPX_ENABLE_MANAGEMENT:
>>   	case PR_MPX_DISABLE_MANAGEMENT:
>>   		/* No longer implemented: */
>> diff --git a/mm/Kconfig b/mm/Kconfig
>> index c1acc34c1c35..38fd7cfbfca8 100644
>> --- a/mm/Kconfig
>> +++ b/mm/Kconfig
>> @@ -867,4 +867,7 @@ config ARCH_HAS_HUGEPD
>>   config MAPPING_DIRTY_HELPERS
>>           bool
>>   
>> +config ARCH_MAP_SYNC_DISABLE
>> +	bool
>> +
>>   endmenu
>> diff --git a/mm/mmap.c b/mm/mmap.c
>> index f609e9ec4a25..613e5894f178 100644
>> --- a/mm/mmap.c
>> +++ b/mm/mmap.c
>> @@ -1464,6 +1464,10 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
>>   		case MAP_SHARED_VALIDATE:
>>   			if (flags & ~flags_mask)
>>   				return -EOPNOTSUPP;
>> +
>> +			if ((flags & MAP_SYNC)  && !map_sync_enabled(mm))
>> +				return -EOPNOTSUPP;
>> +
>>   			if (prot & PROT_WRITE) {
>>   				if (!(file->f_mode & FMODE_WRITE))
>>   					return -EACCES;
>> -- 
>> 2.26.2
>>


^ permalink raw reply

* Re: [PATCH v4 6/7] KVM: MIPS: clean up redundant 'kvm_run' parameters
From: Paolo Bonzini @ 2020-05-29  9:48 UTC (permalink / raw)
  To: Tianjia Zhang, Huacai Chen
  Cc: wanpengli, kvm, david, heiko.carstens, Peter Xu, open list:MIPS,
	hpa, kvmarm, linux-s390, frankja, Marc Zyngier, joro, x86,
	borntraeger, mingo, julien.thierry.kdev, thuth, gor,
	suzuki.poulose, kvm-ppc, Borislav Petkov, Thomas Gleixner,
	linux-arm-kernel, jmattson, Thomas Bogendoerfer, cohuck,
	christoffer.dall, sean.j.christopherson, LKML, james.morse,
	vkuznets, linuxppc-dev
In-Reply-To: <37246a25-c4dc-7757-3f5c-d46870a4f186@linux.alibaba.com>

On 27/05/20 08:24, Tianjia Zhang wrote:
>>>
>>>
> 
> Hi Huacai,
> 
> These two patches(6/7 and 7/7) should be merged into the tree of the
> mips architecture separately. At present, there seems to be no good way
> to merge the whole architecture patchs.
> 
> For this series of patches, some architectures have been merged, some
> need to update the patch.

Hi Tianjia, I will take care of this during the merge window.

Thanks,

Paolo


^ permalink raw reply

* Re: [RFC PATCH 1/2] libnvdimm: Add prctl control for disabling synchronous fault support.
From: Jan Kara @ 2020-05-29  9:52 UTC (permalink / raw)
  To: Aneesh Kumar K.V
  Cc: linux-nvdimm, jack, Jeff Moyer, oohall, dan.j.williams,
	Michal Suchánek, linuxppc-dev
In-Reply-To: <6183cf4a-d134-99e5-936e-ef35f530c2ec@linux.ibm.com>

Hi!

On Fri 29-05-20 15:07:31, Aneesh Kumar K.V wrote:
> Thanks Michal. I also missed Jeff in this email thread.

And I think you'll also need some of the sched maintainers for the prctl
bits...

> On 5/29/20 3:03 PM, Michal Suchánek wrote:
> > Adding Jan
> > 
> > On Fri, May 29, 2020 at 11:11:39AM +0530, Aneesh Kumar K.V wrote:
> > > With POWER10, architecture is adding new pmem flush and sync instructions.
> > > The kernel should prevent the usage of MAP_SYNC if applications are not using
> > > the new instructions on newer hardware.
> > > 
> > > This patch adds a prctl option MAP_SYNC_ENABLE that can be used to enable
> > > the usage of MAP_SYNC. The kernel config option is added to allow the user
> > > to control whether MAP_SYNC should be enabled by default or not.
> > > 
> > > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
...
> > > diff --git a/kernel/fork.c b/kernel/fork.c
> > > index 8c700f881d92..d5a9a363e81e 100644
> > > --- a/kernel/fork.c
> > > +++ b/kernel/fork.c
> > > @@ -963,6 +963,12 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);
> > >   static unsigned long default_dump_filter = MMF_DUMP_FILTER_DEFAULT;
> > > +#ifdef CONFIG_ARCH_MAP_SYNC_DISABLE
> > > +unsigned long default_map_sync_mask = MMF_DISABLE_MAP_SYNC_MASK;
> > > +#else
> > > +unsigned long default_map_sync_mask = 0;
> > > +#endif
> > > +

I'm not sure CONFIG is really the right approach here. For a distro that would
basically mean to disable MAP_SYNC for all PPC kernels unless application
explicitly uses the right prctl. Shouldn't we rather initialize
default_map_sync_mask on boot based on whether the CPU we run on requires
new flush instructions or not? Otherwise the patch looks sensible.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply

* Re: [PATCH 09/13] firmware_loader: simplify sysctl declaration with register_sysctl_subdir()
From: Greg KH @ 2020-05-29 10:26 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: jack, rafael, airlied, amir73il, clemens, dri-devel, joseph.qi,
	sfr, mark, rdna, yzaikin, joonas.lahtinen, keescook, arnd,
	intel-gfx, jani.nikula, julia.lawall, jlbec, rodrigo.vivi,
	nixiaoming, vbabka, axboe, tytso, linux-kernel, ebiederm, daniel,
	akpm, linuxppc-dev, ocfs2-devel, viro
In-Reply-To: <20200529074108.16928-10-mcgrof@kernel.org>

On Fri, May 29, 2020 at 07:41:04AM +0000, Luis Chamberlain wrote:
> From: Xiaoming Ni <nixiaoming@huawei.com>
> 
> Move the firmware config sysctl table to fallback_table.c and use the
> new register_sysctl_subdir() helper. This removes the clutter from
> kernel/sysctl.c.
> 
> Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  drivers/base/firmware_loader/fallback.c       |  4 ++++
>  drivers/base/firmware_loader/fallback.h       | 11 ++++++++++
>  drivers/base/firmware_loader/fallback_table.c | 22 +++++++++++++++++--
>  include/linux/sysctl.h                        |  1 -
>  kernel/sysctl.c                               |  7 ------
>  5 files changed, 35 insertions(+), 10 deletions(-)

So it now takes more lines than the old stuff?  :(

> 
> diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c
> index d9ac7296205e..8190653ae9a3 100644
> --- a/drivers/base/firmware_loader/fallback.c
> +++ b/drivers/base/firmware_loader/fallback.c
> @@ -200,12 +200,16 @@ static struct class firmware_class = {
>  
>  int register_sysfs_loader(void)
>  {
> +	int ret = register_firmware_config_sysctl();
> +	if (ret != 0)
> +		return ret;

checkpatch :(

>  	return class_register(&firmware_class);

And if that fails?

>  }
>  
>  void unregister_sysfs_loader(void)
>  {
>  	class_unregister(&firmware_class);
> +	unregister_firmware_config_sysctl();
>  }
>  
>  static ssize_t firmware_loading_show(struct device *dev,
> diff --git a/drivers/base/firmware_loader/fallback.h b/drivers/base/firmware_loader/fallback.h
> index 06f4577733a8..7d2cb5f6ceb8 100644
> --- a/drivers/base/firmware_loader/fallback.h
> +++ b/drivers/base/firmware_loader/fallback.h
> @@ -42,6 +42,17 @@ void fw_fallback_set_default_timeout(void);
>  
>  int register_sysfs_loader(void);
>  void unregister_sysfs_loader(void);
> +#ifdef CONFIG_SYSCTL
> +extern int register_firmware_config_sysctl(void);
> +extern void unregister_firmware_config_sysctl(void);
> +#else
> +static inline int register_firmware_config_sysctl(void)
> +{
> +	return 0;
> +}
> +static inline void unregister_firmware_config_sysctl(void) { }
> +#endif /* CONFIG_SYSCTL */
> +
>  #else /* CONFIG_FW_LOADER_USER_HELPER */
>  static inline int firmware_fallback_sysfs(struct firmware *fw, const char *name,
>  					  struct device *device,
> diff --git a/drivers/base/firmware_loader/fallback_table.c b/drivers/base/firmware_loader/fallback_table.c
> index 46a731dede6f..4234aa5ee5df 100644
> --- a/drivers/base/firmware_loader/fallback_table.c
> +++ b/drivers/base/firmware_loader/fallback_table.c
> @@ -24,7 +24,7 @@ struct firmware_fallback_config fw_fallback_config = {
>  EXPORT_SYMBOL_NS_GPL(fw_fallback_config, FIRMWARE_LOADER_PRIVATE);
>  
>  #ifdef CONFIG_SYSCTL
> -struct ctl_table firmware_config_table[] = {
> +static struct ctl_table firmware_config_table[] = {
>  	{
>  		.procname	= "force_sysfs_fallback",
>  		.data		= &fw_fallback_config.force_sysfs_fallback,
> @@ -45,4 +45,22 @@ struct ctl_table firmware_config_table[] = {
>  	},
>  	{ }
>  };
> -#endif
> +
> +static struct ctl_table_header *hdr;
> +int register_firmware_config_sysctl(void)
> +{
> +	if (hdr)
> +		return -EEXIST;

How can hdr be set?

> +	hdr = register_sysctl_subdir("kernel", "firmware_config",
> +				     firmware_config_table);
> +	if (!hdr)
> +		return -ENOMEM;
> +	return 0;
> +}
> +
> +void unregister_firmware_config_sysctl(void)
> +{
> +	if (hdr)
> +		unregister_sysctl_table(hdr);

Why can't unregister_sysctl_table() take a null pointer value?

And what sets 'hdr' (worst name for a static variable) to NULL so that
it knows not to be unregistered again as it looks like
register_firmware_config_sysctl() could be called multiple times.

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH 11/13] random: simplify sysctl declaration with register_sysctl_subdir()
From: Greg KH @ 2020-05-29 10:26 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: jack, rafael, airlied, amir73il, clemens, dri-devel, joseph.qi,
	sfr, mark, rdna, yzaikin, joonas.lahtinen, keescook, arnd,
	intel-gfx, jani.nikula, julia.lawall, jlbec, rodrigo.vivi,
	nixiaoming, vbabka, axboe, tytso, linux-kernel, ebiederm, daniel,
	akpm, linuxppc-dev, ocfs2-devel, viro
In-Reply-To: <20200529074108.16928-12-mcgrof@kernel.org>

On Fri, May 29, 2020 at 07:41:06AM +0000, Luis Chamberlain wrote:
> From: Xiaoming Ni <nixiaoming@huawei.com>
> 
> Move random_table sysctl from kernel/sysctl.c to drivers/char/random.c
> and use register_sysctl_subdir() to help remove the clutter out of
> kernel/sysctl.c.
> 
> Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  drivers/char/random.c  | 14 ++++++++++++--
>  include/linux/sysctl.h |  1 -
>  kernel/sysctl.c        |  5 -----
>  3 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index a7cf6aa65908..73fd4b6e9c18 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -2101,8 +2101,7 @@ static int proc_do_entropy(struct ctl_table *table, int write,
>  }
>  
>  static int sysctl_poolsize = INPUT_POOL_WORDS * 32;
> -extern struct ctl_table random_table[];
> -struct ctl_table random_table[] = {
> +static struct ctl_table random_table[] = {
>  	{
>  		.procname	= "poolsize",
>  		.data		= &sysctl_poolsize,
> @@ -2164,6 +2163,17 @@ struct ctl_table random_table[] = {
>  #endif
>  	{ }
>  };
> +
> +/*
> + * rand_initialize() is called before sysctl_init(),
> + * so we cannot call register_sysctl_init() in rand_initialize()
> + */
> +static int __init random_sysctls_init(void)
> +{
> +	register_sysctl_subdir("kernel", "random", random_table);

No error checking?

:(


^ permalink raw reply

* Re: [RFC PATCH 1/2] libnvdimm: Add prctl control for disabling synchronous fault support.
From: Aneesh Kumar K.V @ 2020-05-29 10:55 UTC (permalink / raw)
  To: Jan Kara
  Cc: linux-nvdimm, jack, Jeff Moyer, oohall, dan.j.williams,
	Michal Suchánek, linuxppc-dev
In-Reply-To: <20200529095250.GP14550@quack2.suse.cz>

On 5/29/20 3:22 PM, Jan Kara wrote:
> Hi!
> 
> On Fri 29-05-20 15:07:31, Aneesh Kumar K.V wrote:
>> Thanks Michal. I also missed Jeff in this email thread.
> 
> And I think you'll also need some of the sched maintainers for the prctl
> bits...
> 
>> On 5/29/20 3:03 PM, Michal Suchánek wrote:
>>> Adding Jan
>>>
>>> On Fri, May 29, 2020 at 11:11:39AM +0530, Aneesh Kumar K.V wrote:
>>>> With POWER10, architecture is adding new pmem flush and sync instructions.
>>>> The kernel should prevent the usage of MAP_SYNC if applications are not using
>>>> the new instructions on newer hardware.
>>>>
>>>> This patch adds a prctl option MAP_SYNC_ENABLE that can be used to enable
>>>> the usage of MAP_SYNC. The kernel config option is added to allow the user
>>>> to control whether MAP_SYNC should be enabled by default or not.
>>>>
>>>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ...
>>>> diff --git a/kernel/fork.c b/kernel/fork.c
>>>> index 8c700f881d92..d5a9a363e81e 100644
>>>> --- a/kernel/fork.c
>>>> +++ b/kernel/fork.c
>>>> @@ -963,6 +963,12 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);
>>>>    static unsigned long default_dump_filter = MMF_DUMP_FILTER_DEFAULT;
>>>> +#ifdef CONFIG_ARCH_MAP_SYNC_DISABLE
>>>> +unsigned long default_map_sync_mask = MMF_DISABLE_MAP_SYNC_MASK;
>>>> +#else
>>>> +unsigned long default_map_sync_mask = 0;
>>>> +#endif
>>>> +
> 
> I'm not sure CONFIG is really the right approach here. For a distro that would
> basically mean to disable MAP_SYNC for all PPC kernels unless application
> explicitly uses the right prctl. Shouldn't we rather initialize
> default_map_sync_mask on boot based on whether the CPU we run on requires
> new flush instructions or not? Otherwise the patch looks sensible.
> 

yes that is correct. We ideally want to deny MAP_SYNC only w.r.t 
POWER10. But on a virtualized platform there is no easy way to detect 
that. We could ideally hook this into the nvdimm driver where we look at 
the new compat string ibm,persistent-memory-v2 and then disable MAP_SYNC
if we find a device with the specific value.

BTW with the recent changes I posted for the nvdimm driver, older kernel 
won't initialize persistent memory device on newer hardware. Newer 
hardware will present the device to OS with a different device tree 
compat string.

My expectation  w.r.t this patch was, Distro would want to  mark
CONFIG_ARCH_MAP_SYNC_DISABLE=n based on the different application 
certification.  Otherwise application will have to end up calling the 
prctl(MMF_DISABLE_MAP_SYNC, 0) any way. If that is the case, should this
be dependent on P10?

With that I am wondering should we even have this patch? Can we expect 
userspace get updated to use new instruction?.

With ppc64 we never had a real persistent memory device available for 
end user to try. The available persistent memory stack was using vPMEM 
which was presented as a volatile memory region for which there is no 
need to use any of the flush instructions. We could safely assume that 
as we get applications certified/verified for working with pmem device 
on ppc64, they would all be using the new instructions?


-aneesh




^ permalink raw reply

* Re: [PATCH] powerpc/64/syscall: Disable sanitisers for C syscall entry/exit code
From: Michael Ellerman @ 2020-05-29 11:14 UTC (permalink / raw)
  To: Andrew Donnellan, Daniel Axtens, linuxppc-dev, npiggin
In-Reply-To: <2fc6270d-9c63-32ab-8d32-66875f8e5d4f@linux.ibm.com>

Andrew Donnellan <ajd@linux.ibm.com> writes:
> On 29/5/20 4:14 pm, Daniel Axtens wrote:
>> syzkaller is picking up a bunch of crashes that look like this:
>> 
>> Unrecoverable exception 380 at c00000000037ed60 (msr=8000000000001031)
>> Oops: Unrecoverable exception, sig: 6 [#1]
>> LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
>> Modules linked in:
>> CPU: 0 PID: 874 Comm: syz-executor.0 Not tainted 5.7.0-rc7-syzkaller-00016-gb0c3ba31be3e #0
>> NIP:  c00000000037ed60 LR: c00000000004bac8 CTR: c000000000030990
>> REGS: c0000000555a7230 TRAP: 0380   Not tainted  (5.7.0-rc7-syzkaller-00016-gb0c3ba31be3e)
>> MSR:  8000000000001031 <SF,ME,IR,DR,LE>  CR: 48222882  XER: 20000000
>> CFAR: c00000000004bac4 IRQMASK: 0
>> GPR00: c00000000004bb68 c0000000555a74c0 c0000000024b3500 0000000000000005
>> GPR04: 0000000000000000 0000000000000000 c00000000004bb88 c008000000910000
>> GPR08: 00000000000b0000 c00000000004bac8 0000000000016000 c000000002503500
>> GPR12: c000000000030990 c000000003190000 00000000106a5898 00000000106a0000
>> GPR16: 00000000106a5890 c000000007a92000 c000000008180e00 c000000007a8f700
>> GPR20: c000000007a904b0 0000000010110000 c00000000259d318 5deadbeef0000100
>> GPR24: 5deadbeef0000122 c000000078422700 c000000009ee88b8 c000000078422778
>> GPR28: 0000000000000001 800000000280b033 0000000000000000 c0000000555a75a0
>> NIP [c00000000037ed60] __sanitizer_cov_trace_pc+0x40/0x50
>> LR [c00000000004bac8] interrupt_exit_kernel_prepare+0x118/0x310
>> Call Trace:
>> [c0000000555a74c0] [c00000000004bb68] interrupt_exit_kernel_prepare+0x1b8/0x310 (unreliable)
>> [c0000000555a7530] [c00000000000f9a8] interrupt_return+0x118/0x1c0
>> --- interrupt: 900 at __sanitizer_cov_trace_pc+0x0/0x50
>> ...<random previous call chain>...
>> 
>> That looks like the KCOV helper accessing memory that's not safe to
>> access in the interrupt handling context.
>> 
>> Do not instrument the new syscall entry/exit code with KCOV, GCOV or
>> UBSAN.
>> 
>> Cc: Nicholas Piggin <npiggin@gmail.com>
>> Fixes: 68b34588e202 ("powerpc/64/sycall: Implement syscall entry/exit logic in C")
>> Signed-off-by: Daniel Axtens <dja@axtens.net>
>
> This seems reasonable - I've verified that this does indeed suppress the 
> kcov trace calls.

Thanks.

> Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
>
> (does this need to be tagged for stable? the Fixes: commit is in 5.6 but 
> we're at 5.7-rc7 at this point...)

No. The Fixed commit is based on v5.6-rc2, but it didn't go in until v5.7-rc1:

  $ git describe --contains --match 'v*' 68b34588e202
  v5.7-rc1~35^2~46

I plan to send it to Linus before the v5.7 release.

cheers

^ permalink raw reply

* Re: [Intel-gfx] [PATCH 06/13] ocfs2: use new sysctl subdir helper register_sysctl_subdir()
From: Luis Chamberlain @ 2020-05-29 11:49 UTC (permalink / raw)
  To: Kees Cook
  Cc: jack, rafael, airlied, amir73il, clemens, dri-devel, joseph.qi,
	sfr, mark, rdna, yzaikin, arnd, intel-gfx, julia.lawall, jlbec,
	nixiaoming, vbabka, axboe, tytso, gregkh, linux-kernel, ebiederm,
	akpm, linuxppc-dev, ocfs2-devel, viro
In-Reply-To: <202005290121.C78B4AC@keescook>

On Fri, May 29, 2020 at 01:23:19AM -0700, Kees Cook wrote:
> On Fri, May 29, 2020 at 07:41:01AM +0000, Luis Chamberlain wrote:
> > This simplifies the code considerably. The following coccinelle
> > SmPL grammar rule was used to transform this code.
> > 
> > // pycocci sysctl-subdir.cocci fs/ocfs2/stackglue.c
> > 
> > @c1@
> > expression E1;
> > identifier subdir, sysctls;
> > @@
> > 
> > static struct ctl_table subdir[] = {
> > 	{
> > 		.procname = E1,
> > 		.maxlen = 0,
> > 		.mode = 0555,
> > 		.child = sysctls,
> > 	},
> > 	{ }
> > };
> > 
> > @c2@
> > identifier c1.subdir;
> > 
> > expression E2;
> > identifier base;
> > @@
> > 
> > static struct ctl_table base[] = {
> > 	{
> > 		.procname = E2,
> > 		.maxlen = 0,
> > 		.mode = 0555,
> > 		.child = subdir,
> > 	},
> > 	{ }
> > };
> > 
> > @c3@
> > identifier c2.base;
> > identifier header;
> > @@
> > 
> > header = register_sysctl_table(base);
> > 
> > @r1 depends on c1 && c2 && c3@
> > expression c1.E1;
> > identifier c1.subdir, c1.sysctls;
> > @@
> > 
> > -static struct ctl_table subdir[] = {
> > -	{
> > -		.procname = E1,
> > -		.maxlen = 0,
> > -		.mode = 0555,
> > -		.child = sysctls,
> > -	},
> > -	{ }
> > -};
> > 
> > @r2 depends on c1 && c2 && c3@
> > identifier c1.subdir;
> > 
> > expression c2.E2;
> > identifier c2.base;
> > @@
> > -static struct ctl_table base[] = {
> > -	{
> > -		.procname = E2,
> > -		.maxlen = 0,
> > -		.mode = 0555,
> > -		.child = subdir,
> > -	},
> > -	{ }
> > -};
> > 
> > @r3 depends on c1 && c2 && c3@
> > expression c1.E1;
> > identifier c1.sysctls;
> > expression c2.E2;
> > identifier c2.base;
> > identifier c3.header;
> > @@
> > 
> > header =
> > -register_sysctl_table(base);
> > +register_sysctl_subdir(E2, E1, sysctls);
> > 
> > Generated-by: Coccinelle SmPL
> > 
> > Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> > ---
> >  fs/ocfs2/stackglue.c | 27 ++++-----------------------
> >  1 file changed, 4 insertions(+), 23 deletions(-)
> > 
> > diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
> > index a191094694c6..addafced7f59 100644
> > --- a/fs/ocfs2/stackglue.c
> > +++ b/fs/ocfs2/stackglue.c
> > @@ -677,28 +677,8 @@ static struct ctl_table ocfs2_mod_table[] = {
> >  	},
> >  	{ }
> >  };
> > -
> > -static struct ctl_table ocfs2_kern_table[] = {
> > -	{
> > -		.procname	= "ocfs2",
> > -		.data		= NULL,
> > -		.maxlen		= 0,
> > -		.mode		= 0555,
> > -		.child		= ocfs2_mod_table
> > -	},
> > -	{ }
> > -};
> > -
> > -static struct ctl_table ocfs2_root_table[] = {
> > -	{
> > -		.procname	= "fs",
> > -		.data		= NULL,
> > -		.maxlen		= 0,
> > -		.mode		= 0555,
> > -		.child		= ocfs2_kern_table
> > -	},
> > -	{ }
> > -};
> > +	.data		= NULL,
> > +	.data		= NULL,
> 
> The conversion script doesn't like the .data field assignments. ;)
> 
> Was this series built with allmodconfig? I would have expected this to
> blow up very badly. :)

Yikes, sense, you're right. Nope, I left the random config tests to
0day. Will fix, thanks!

  Luis

^ permalink raw reply

* Re: [PATCH 09/13] firmware_loader: simplify sysctl declaration with register_sysctl_subdir()
From: Luis Chamberlain @ 2020-05-29 12:09 UTC (permalink / raw)
  To: Greg KH
  Cc: jack, rafael, airlied, amir73il, clemens, dri-devel, joseph.qi,
	sfr, mark, rdna, yzaikin, joonas.lahtinen, keescook, arnd,
	intel-gfx, jani.nikula, julia.lawall, jlbec, rodrigo.vivi,
	nixiaoming, vbabka, axboe, tytso, linux-kernel, ebiederm, daniel,
	akpm, linuxppc-dev, ocfs2-devel, viro
In-Reply-To: <20200529102613.GA1345939@kroah.com>

On Fri, May 29, 2020 at 12:26:13PM +0200, Greg KH wrote:
> On Fri, May 29, 2020 at 07:41:04AM +0000, Luis Chamberlain wrote:
> > From: Xiaoming Ni <nixiaoming@huawei.com>
> > 
> > Move the firmware config sysctl table to fallback_table.c and use the
> > new register_sysctl_subdir() helper. This removes the clutter from
> > kernel/sysctl.c.
> > 
> > Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
> > Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> > ---
> >  drivers/base/firmware_loader/fallback.c       |  4 ++++
> >  drivers/base/firmware_loader/fallback.h       | 11 ++++++++++
> >  drivers/base/firmware_loader/fallback_table.c | 22 +++++++++++++++++--
> >  include/linux/sysctl.h                        |  1 -
> >  kernel/sysctl.c                               |  7 ------
> >  5 files changed, 35 insertions(+), 10 deletions(-)
> 
> So it now takes more lines than the old stuff?  :(

Pretty much agreed with the other changes, thanks for the review!

But this diff-stat change, indeed, it is unfortunate that we end up
with more code here than before. We'll try to reduce it instead
somehow, however in some cases during this spring-cleaning, since
the goal is to move code from one file to another, it *may* require
more code. So it won't always be negative. But we'll try!

  Luis

^ permalink raw reply

* Re: [PATCH 09/13] firmware_loader: simplify sysctl declaration with register_sysctl_subdir()
From: Xiaoming Ni @ 2020-05-29 11:59 UTC (permalink / raw)
  To: Greg KH, Luis Chamberlain
  Cc: jack, rafael, airlied, amir73il, clemens, dri-devel, joseph.qi,
	sfr, mark, rdna, yzaikin, joonas.lahtinen, keescook, arnd,
	intel-gfx, jani.nikula, julia.lawall, jlbec, rodrigo.vivi, vbabka,
	axboe, tytso, linux-kernel, ebiederm, daniel, akpm, linuxppc-dev,
	ocfs2-devel, viro
In-Reply-To: <20200529102613.GA1345939@kroah.com>

On 2020/5/29 18:26, Greg KH wrote:
> On Fri, May 29, 2020 at 07:41:04AM +0000, Luis Chamberlain wrote:
>> From: Xiaoming Ni <nixiaoming@huawei.com>
>>
>> Move the firmware config sysctl table to fallback_table.c and use the
>> new register_sysctl_subdir() helper. This removes the clutter from
>> kernel/sysctl.c.
>>
>> Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
>> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
>> ---
>>   drivers/base/firmware_loader/fallback.c       |  4 ++++
>>   drivers/base/firmware_loader/fallback.h       | 11 ++++++++++
>>   drivers/base/firmware_loader/fallback_table.c | 22 +++++++++++++++++--
>>   include/linux/sysctl.h                        |  1 -
>>   kernel/sysctl.c                               |  7 ------
>>   5 files changed, 35 insertions(+), 10 deletions(-)
> 
> So it now takes more lines than the old stuff?  :(
> 
CONFIG_FW_LOADER = m
Before cleaning, no matter whether ko is loaded or not, the sysctl
interface will be created, but now we need to add register and
unregister interfaces, so the number of lines of code has increased

>>
>> diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c
>> index d9ac7296205e..8190653ae9a3 100644
>> --- a/drivers/base/firmware_loader/fallback.c
>> +++ b/drivers/base/firmware_loader/fallback.c
>> @@ -200,12 +200,16 @@ static struct class firmware_class = {
>>   
>>   int register_sysfs_loader(void)
>>   {
>> +	int ret = register_firmware_config_sysctl();
>> +	if (ret != 0)
>> +		return ret;
> 
> checkpatch :(
This is my fault,  thanks for your guidance

> 
>>   	return class_register(&firmware_class);
> 
> And if that fails?
> 
Yes, it is better to call register_firmware_config_sysctl() after 
class_register().
thanks for your guidance.


>>   }
>>   
>>   void unregister_sysfs_loader(void)
>>   {
>>   	class_unregister(&firmware_class);
>> +	unregister_firmware_config_sysctl();
>>   }
>>   
>>   static ssize_t firmware_loading_show(struct device *dev,
>> diff --git a/drivers/base/firmware_loader/fallback.h b/drivers/base/firmware_loader/fallback.h
>> index 06f4577733a8..7d2cb5f6ceb8 100644
>> --- a/drivers/base/firmware_loader/fallback.h
>> +++ b/drivers/base/firmware_loader/fallback.h
>> @@ -42,6 +42,17 @@ void fw_fallback_set_default_timeout(void);
>>   
>>   int register_sysfs_loader(void);
>>   void unregister_sysfs_loader(void);
>> +#ifdef CONFIG_SYSCTL
>> +extern int register_firmware_config_sysctl(void);
>> +extern void unregister_firmware_config_sysctl(void);
>> +#else
>> +static inline int register_firmware_config_sysctl(void)
>> +{
>> +	return 0;
>> +}
>> +static inline void unregister_firmware_config_sysctl(void) { }
>> +#endif /* CONFIG_SYSCTL */
>> +
>>   #else /* CONFIG_FW_LOADER_USER_HELPER */
>>   static inline int firmware_fallback_sysfs(struct firmware *fw, const char *name,
>>   					  struct device *device,
>> diff --git a/drivers/base/firmware_loader/fallback_table.c b/drivers/base/firmware_loader/fallback_table.c
>> index 46a731dede6f..4234aa5ee5df 100644
>> --- a/drivers/base/firmware_loader/fallback_table.c
>> +++ b/drivers/base/firmware_loader/fallback_table.c
>> @@ -24,7 +24,7 @@ struct firmware_fallback_config fw_fallback_config = {
>>   EXPORT_SYMBOL_NS_GPL(fw_fallback_config, FIRMWARE_LOADER_PRIVATE);
>>   
>>   #ifdef CONFIG_SYSCTL
>> -struct ctl_table firmware_config_table[] = {
>> +static struct ctl_table firmware_config_table[] = {
>>   	{
>>   		.procname	= "force_sysfs_fallback",
>>   		.data		= &fw_fallback_config.force_sysfs_fallback,
>> @@ -45,4 +45,22 @@ struct ctl_table firmware_config_table[] = {
>>   	},
>>   	{ }
>>   };
>> -#endif
>> +
>> +static struct ctl_table_header *hdr;
>> +int register_firmware_config_sysctl(void)
>> +{
>> +	if (hdr)
>> +		return -EEXIST;
> 
> How can hdr be set?
> 
It's my mistake, register_firmware_config_sysctl() is not exported,
there will be no repeated calls.
thanks for your guidance.

>> +	hdr = register_sysctl_subdir("kernel", "firmware_config",
>> +				     firmware_config_table);
>> +	if (!hdr)
>> +		return -ENOMEM;
>> +	return 0;
>> +}
>> +
>> +void unregister_firmware_config_sysctl(void)
>> +{
>> +	if (hdr)
>> +		unregister_sysctl_table(hdr);
> 
> Why can't unregister_sysctl_table() take a null pointer value?
Sorry, I didn't notice that the unregister_sysctl_table() already checks
the input parameters.
thanks for your guidance.


> And what sets 'hdr' (worst name for a static variable) to NULL so that
> it knows not to be unregistered again as it looks like
> register_firmware_config_sysctl() could be called multiple times.

How about renaming hdr to firmware_config_sysct_table_header?

+ if (hdr)
+ 	return -EEXIST;
After deleting this code in register_firmware_config_sysctl(), and 
considering register_firmware_config_sysctl() and 
unregister_firmware_config_sysctl() are not exported, whether there is
no need to add  "hdr = NULL;" ?

Thanks
Xiaoming Ni





^ permalink raw reply

* Re: [PATCH 01/13] sysctl: add new register_sysctl_subdir() helper
From: Luis Chamberlain @ 2020-05-29 12:16 UTC (permalink / raw)
  To: Jani Nikula
  Cc: jack, rafael, airlied, amir73il, clemens, dri-devel, joseph.qi,
	sfr, mark, rdna, yzaikin, joonas.lahtinen, keescook, arnd,
	intel-gfx, julia.lawall, jlbec, rodrigo.vivi, nixiaoming, vbabka,
	axboe, tytso, gregkh, linux-kernel, ebiederm, daniel, akpm,
	linuxppc-dev, ocfs2-devel, viro
In-Reply-To: <87d06n17mm.fsf@intel.com>

On Fri, May 29, 2020 at 11:13:21AM +0300, Jani Nikula wrote:
> On Fri, 29 May 2020, Luis Chamberlain <mcgrof@kernel.org> wrote:
> > Often enough all we need to do is create a subdirectory so that
> > we can stuff sysctls underneath it. However, *if* that directory
> > was already created early on the boot sequence we really have no
> > need to use the full boiler plate code for it, we can just use
> > local variables to help us guide sysctl to place the new leaf files.
> 
> I find it hard to figure out the lifetime requirements for the tables
> passed in; when it's okay to use local variables and when you need
> longer lifetimes. It's not documented, everyone appears to be using
> static tables for this. It's far from obvious.

I agree 2000% that it is not obvious. What made me consider it was that
I *knew* that the base directory would already exist, so it wouldn't
make sense for the code to rely on earlier parts of a table if part
of the hierarchy already existed.

In fact, a *huge* part of the due dilligence on this and futre series
on this cleanup will be to be 100% sure that the base path is already
created. And so this use is obviously dangerous, you just *need* to
know that the base path is created before.

Non-posted changes also deal with link order to help address this
in other places, given that link order controls how *initcalls()
(early_initcall(), late_initcall(), etc) are ordered if you have
multiple of these.

I had a link order series long ago which augmented our ability to make
things clearer at a link order. Eventually I believe this will become
more important, specially as we end up wanting to async more code.

For now, we can only rely on manual code inspection for ensuring
proper ordering. Part of the implicit aspects of this cleanup is
to slowly make these things clearer for each base path.

So... the "fs" base path will actually end up being created in
fs/sysctl.c after we are *fully* done with the fs sysctl cleanups.

  Luis

^ permalink raw reply

* Re: [PATCH 11/13] random: simplify sysctl declaration with register_sysctl_subdir()
From: Xiaoming Ni @ 2020-05-29 12:09 UTC (permalink / raw)
  To: Greg KH, Luis Chamberlain
  Cc: jack, rafael, airlied, amir73il, clemens, dri-devel, joseph.qi,
	sfr, mark, rdna, yzaikin, joonas.lahtinen, keescook, arnd,
	intel-gfx, jani.nikula, julia.lawall, jlbec, rodrigo.vivi, vbabka,
	axboe, tytso, linux-kernel, ebiederm, daniel, akpm, linuxppc-dev,
	ocfs2-devel, viro
In-Reply-To: <20200529102644.GB1345939@kroah.com>

On 2020/5/29 18:26, Greg KH wrote:
> On Fri, May 29, 2020 at 07:41:06AM +0000, Luis Chamberlain wrote:
>> From: Xiaoming Ni <nixiaoming@huawei.com>
>>
>> Move random_table sysctl from kernel/sysctl.c to drivers/char/random.c
>> and use register_sysctl_subdir() to help remove the clutter out of
>> kernel/sysctl.c.
>>
>> Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
>> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
>> ---
>>   drivers/char/random.c  | 14 ++++++++++++--
>>   include/linux/sysctl.h |  1 -
>>   kernel/sysctl.c        |  5 -----
>>   3 files changed, 12 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/char/random.c b/drivers/char/random.c
>> index a7cf6aa65908..73fd4b6e9c18 100644
>> --- a/drivers/char/random.c
>> +++ b/drivers/char/random.c
>> @@ -2101,8 +2101,7 @@ static int proc_do_entropy(struct ctl_table *table, int write,
>>   }
>>   
>>   static int sysctl_poolsize = INPUT_POOL_WORDS * 32;
>> -extern struct ctl_table random_table[];
>> -struct ctl_table random_table[] = {
>> +static struct ctl_table random_table[] = {
>>   	{
>>   		.procname	= "poolsize",
>>   		.data		= &sysctl_poolsize,
>> @@ -2164,6 +2163,17 @@ struct ctl_table random_table[] = {
>>   #endif
>>   	{ }
>>   };
>> +
>> +/*
>> + * rand_initialize() is called before sysctl_init(),
>> + * so we cannot call register_sysctl_init() in rand_initialize()
>> + */
>> +static int __init random_sysctls_init(void)
>> +{
>> +	register_sysctl_subdir("kernel", "random", random_table);
> 
> No error checking?
> 
> :(
It was my mistake, I forgot to add a comment here.
Same as the comment of register_sysctl_init(),
There is almost no failure here during the system initialization phase,
and failure in time does not affect the main function.

Thanks
Xiaoming Ni




^ permalink raw reply

* Re: [PATCH v3 2/3] riscv: Introduce CONFIG_RELOCATABLE
From: Anup Patel @ 2020-05-29 12:04 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: Albert Ou, Anup Patel, linux-kernel@vger.kernel.org List,
	Atish Patra, Paul Mackerras, Zong Li, Paul Walmsley,
	Palmer Dabbelt, linux-riscv, linuxppc-dev
In-Reply-To: <20200524085259.24784-3-alex@ghiti.fr>

On Sun, May 24, 2020 at 2:25 PM Alexandre Ghiti <alex@ghiti.fr> wrote:
>
> This config allows to compile the kernel as PIE and to relocate it at
> any virtual address at runtime: this paves the way to KASLR and to 4-level
> page table folding at runtime. Runtime relocation is possible since
> relocation metadata are embedded into the kernel.
>
> Note that relocating at runtime introduces an overhead even if the
> kernel is loaded at the same address it was linked at and that the compiler
> options are those used in arm64 which uses the same RELA relocation
> format.
>
> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
> ---
>  arch/riscv/Kconfig              | 12 +++++++
>  arch/riscv/Makefile             |  5 ++-
>  arch/riscv/kernel/vmlinux.lds.S |  6 ++--
>  arch/riscv/mm/Makefile          |  4 +++
>  arch/riscv/mm/init.c            | 63 +++++++++++++++++++++++++++++++++
>  5 files changed, 87 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index a31e1a41913a..93127d5913fe 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -170,6 +170,18 @@ config PGTABLE_LEVELS
>         default 3 if 64BIT
>         default 2
>
> +config RELOCATABLE
> +       bool
> +       depends on MMU
> +       help
> +          This builds a kernel as a Position Independent Executable (PIE),
> +          which retains all relocation metadata required to relocate the
> +          kernel binary at runtime to a different virtual address than the
> +          address it was linked at.
> +          Since RISCV uses the RELA relocation format, this requires a
> +          relocation pass at runtime even if the kernel is loaded at the
> +          same address it was linked at.
> +
>  source "arch/riscv/Kconfig.socs"
>
>  menu "Platform type"
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index fb6e37db836d..1406416ea743 100644
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@ -9,7 +9,10 @@
>  #
>
>  OBJCOPYFLAGS    := -O binary
> -LDFLAGS_vmlinux :=
> +ifeq ($(CONFIG_RELOCATABLE),y)
> +LDFLAGS_vmlinux := -shared -Bsymbolic -z notext -z norelro
> +KBUILD_CFLAGS += -fPIE
> +endif
>  ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
>         LDFLAGS_vmlinux := --no-relax
>  endif
> diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
> index a9abde62909f..e8ffba8c2044 100644
> --- a/arch/riscv/kernel/vmlinux.lds.S
> +++ b/arch/riscv/kernel/vmlinux.lds.S
> @@ -85,8 +85,10 @@ SECTIONS
>
>         BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
>
> -       .rel.dyn : {
> -               *(.rel.dyn*)
> +       .rela.dyn : ALIGN(8) {
> +               __rela_dyn_start = .;
> +               *(.rela .rela*)
> +               __rela_dyn_end = .;
>         }
>
>         _end = .;
> diff --git a/arch/riscv/mm/Makefile b/arch/riscv/mm/Makefile
> index 363ef01c30b1..dc5cdaa80bc1 100644
> --- a/arch/riscv/mm/Makefile
> +++ b/arch/riscv/mm/Makefile
> @@ -1,6 +1,10 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>
>  CFLAGS_init.o := -mcmodel=medany
> +ifdef CONFIG_RELOCATABLE
> +CFLAGS_init.o += -fno-pie
> +endif
> +
>  ifdef CONFIG_FTRACE
>  CFLAGS_REMOVE_init.o = -pg
>  endif
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 17f108baec4f..7074522d40c6 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -13,6 +13,9 @@
>  #include <linux/of_fdt.h>
>  #include <linux/libfdt.h>
>  #include <linux/set_memory.h>
> +#ifdef CONFIG_RELOCATABLE
> +#include <linux/elf.h>
> +#endif
>
>  #include <asm/fixmap.h>
>  #include <asm/tlbflush.h>
> @@ -379,6 +382,53 @@ static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size)
>  #error "setup_vm() is called from head.S before relocate so it should not use absolute addressing."
>  #endif
>
> +#ifdef CONFIG_RELOCATABLE
> +extern unsigned long __rela_dyn_start, __rela_dyn_end;
> +
> +#ifdef CONFIG_64BIT
> +#define Elf_Rela Elf64_Rela
> +#define Elf_Addr Elf64_Addr
> +#else
> +#define Elf_Rela Elf32_Rela
> +#define Elf_Addr Elf32_Addr
> +#endif
> +
> +void __init relocate_kernel(uintptr_t load_pa)
> +{
> +       Elf_Rela *rela = (Elf_Rela *)&__rela_dyn_start;
> +       /*
> +        * This holds the offset between the linked virtual address and the
> +        * relocated virtual address.
> +        */
> +       uintptr_t reloc_offset = kernel_virt_addr - KERNEL_LINK_ADDR;
> +       /*
> +        * This holds the offset between kernel linked virtual address and
> +        * physical address.
> +        */
> +       uintptr_t va_kernel_link_pa_offset = KERNEL_LINK_ADDR - load_pa;
> +
> +       for ( ; rela < (Elf_Rela *)&__rela_dyn_end; rela++) {
> +               Elf_Addr addr = (rela->r_offset - va_kernel_link_pa_offset);
> +               Elf_Addr relocated_addr = rela->r_addend;
> +
> +               if (rela->r_info != R_RISCV_RELATIVE)
> +                       continue;
> +
> +               /*
> +                * Make sure to not relocate vdso symbols like rt_sigreturn
> +                * which are linked from the address 0 in vmlinux since
> +                * vdso symbol addresses are actually used as an offset from
> +                * mm->context.vdso in VDSO_OFFSET macro.
> +                */
> +               if (relocated_addr >= KERNEL_LINK_ADDR)
> +                       relocated_addr += reloc_offset;
> +
> +               *(Elf_Addr *)addr = relocated_addr;
> +       }
> +}
> +
> +#endif
> +
>  static uintptr_t load_pa, load_sz;
>
>  void create_kernel_page_table(pgd_t *pgdir, uintptr_t map_size)
> @@ -405,6 +455,19 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
>
>         pfn_base = PFN_DOWN(load_pa);
>
> +#ifdef CONFIG_RELOCATABLE
> +#ifdef CONFIG_64BIT
> +       /*
> +        * Early page table uses only one PGDIR, which makes it possible
> +        * to map PGDIR_SIZE aligned on PGDIR_SIZE: if the relocation offset
> +        * makes the kernel cross over a PGDIR_SIZE boundary, raise a bug
> +        * since a part of the kernel would not get mapped.
> +        * This cannot happen on rv32 as we use the entire page directory level.
> +        */
> +       BUG_ON(PGDIR_SIZE - (kernel_virt_addr & (PGDIR_SIZE - 1)) < load_sz);
> +#endif
> +       relocate_kernel(load_pa);
> +#endif
>         /*
>          * Enforce boot alignment requirements of RV32 and
>          * RV64 by only allowing PMD or PGD mappings.
> --
> 2.20.1
>
>

Looks good to me as well.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

^ permalink raw reply

* Re: [PATCH v3 3/3] arch, scripts: Add script to check relocations at compile time
From: Anup Patel @ 2020-05-29 12:08 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: Albert Ou, Anup Patel, linux-kernel@vger.kernel.org List,
	Atish Patra, Paul Mackerras, Zong Li, Paul Walmsley,
	Palmer Dabbelt, linux-riscv, linuxppc-dev
In-Reply-To: <20200524085259.24784-4-alex@ghiti.fr>

On Sun, May 24, 2020 at 2:26 PM Alexandre Ghiti <alex@ghiti.fr> wrote:
>
> Relocating kernel at runtime is done very early in the boot process, so
> it is not convenient to check for relocations there and react in case a
> relocation was not expected.
>
> Powerpc architecture has a script that allows to check at compile time
> for such unexpected relocations: extract the common logic to scripts/
> and add arch specific scripts triggered at postlink.
>
> At the moment, powerpc and riscv architectures take advantage of this
> compile-time check.
>
> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
> ---
>  arch/powerpc/tools/relocs_check.sh | 18 ++-------------
>  arch/riscv/Makefile.postlink       | 36 ++++++++++++++++++++++++++++++
>  arch/riscv/tools/relocs_check.sh   | 26 +++++++++++++++++++++
>  scripts/relocs_check.sh            | 20 +++++++++++++++++
>  4 files changed, 84 insertions(+), 16 deletions(-)
>  create mode 100644 arch/riscv/Makefile.postlink
>  create mode 100755 arch/riscv/tools/relocs_check.sh
>  create mode 100755 scripts/relocs_check.sh

Maybe you should send the change arch/powerpc/tools/relocs_check.sh
as a separate patch so that it can be picked up by arch/powerpc maintainers.

>
> diff --git a/arch/powerpc/tools/relocs_check.sh b/arch/powerpc/tools/relocs_check.sh
> index 014e00e74d2b..e367895941ae 100755
> --- a/arch/powerpc/tools/relocs_check.sh
> +++ b/arch/powerpc/tools/relocs_check.sh
> @@ -15,21 +15,8 @@ if [ $# -lt 3 ]; then
>         exit 1
>  fi
>
> -# Have Kbuild supply the path to objdump and nm so we handle cross compilation.
> -objdump="$1"
> -nm="$2"
> -vmlinux="$3"
> -
> -# Remove from the bad relocations those that match an undefined weak symbol
> -# which will result in an absolute relocation to 0.
> -# Weak unresolved symbols are of that form in nm output:
> -# "                  w _binary__btf_vmlinux_bin_end"
> -undef_weak_symbols=$($nm "$vmlinux" | awk '$1 ~ /w/ { print $2 }')
> -
>  bad_relocs=$(
> -$objdump -R "$vmlinux" |
> -       # Only look at relocation lines.
> -       grep -E '\<R_' |
> +${srctree}/scripts/relocs_check.sh "$@" |
>         # These relocations are okay
>         # On PPC64:
>         #       R_PPC64_RELATIVE, R_PPC64_NONE
> @@ -43,8 +30,7 @@ R_PPC_ADDR16_LO
>  R_PPC_ADDR16_HI
>  R_PPC_ADDR16_HA
>  R_PPC_RELATIVE
> -R_PPC_NONE' |
> -       ([ "$undef_weak_symbols" ] && grep -F -w -v "$undef_weak_symbols" || cat)
> +R_PPC_NONE'
>  )
>
>  if [ -z "$bad_relocs" ]; then
> diff --git a/arch/riscv/Makefile.postlink b/arch/riscv/Makefile.postlink
> new file mode 100644
> index 000000000000..bf2b2bca1845
> --- /dev/null
> +++ b/arch/riscv/Makefile.postlink
> @@ -0,0 +1,36 @@
> +# SPDX-License-Identifier: GPL-2.0
> +# ===========================================================================
> +# Post-link riscv pass
> +# ===========================================================================
> +#
> +# Check that vmlinux relocations look sane
> +
> +PHONY := __archpost
> +__archpost:
> +
> +-include include/config/auto.conf
> +include scripts/Kbuild.include
> +
> +quiet_cmd_relocs_check = CHKREL  $@
> +cmd_relocs_check =                                                     \
> +       $(CONFIG_SHELL) $(srctree)/arch/riscv/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@"
> +
> +# `@true` prevents complaint when there is nothing to be done
> +
> +vmlinux: FORCE
> +       @true
> +ifdef CONFIG_RELOCATABLE
> +       $(call if_changed,relocs_check)
> +endif
> +
> +%.ko: FORCE
> +       @true
> +
> +clean:
> +       @true
> +
> +PHONY += FORCE clean
> +
> +FORCE:
> +
> +.PHONY: $(PHONY)
> diff --git a/arch/riscv/tools/relocs_check.sh b/arch/riscv/tools/relocs_check.sh
> new file mode 100755
> index 000000000000..baeb2e7b2290
> --- /dev/null
> +++ b/arch/riscv/tools/relocs_check.sh
> @@ -0,0 +1,26 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Based on powerpc relocs_check.sh
> +
> +# This script checks the relocations of a vmlinux for "suspicious"
> +# relocations.
> +
> +if [ $# -lt 3 ]; then
> +        echo "$0 [path to objdump] [path to nm] [path to vmlinux]" 1>&2
> +        exit 1
> +fi
> +
> +bad_relocs=$(
> +${srctree}/scripts/relocs_check.sh "$@" |
> +       # These relocations are okay
> +       #       R_RISCV_RELATIVE
> +       grep -F -w -v 'R_RISCV_RELATIVE'
> +)
> +
> +if [ -z "$bad_relocs" ]; then
> +       exit 0
> +fi
> +
> +num_bad=$(echo "$bad_relocs" | wc -l)
> +echo "WARNING: $num_bad bad relocations"
> +echo "$bad_relocs"
> diff --git a/scripts/relocs_check.sh b/scripts/relocs_check.sh
> new file mode 100755
> index 000000000000..137c660499f3
> --- /dev/null
> +++ b/scripts/relocs_check.sh
> @@ -0,0 +1,20 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +# Get a list of all the relocations, remove from it the relocations
> +# that are known to be legitimate and return this list to arch specific
> +# script that will look for suspicious relocations.
> +
> +objdump="$1"
> +nm="$2"
> +vmlinux="$3"
> +
> +# Remove from the possible bad relocations those that match an undefined
> +# weak symbol which will result in an absolute relocation to 0.
> +# Weak unresolved symbols are of that form in nm output:
> +# "                  w _binary__btf_vmlinux_bin_end"
> +undef_weak_symbols=$($nm "$vmlinux" | awk '$1 ~ /w/ { print $2 }')
> +
> +$objdump -R "$vmlinux" |
> +       grep -E '\<R_' |
> +       ([ "$undef_weak_symbols" ] && grep -F -w -v "$undef_weak_symbols" || cat)
> --
> 2.20.1
>

Otherwise, looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

^ permalink raw reply

* Re: [PATCH 01/13] sysctl: add new register_sysctl_subdir() helper
From: Eric W. Biederman @ 2020-05-29 12:40 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: jack, rafael, airlied, amir73il, clemens, dri-devel, joseph.qi,
	sfr, mark, rdna, yzaikin, joonas.lahtinen, keescook, arnd,
	intel-gfx, jani.nikula, julia.lawall, viro, rodrigo.vivi,
	nixiaoming, vbabka, axboe, tytso, gregkh, linux-kernel, daniel,
	akpm, linuxppc-dev, ocfs2-devel, jlbec
In-Reply-To: <20200529074108.16928-2-mcgrof@kernel.org>

Luis Chamberlain <mcgrof@kernel.org> writes:

> Often enough all we need to do is create a subdirectory so that
> we can stuff sysctls underneath it. However, *if* that directory
> was already created early on the boot sequence we really have no
> need to use the full boiler plate code for it, we can just use
> local variables to help us guide sysctl to place the new leaf files.
>
> So use a helper to do precisely this.

Reset restart.  This is patch is total nonsense.

- You are using register_sysctl_table which as I believe I have
  mentioned is a deprecated compatibility wrapper.  The point of
  spring house cleaning is to get off of the deprecated functions
  isn't it?

- You are using the old nasty form for creating directories instead
  of just passing in a path.

- None of this is even remotely necessary.  The directories
  are created automatically if you just register their entries.

Eric

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox