lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 10 Feb 2022 14:00:48 +0000
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     "mcgrof@...nel.org" <mcgrof@...nel.org>,
        Aaron Tomlin <atomlin@...mlin.com>
CC:     "cl@...ux.com" <cl@...ux.com>,
        "pmladek@...e.com" <pmladek@...e.com>,
        "mbenes@...e.cz" <mbenes@...e.cz>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "jeyu@...nel.org" <jeyu@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-modules@...r.kernel.org" <linux-modules@...r.kernel.org>,
        "live-patching@...r.kernel.org" <live-patching@...r.kernel.org>,
        "atomlin@...mlin.com" <atomlin@...mlin.com>,
        "ghalat@...hat.com" <ghalat@...hat.com>,
        "allen.lkml@...il.com" <allen.lkml@...il.com>,
        "void@...ifault.com" <void@...ifault.com>,
        "joe@...ches.com" <joe@...ches.com>,
        "msuchanek@...e.de" <msuchanek@...e.de>,
        "oleksandr@...alenko.name" <oleksandr@...alenko.name>
Subject: Re: [PATCH v5 11/13] module: Move sysfs support into a separate file



Le 09/02/2022 à 18:11, Aaron Tomlin a écrit :
> No functional change.
> 
> This patch migrates module sysfs support out of core code into
> kernel/module/sysfs.c. In addition simple code refactoring to
> make this possible.
> 
> Signed-off-by: Aaron Tomlin <atomlin@...hat.com>
> ---
>   kernel/module/Makefile   |   1 +
>   kernel/module/internal.h |  24 ++
>   kernel/module/main.c     | 458 +--------------------------------------
>   kernel/module/sysfs.c    | 425 ++++++++++++++++++++++++++++++++++++
>   4 files changed, 453 insertions(+), 455 deletions(-)
>   create mode 100644 kernel/module/sysfs.c

Checkpatch:

	total: 0 errors, 2 warnings, 10 checks, 946 lines checked


> 
> diff --git a/kernel/module/Makefile b/kernel/module/Makefile
> index c6be08060252..c30141c37eb3 100644
> --- a/kernel/module/Makefile
> +++ b/kernel/module/Makefile
> @@ -14,4 +14,5 @@ obj-$(CONFIG_STRICT_MODULE_RWX) += strict_rwx.o
>   obj-$(CONFIG_DEBUG_KMEMLEAK) += debug_kmemleak.o
>   obj-$(CONFIG_KALLSYMS) += kallsyms.o
>   obj-$(CONFIG_PROC_FS) += procfs.o
> +obj-$(CONFIG_SYSFS) += sysfs.o
>   endif
> diff --git a/kernel/module/internal.h b/kernel/module/internal.h
> index b67ce836746a..52d30bf6d6b0 100644
> --- a/kernel/module/internal.h
> +++ b/kernel/module/internal.h
> @@ -35,6 +35,9 @@
>   extern struct mutex module_mutex;
>   extern struct list_head modules;
>   
> +extern struct module_attribute *modinfo_attrs[];
> +extern size_t modinfo_attrs_count;

Can't this come in sysfs.c as well ?

> +
>   /* Provided by the linker */
>   extern const struct kernel_symbol __start___ksymtab[];
>   extern const struct kernel_symbol __stop___ksymtab[];
> @@ -206,3 +209,24 @@ static inline char *find_kallsyms_symbol(struct module *mod, unsigned long addr,
>   	return NULL;
>   }
>   #endif /* CONFIG_KALLSYMS */
> +
> +#ifdef CONFIG_SYSFS
> +int mod_sysfs_setup(struct module *mod, const struct load_info *info,
> +			   struct kernel_param *kparam, unsigned int num_params);
> +void mod_sysfs_fini(struct module *mod);
> +void module_remove_modinfo_attrs(struct module *mod, int end);
> +void del_usage_links(struct module *mod);
> +void init_param_lock(struct module *mod);

Why don't we move mod_sysfs_teardown() here as well ?

It looks strange to move mod_sysfs_setup() and not mod_sysfs_teardown()

> +#else /* !CONFIG_SYSFS */
> +static int mod_sysfs_setup(struct module *mod,
> +			   const struct load_info *info,
> +			   struct kernel_param *kparam,
> +			   unsigned int num_params)
> +{
> +	return 0;
> +}
> +static inline void mod_sysfs_fini(struct module *mod) { }
> +static inline void module_remove_modinfo_attrs(struct module *mod, int end) { }
> +static inline void del_usage_links(struct module *mod) { }
> +static inline void init_param_lock(struct module *mod) { }
> +#endif /* CONFIG_SYSFS */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ