Re: [PATCH 2/2] module: add support to avoid duplicates early on load

From: Linus Torvalds
Date: Mon May 29 2023 - 07:01:11 EST

On Mon, May 29, 2023 at 4:58 AM Johan Hovold <johan@xxxxxxxxxx> wrote:
> I have not tried to figure out exactly why things break, but it does
> seem like this one should be reverted.

Yes, I have done so.

However, can I ask you to just verify that it was purely the exclusive
open part, and it wasn't that I messed up something else. IOW, can you
replace the

return exclusive_deny_write_access(file);

in prepare_file_for_module_load() with just a "return 0", and remove the


line in finit_module()?

That's obviously _instead_ of the revert that I already pushed out,
just to verify that "yup, it's that part, not something silly

I do wonder what it is that is different in your setup, and maybe you
could also enable the

pr_debug("finit_module: fd=%d, uargs=%p, flags=%i\n", fd, uargs, flags);

in finit_module() while you are at it? Since you'd be editing that
file anyway for the test, just change the pr_debug() to a printk() and
then do

dmesg | grep finit_module

to see what it all results in (on a working kernel, of course).