Skip to contentSkip to conversation

Loading an out-of-tree module

DISCUSSION Carlos 5 participants 7 messages Apr 29, 2021 Rust

lore
Share & tools
lore

Carlos

author
#0 lore raw

Good morning (or good afternoon) to all,

I managed to build an out-of-tree HelloWorld module. However, when I tried loading it in the kernel (booted with eudyptula-boot)
and dmesg inside the shell, I get a 'loading out-of-tree module taints kernel':

struct HelloWorld;

impl KernelModule for HelloWorld {
    fn init() -> KernelResult<Self> {
        pr_alert!("This is a rust kernel module");

        Ok(HelloWorld {})
    }
}
impl Drop for HelloWorld {
    fn drop(&mut self) {
        pr_alert!("Dropping rust kmod!");
    }
} 

[...]

$ insmod hello_world.kmod
$ dmesg | tail -1
[   38.462244] hello_world: loading out-of-tree module taints kernel.
$ rmmod hello_world 
[   38.462402] hello_world: This is a rust kernel module 
$ insmod hello_world.ko
[  315.360871] hello_world: Dropping rust kmod!
$ dmesg | tail -2
[   38.462402] hello_world: This is a rust kernel module
[  315.360871] hello_world: Dropping rust kmod!

And from then on all module messages are one off.
Is the 'loading out-of-tree module taints kernel' messsage something you can disable at .config? Or is it something particular to eudyptula-boot?

Thank you for your patience,
Carlos

Reviewed-by Dave Jones Acked-by Greg Kroah-Hartman
#1 lore raw
Quoted 3 lines · Carlos

Is the 'loading out-of-tree module taints kernel' messsage something you can disable at .config? Or is it something particular to eudyptula-boot?

commit 2449b8ba0745327c5fa49a8d9acffe03b2eded69

Author: Ben Hutchings <[email protected]>
Date:   Mon Oct 24 15:12:28 2011 +0200

module,bug: Add TAINT_OOT_MODULE flag for modules not built in-tree

Use of the GPL or a compatible licence doesn't necessarily make the code any good. We already consider staging modules to be suspect, and this should also be true for out-of-tree modules which may receive very little review.

oops-tracing.txt)

#2 lore raw
In reply to Carlos
Quoted 3 lines · Carlos

Is the 'loading out-of-tree module taints kernel' messsage something you can disable at .config? Or is it something particular to eudyptula-boot?

I don't spot a Kconfig option to disable this. But if you really didn't want to get this warning, I guess you can always manually comment out the relevant code in kernel/module.c (check_modinfo) ?

#3 lore raw
In reply to Carlos
Quoted 5 lines · Carlos

Good morning (or good afternoon) to all,

I managed to build an out-of-tree HelloWorld module. However, when I tried loading it in the kernel (booted with eudyptula-boot)
and dmesg inside the shell, I get a 'loading out-of-tree module taints kernel':

That is to be expected, the kernel is working as designed :)

thanks,

greg k-h

author
#4 lore raw

Thank you all for your responses,

I get why the OOT flag is there so I won't try to remove it. What concerns me, however, is that my printk messages don't work as expected (i.e. They are one off). Is this behaviour caused by the same flag?

Respectfully,
Carlos.

#5 lore raw
Quoted 3 lines · Carlos

I get why the OOT flag is there so I won't try to remove it. What concerns me, however, is that my printk messages don't work as expected (i.e. They are one off). Is this behaviour caused by the same flag?

Adding a new line (\n) to the end of your messages should fix this.

Cheers,
-Wedson

#6 lore raw
In reply to Carlos

Hi Carlos,

Quoted 6 lines · Carlos

Thank you all for your responses,

I get why the OOT flag is there so I won't try to remove it. What concerns me, however, is that my printk messages don't work as expected (i.e. They are one off). Is this behaviour caused by the same flag?

\n is missing in the strings, e.g. pr_info("hello\n");

Also, please avoid top-posting.

Cheers,
Miguel