linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Gomez <da.gomez@kernel.org>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org,
	Petr Pavlu <petr.pavlu@suse.com>
Subject: Re: [PATCH 1/2] module: Override -EEXISTS module return
Date: Sun, 16 Nov 2025 21:42:48 +0100	[thread overview]
Message-ID: <81b10186-767c-4904-b048-d88a73ff15b3@kernel.org> (raw)
In-Reply-To: <geqat2upyxwvqjsp4ietmeypf4gmeoerg6akstbvelnxe3zpl4@dzqhyolsvtvc>

On 10/11/2025 16.31, Lucas De Marchi wrote:
> On Mon, Nov 10, 2025 at 04:17:47PM +0100, Daniel Gomez wrote:
>> On 13/10/2025 18.26, Lucas De Marchi wrote:
>>> The -EEXIST errno is reserved by the module loading functionality. When
>>> userspace calls [f]init_module(), it expects a -EEXIST to mean that the
>>> module is already loaded in the kernel. If module_init() returns it,
>>> that is not true anymore.
>>>
>>> Add a warning and override the return code to workaround modules
>>> currently returning the wrong code. It's expected that they eventually
>>> migrate to a better suited error.
>>
>> I've been following the thread (and apologies for the delay) and reviewing the
>> patches, and I do not believe we should push this workaround. While this "fixes"
>> the bug reported, it also hides the real problem and drivers will continue
>> misusing EEXIST at module initialization.
>>
>> From the bug report thread, I agree with Christophe's suggestion that
>> nf_conntrack_helpers_register() should return EBUSY instead of EEXIST. This
>> would fix the root cause for this particular module and will allow others to
>> change their module behavior, if we also follow up with proper documentation
>> about EEXIST.
> 
> the fix will always be for the modules to stop returning EEXIST, no
> discussion on that. This is the messenger, not the fix. Someone starts
> seeing this warning and rjeports the bug. Then the developers can fix
> it. It's much easier than dealing with the outcome of a module returning
> EEXIST.

I see. Thanks for clarifying.

I'm thinking to merge this at the beginning of the next release cycle. So others
can also have time to process the new warning when testing their modules. I hope
that is okay with you.

FYI, I will follow up this with docs and some drivers fixes I've found.

> Also note that we already have a similar reasoning about adding
> a warning for module return codes in this same function.
> 
> Even if we had the means to check possible return codes from all
> module inits, we'd still have external modules.
> 
> See patch 2: after some time we can simplify the warning and maybe even
> remove it.

That was added almost two decades ago. I hope we don't need to wait that long!
:)

commit e24e2e64c468c8060bb7173abecdf11d00ed5751
Author: Alexey Dobriyan <adobriyan@gmail.com>
Date:   Mon Mar 10 11:43:53 2008 -0700

    modules: warn about suspicious return values from module's ->init() hook

I don't see a way to completely remove any of these, especially with out of 
tree modules... or to capture any possible future/new misses.

> 
> Lucas De Marchi

  reply	other threads:[~2025-11-16 20:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 16:26 [PATCH 0/2] module: Tweak return and warning Lucas De Marchi
2025-10-13 16:26 ` [PATCH 1/2] module: Override -EEXISTS module return Lucas De Marchi
2025-10-17 12:04   ` Petr Pavlu
2025-11-02 18:23   ` Aaron Tomlin
2025-11-10 15:17   ` Daniel Gomez
2025-11-10 15:31     ` Lucas De Marchi
2025-11-16 20:42       ` Daniel Gomez [this message]
2025-11-16 20:46   ` Daniel Gomez
2025-10-13 16:26 ` [PATCH 2/2] module: Simplify warning on positive returns from module_init() Lucas De Marchi
2025-10-17 12:06   ` Petr Pavlu
2025-11-02 18:23   ` Aaron Tomlin
2025-11-16 20:47 ` [PATCH 0/2] module: Tweak return and warning Daniel Gomez

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=81b10186-767c-4904-b048-d88a73ff15b3@kernel.org \
    --to=da.gomez@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    --cc=petr.pavlu@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).