[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f40fd2b2-2038-a53b-23ec-8f63941a2103@csgroup.eu>
Date: Thu, 10 Feb 2022 11:18:58 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Aaron Tomlin <atomlin@...hat.com>,
"mcgrof@...nel.org" <mcgrof@...nel.org>
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 02/13] module: Simple refactor in preparation for split
Le 09/02/2022 à 18:03, Aaron Tomlin a écrit :
> No functional change.
>
> This patch makes it possible to move non-essential code
> out of core module code.
>
> Signed-off-by: Aaron Tomlin <atomlin@...hat.com>
> ---
> kernel/module/internal.h | 22 ++++++++++++++++++++++
> kernel/module/main.c | 23 ++---------------------
> 2 files changed, 24 insertions(+), 21 deletions(-)
>
> diff --git a/kernel/module/internal.h b/kernel/module/internal.h
> index c49896368f7f..1a4b33ce9f5f 100644
> --- a/kernel/module/internal.h
> +++ b/kernel/module/internal.h
> @@ -7,6 +7,28 @@
>
> #include <linux/elf.h>
> #include <asm/module.h>
> +#include <linux/mutex.h>
> +
> +#ifndef ARCH_SHF_SMALL
> +#define ARCH_SHF_SMALL 0
> +#endif
> +
> +/* If this is set, the section belongs in the init part of the module */
> +#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
> +/* Maximum number of characters written by module_flags() */
> +#define MODULE_FLAGS_BUF_SIZE (TAINT_FLAGS_COUNT + 4)
> +#define MODULE_SECT_READ_SIZE (3 /* "0x", "\n" */ + (BITS_PER_LONG / 4))
This is used only in sysfs.c, why move it to internal.h ?
> +
> +extern struct mutex module_mutex;
> +extern struct list_head modules;
> +
> +/* Provided by the linker */
> +extern const struct kernel_symbol __start___ksymtab[];
> +extern const struct kernel_symbol __stop___ksymtab[];
> +extern const struct kernel_symbol __start___ksymtab_gpl[];
> +extern const struct kernel_symbol __stop___ksymtab_gpl[];
> +extern const s32 __start___kcrctab[];
> +extern const s32 __start___kcrctab_gpl[];
>
> struct load_info {
> const char *name;
> diff --git a/kernel/module/main.c b/kernel/module/main.c
> index 34a2b0cf3c3e..750e3ad28679 100644
> --- a/kernel/module/main.c
> +++ b/kernel/module/main.c
> @@ -63,10 +63,6 @@
> #define CREATE_TRACE_POINTS
> #include <trace/events/module.h>
>
> -#ifndef ARCH_SHF_SMALL
> -#define ARCH_SHF_SMALL 0
> -#endif
> -
> /*
> * Modules' sections will be aligned on page boundaries
> * to ensure complete separation of code and data, but
> @@ -78,9 +74,6 @@
> # define debug_align(X) (X)
> #endif
>
> -/* If this is set, the section belongs in the init part of the module */
> -#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
> -
> /*
> * Mutex protects:
> * 1) List of modules (also safely readable with preempt_disable),
> @@ -88,8 +81,8 @@
> * 3) module_addr_min/module_addr_max.
> * (delete and add uses RCU list operations).
> */
> -static DEFINE_MUTEX(module_mutex);
> -static LIST_HEAD(modules);
> +DEFINE_MUTEX(module_mutex);
> +LIST_HEAD(modules);
>
> /* Work queue for freeing init sections in success case */
> static void do_free_init(struct work_struct *w);
> @@ -408,14 +401,6 @@ static __maybe_unused void *any_section_objs(const struct load_info *info,
> return (void *)info->sechdrs[sec].sh_addr;
> }
>
> -/* Provided by the linker */
> -extern const struct kernel_symbol __start___ksymtab[];
> -extern const struct kernel_symbol __stop___ksymtab[];
> -extern const struct kernel_symbol __start___ksymtab_gpl[];
> -extern const struct kernel_symbol __stop___ksymtab_gpl[];
> -extern const s32 __start___kcrctab[];
> -extern const s32 __start___kcrctab_gpl[];
> -
> #ifndef CONFIG_MODVERSIONS
> #define symversion(base, idx) NULL
> #else
> @@ -1490,7 +1475,6 @@ struct module_sect_attrs {
> struct module_sect_attr attrs[];
> };
>
> -#define MODULE_SECT_READ_SIZE (3 /* "0x", "\n" */ + (BITS_PER_LONG / 4))
This is used only in sysfs.c, why move it to internal.h ?
> static ssize_t module_sect_read(struct file *file, struct kobject *kobj,
> struct bin_attribute *battr,
> char *buf, loff_t pos, size_t count)
> @@ -4542,9 +4526,6 @@ static void cfi_cleanup(struct module *mod)
> #endif
> }
>
> -/* Maximum number of characters written by module_flags() */
> -#define MODULE_FLAGS_BUF_SIZE (TAINT_FLAGS_COUNT + 4)
> -
> /* Keep in sync with MODULE_FLAGS_BUF_SIZE !!! */
> static char *module_flags(struct module *mod, char *buf)
> {
Powered by blists - more mailing lists