Re: [PATCH kmod 13/13] libkmod: always fallback to do_init_module()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 12, 2024 at 05:23:14PM GMT, Emil Velikov via B4 Relay wrote:
From: Emil Velikov <emil.l.velikov@xxxxxxxxx>

Since the direct loading was introduced a few bugs became obvious that
the compression args used were off - both in-kernel and dkms.

While both of those are fixed already, not all of those have reached all
users. For example: for dkms I'm aiming to do a release just as kmod has
theirs (to align /lib/modules <> /usr/lib/modules support).

Although I am wondering if we can indiscriminatingly callback to the old
do_init_module() in all the cases. This means that we'll catch any
in-kernel decompression issues - invalid args, ENOMEM, other....
Although for others (wrong magic, perm, etc) we will end up doing the
exact kernel work twice.

I'm not sure I like to repeat this for any error. Example: if we get an
EAGAIN we go and try again?  When thinking about the recent in-kernel
optimizations to stop loading the same file again over and over, just
doing it again seems like a wrong approach.


Overall the trade-off seems worth it, so flip this.


I'm not sure. I will keep this out for now and apply the rest.
+Luis too.


Lucas De Marchi



Signed-off-by: Emil Velikov <emil.l.velikov@xxxxxxxxx>
---
libkmod/libkmod-module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index d309948..2c0d46d 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -980,7 +980,7 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
	}

	err = do_finit_module(mod, flags, args);
-	if (err == -ENOSYS)
+	if (err)
		err = do_init_module(mod, flags, args);

	if (err < 0)

--
2.43.0





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux