All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Luis Chamberlain <mcgrof@kernel.org>,
	Aaron Tomlin <atomlin@redhat.com>,
	Michal Suchanek <msuchanek@suse.de>
Cc: "cl@linux.com" <cl@linux.com>,
	"pmladek@suse.com" <pmladek@suse.com>,
	"mbenes@suse.cz" <mbenes@suse.cz>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"jeyu@kernel.org" <jeyu@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>,
	"live-patching@vger.kernel.org" <live-patching@vger.kernel.org>,
	"atomlin@atomlin.com" <atomlin@atomlin.com>,
	"ghalat@redhat.com" <ghalat@redhat.com>,
	"allen.lkml@gmail.com" <allen.lkml@gmail.com>,
	"void@manifault.com" <void@manifault.com>,
	"joe@perches.com" <joe@perches.com>
Subject: Re: [RFC PATCH v4 00/13] module: core code clean up
Date: Thu, 3 Feb 2022 07:48:11 +0000	[thread overview]
Message-ID: <30f0da92-17b0-4130-20d1-9fea8b81cdbc@csgroup.eu> (raw)
In-Reply-To: <Yfsf2SGELhQ71Ovo@bombadil.infradead.org>


Le 03/02/2022 à 01:20, Luis Chamberlain a écrit :
> On Sun, Jan 30, 2022 at 09:32:01PM +0000, Aaron Tomlin wrote:
>> Hi Luis,
>>
>> As per your suggestion [1], this is an attempt to refactor and split
>> optional code out of core module support code into separate components.
>> This version is based on branch mcgrof/modules-next since a97ac8cb24a3/or
>> modules-5.17-rc1. Please let me know your thoughts.
>>
>> Changes since v1 [2]:
> 
> Thanks for all this work Aaron! Can you drop the RFC prefix,
> rebase onto linus' latest tree (as he already merged my
> modules-next, so his tree is more up to date), and submit again?
> 
> I'll then apply this to my modules-next, and then ask Christophe to
> rebase on top of that.
> 
> Michal, you'd be up next if you want to go through modules-next.
> 
> Aaron, please Cc Christophe and Michal on your next respin.
> 

I went quickly through v4. That's a great and useful job I think, it 
should ease future work on modules. So I will be happy to apply my 
changes on top of this series.

I may have more comments after reviewing in more details and rebasing my 
series on top of it, but at the time being I have at least one comment:

All function prototypes in header files are pointlessly prepended with 
'extern' keyword. This was done that way in the old days, but has been 
deprecated as this keyword does nothing on function prototypes but adds 
visual pollution when looking at the files.

See below the output of checkpatch on internal.h

Regardless, I'm looking forward to rebasing my series on top of yours.

Thanks
Christophe

WARNING: Use #include <linux/module.h> instead of <asm/module.h>
#10: FILE: kernel/module/internal.h:10:
+#include <asm/module.h>

CHECK: spaces preferred around that '-' (ctx:VxV)
#18: FILE: kernel/module/internal.h:18:
+#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
                                                 ^

CHECK: extern prototypes should be avoided in .h files
#84: FILE: kernel/module/internal.h:84:
+extern int mod_verify_sig(const void *mod, struct load_info *info);

CHECK: extern prototypes should be avoided in .h files
#85: FILE: kernel/module/internal.h:85:
+extern int try_to_force_load(struct module *mod, const char *reason);

CHECK: extern prototypes should be avoided in .h files
#86: FILE: kernel/module/internal.h:86:
+extern bool find_symbol(struct find_symbol_arg *fsa);

CHECK: extern prototypes should be avoided in .h files
#87: FILE: kernel/module/internal.h:87:
+extern struct module *find_module_all(const char *name, size_t len, 
bool even_unformed);

CHECK: extern prototypes should be avoided in .h files
#88: FILE: kernel/module/internal.h:88:
+extern unsigned long kernel_symbol_value(const struct kernel_symbol *sym);

CHECK: extern prototypes should be avoided in .h files
#89: FILE: kernel/module/internal.h:89:
+extern int cmp_name(const void *name, const void *sym);

CHECK: extern prototypes should be avoided in .h files
#90: FILE: kernel/module/internal.h:90:
+extern long get_offset(struct module *mod, unsigned int *size, Elf_Shdr 
*sechdr,

CHECK: extern prototypes should be avoided in .h files
#92: FILE: kernel/module/internal.h:92:
+extern char *module_flags(struct module *mod, char *buf);

CHECK: extern prototypes should be avoided in .h files
#95: FILE: kernel/module/internal.h:95:
+extern int copy_module_elf(struct module *mod, struct load_info *info);

CHECK: extern prototypes should be avoided in .h files
#96: FILE: kernel/module/internal.h:96:
+extern void free_module_elf(struct module *mod);

CHECK: Please use a blank line after function/struct/union/enum declarations
#102: FILE: kernel/module/internal.h:102:
+}
+static inline void free_module_elf(struct module *mod) { }

CHECK: Please use a blank line after function/struct/union/enum declarations
#114: FILE: kernel/module/internal.h:114:
+}
+static inline void module_decompress_cleanup(struct load_info *info)

CHECK: extern prototypes should be avoided in .h files
#128: FILE: kernel/module/internal.h:128:
+extern void mod_tree_insert(struct module *mod);

CHECK: extern prototypes should be avoided in .h files
#129: FILE: kernel/module/internal.h:129:
+extern void mod_tree_remove_init(struct module *mod);

CHECK: extern prototypes should be avoided in .h files
#130: FILE: kernel/module/internal.h:130:
+extern void mod_tree_remove(struct module *mod);

CHECK: extern prototypes should be avoided in .h files
#131: FILE: kernel/module/internal.h:131:
+extern struct module *mod_find(unsigned long addr);

ERROR: do not initialise statics to 0
#133: FILE: kernel/module/internal.h:133:
+static unsigned long module_addr_min = -1UL, module_addr_max = 0;

CHECK: extern prototypes should be avoided in .h files
#153: FILE: kernel/module/internal.h:153:
+extern int module_sig_check(struct load_info *info, int flags);

CHECK: extern prototypes should be avoided in .h files
#162: FILE: kernel/module/internal.h:162:
+extern void kmemleak_load_module(const struct module *mod, const struct 
load_info *info);

CHECK: extern prototypes should be avoided in .h files
#170: FILE: kernel/module/internal.h:170:
+extern void init_build_id(struct module *mod, const struct load_info 
*info);

CHECK: extern prototypes should be avoided in .h files
#175: FILE: kernel/module/internal.h:175:
+extern void layout_symtab(struct module *mod, struct load_info *info);

CHECK: extern prototypes should be avoided in .h files
#176: FILE: kernel/module/internal.h:176:
+extern void add_kallsyms(struct module *mod, const struct load_info *info);

CHECK: extern prototypes should be avoided in .h files
#177: FILE: kernel/module/internal.h:177:
+extern bool sect_empty(const Elf_Shdr *sect);

CHECK: extern prototypes should be avoided in .h files
#178: FILE: kernel/module/internal.h:178:
+extern const char *find_kallsyms_symbol(struct module *mod, unsigned 
long addr,

CHECK: extern prototypes should be avoided in .h files
#191: FILE: kernel/module/internal.h:191:
+extern int mod_sysfs_setup(struct module *mod, const struct load_info 
*info,

CHECK: extern prototypes should be avoided in .h files
#193: FILE: kernel/module/internal.h:193:
+extern void mod_sysfs_fini(struct module *mod);

CHECK: extern prototypes should be avoided in .h files
#194: FILE: kernel/module/internal.h:194:
+extern void module_remove_modinfo_attrs(struct module *mod, int end);

CHECK: extern prototypes should be avoided in .h files
#195: FILE: kernel/module/internal.h:195:
+extern void del_usage_links(struct module *mod);

CHECK: extern prototypes should be avoided in .h files
#196: FILE: kernel/module/internal.h:196:
+extern void init_param_lock(struct module *mod);

CHECK: Please use a blank line after function/struct/union/enum declarations
#205: FILE: kernel/module/internal.h:205:
+}
+static inline void mod_sysfs_fini(struct module *mod) { }

CHECK: extern prototypes should be avoided in .h files
#212: FILE: kernel/module/internal.h:212:
+extern int check_version(const struct load_info *info,

CHECK: extern prototypes should be avoided in .h files
#214: FILE: kernel/module/internal.h:214:
+extern int check_modstruct_version(const struct load_info *info, struct 
module *mod);

CHECK: extern prototypes should be avoided in .h files
#215: FILE: kernel/module/internal.h:215:
+extern int same_magic(const char *amagic, const char *bmagic, bool 
has_crcs);

CHECK: Alignment should match open parenthesis
#232: FILE: kernel/module/internal.h:232:
+static inline int same_magic(const char *amagic, const char *bmagic,
+			    bool has_crcs)

total: 1 errors, 1 warnings, 34 checks, 236 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
       mechanically convert to the typical style using --fix or 
--fix-inplace.

kernel/module/internal.h has style problems, please review.

NOTE: If any of the errors are false positives, please report
       them to the maintainer, see CHECKPATCH in MAINTAINERS.

  reply	other threads:[~2022-02-03  7:48 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-30 21:32 [RFC PATCH v4 00/13] module: core code clean up Aaron Tomlin
2022-01-30 21:32 ` [RFC PATCH v4 01/13] module: Move all into module/ Aaron Tomlin
2022-01-30 21:32 ` [RFC PATCH v4 02/13] module: Simple refactor in preparation for split Aaron Tomlin
2022-01-30 21:32 ` [RFC PATCH v4 03/13] module: Move livepatch support to a separate file Aaron Tomlin
2022-01-30 23:50   ` kernel test robot
2022-02-08 11:42   ` Petr Mladek
2022-02-08 15:18     ` Aaron Tomlin
2022-01-30 21:32 ` [RFC PATCH v4 04/13] module: Move latched RB-tree " Aaron Tomlin
2022-01-30 21:32 ` [RFC PATCH v4 05/13] module: Move arch strict rwx " Aaron Tomlin
2022-01-30 23:50   ` kernel test robot
2022-01-30 21:32 ` [RFC PATCH v4 06/13] module: Move " Aaron Tomlin
2022-01-31  0:30   ` kernel test robot
2022-01-30 21:32 ` [RFC PATCH v4 07/13] module: Move extra signature support out of core code Aaron Tomlin
2022-02-09 14:28   ` Miroslav Benes
2022-02-09 14:37     ` Aaron Tomlin
2022-01-30 21:32 ` [RFC PATCH v4 08/13] module: Move kmemleak support to a separate file Aaron Tomlin
2022-01-30 21:32 ` [RFC PATCH v4 09/13] module: Move kallsyms support into " Aaron Tomlin
2022-01-30 21:32 ` [RFC PATCH v4 10/13] module: Move procfs " Aaron Tomlin
2022-01-30 21:32 ` [RFC PATCH v4 11/13] module: Move sysfs " Aaron Tomlin
2022-01-30 21:32 ` [RFC PATCH v4 12/13] module: Move kdb_modules list out of core code Aaron Tomlin
2022-01-30 21:32 ` [RFC PATCH v4 13/13] module: Move version support into a separate file Aaron Tomlin
2022-01-31  0:41   ` kernel test robot
2022-02-01 16:44 ` [RFC PATCH v4 00/13] module: core code clean up Allen
2022-02-05 20:33   ` Aaron Tomlin
2022-02-02  2:44 ` Luis Chamberlain
2022-02-06 14:40   ` Aaron Tomlin
2022-02-03  0:20 ` Luis Chamberlain
2022-02-03  7:48   ` Christophe Leroy [this message]
2022-02-06 14:45     ` Aaron Tomlin
2022-02-03 18:01   ` Christophe Leroy
2022-02-06 16:54     ` Aaron Tomlin
2022-02-07 16:46     ` Aaron Tomlin
2022-02-07 17:17       ` Christophe Leroy
2022-02-07 18:01         ` Aaron Tomlin
2022-02-08  7:50           ` Christophe Leroy
2022-02-08 10:05             ` Aaron Tomlin
2022-02-03 18:15   ` Christophe Leroy
2022-02-06 16:57     ` Aaron Tomlin
2022-02-03 19:43   ` Michal Suchánek
2022-02-03 20:13     ` Luis Chamberlain
2022-02-03 20:10   ` Luis Chamberlain
2022-02-06 17:00     ` Aaron Tomlin
2022-02-06 14:42   ` Aaron Tomlin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30f0da92-17b0-4130-20d1-9fea8b81cdbc@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=akpm@linux-foundation.org \
    --cc=allen.lkml@gmail.com \
    --cc=atomlin@atomlin.com \
    --cc=atomlin@redhat.com \
    --cc=cl@linux.com \
    --cc=ghalat@redhat.com \
    --cc=jeyu@kernel.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mcgrof@kernel.org \
    --cc=msuchanek@suse.de \
    --cc=pmladek@suse.com \
    --cc=void@manifault.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.