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]
Message-ID: <23862652-a702-4a5d-b804-db9ee9f6f539@linux.dev>
Date: Mon, 29 Jul 2024 09:46:17 +0800
From: Youling Tang <youling.tang@...ux.dev>
To: Christoph Hellwig <hch@...radead.org>, Theodore Ts'o <tytso@....edu>,
 David Sterba <dsterba@...e.cz>, Arnd Bergmann <arnd@...db.de>
Cc: kreijack@...ind.it, Luis Chamberlain <mcgrof@...nel.org>,
 Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
 David Sterba <dsterba@...e.com>, Andreas Dilger <adilger.kernel@...ger.ca>,
 Jaegeuk Kim <jaegeuk@...nel.org>, Chao Yu <chao@...nel.org>,
 Linux-Arch <linux-arch@...r.kernel.org>, linux-kernel@...r.kernel.org,
 linux-modules@...r.kernel.org, linux-btrfs@...r.kernel.org,
 linux-ext4@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net,
 Youling Tang <tangyouling@...inos.cn>
Subject: Re: [PATCH 1/4] module: Add module_subinit{_noexit} and
 module_subeixt helper macros

On 27/07/2024 22:52, Theodore Ts'o wrote:
> On Fri, Jul 26, 2024 at 11:09:02AM -0700, Christoph Hellwig wrote:
>> On Fri, Jul 26, 2024 at 01:58:00PM -0400, Theodore Ts'o wrote:
>>> Yeah, that's my reaction as well.  This only saves 50 lines of code in
>>> ext4, and that includes unrelated changes such as getting rid of "int
>>> i" and putting the declaration into the for loop --- "for (int i =
>>> ...").  Sure, that saves two lines of code, but yay?
>>>
>>> If the ordering how the functions gets called is based on the magic
>>> ordering in the Makefile, I'm not sure this actually makes the code
>>> clearer, more robust, and easier to maintain for the long term.
>> So you two object to kernel initcalls for the same reason and would
>> rather go back to calling everything explicitly?
> I don't oject to kernel initcalls which don't have any
> interdependencies and where ordering doesn't matter.
1. Previous version implementation: array mode (see link 1) :
    Advantages:
    - Few changes, simple principle, easy to understand code.
    Disadvantages:
    - Each modified module needs to maintain an array, more code.

2. Current implementation: explicit call subinit in initcall (see link 2) :
    Advantages:
    - Direct use of helpes macros, the subinit call sequence is
      intuitive, and the implementation is relatively simple.
    Disadvantages:
    - helper macros need to be implemented compared to array mode.

3. Only one module_subinit per file (not implemented, see link 3) :
    Advantage:
    - No need to display to call subinit.
    Disadvantages:
    - Magic order based on Makefile makes code more fragile,
    - Make sure that each file has only one module_subinit,
    - It is not intuitive to know which subinits the module needs
      and in what order (grep and Makefile are required),
    - With multiple subinits per module, it would be difficult to
      define module_{subinit, subexit} by MODULE, and difficult to
      rollback when initialization fails (I haven't found a good way
      to do this yet).


Personally, I prefer the implementation of method two.

Links:
[1]: 
https://lore.kernel.org/all/20240711074859.366088-4-youling.tang@linux.dev/
[2]: 
https://lore.kernel.org/all/20240723083239.41533-2-youling.tang@linux.dev/
[3]: https://lore.kernel.org/all/ZqKreStOD-eRkKZU@infradead.org/

Thanks,
Youling.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ