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: <20251013-module-warn-ret-v1-1-ab65b41af01f@intel.com>
Date: Mon, 13 Oct 2025 09:26:23 -0700
From: Lucas De Marchi <lucas.demarchi@...el.com>
To: linux-modules@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: Lucas De Marchi <lucas.demarchi@...el.com>,
	Petr Pavlu <petr.pavlu@...e.com>
Subject: [PATCH 1/2] module: Override -EEXISTS module return

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.

Closes: https://lore.kernel.org/all/aKLzsAX14ybEjHfJ@orbyte.nwl.cc/
Signed-off-by: Lucas De Marchi <lucas.demarchi@...el.com>
---
 kernel/module/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/module/main.c b/kernel/module/main.c
index c66b261849362..74ff87b13c517 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -3038,6 +3038,11 @@ static noinline int do_init_module(struct module *mod)
 	if (mod->init != NULL)
 		ret = do_one_initcall(mod->init);
 	if (ret < 0) {
+		if (ret == -EEXIST) {
+			pr_warn("%s: init suspiciously returned -EEXIST: Overriding with -EBUSY\n",
+				mod->name);
+			ret = -EBUSY;
+		}
 		goto fail_free_freeinit;
 	}
 	if (ret > 0) {

-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ