rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Loading an out-of-tree module
@ 2021-04-29 14:32 Carlos
  2021-04-29 14:38 ` Sven Van Asbroeck
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Carlos @ 2021-04-29 14:32 UTC (permalink / raw)
  To: rust-for-linux

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Loading an out-of-tree module
  2021-04-29 14:32 Loading an out-of-tree module Carlos
@ 2021-04-29 14:38 ` Sven Van Asbroeck
  2021-04-29 14:52 ` Sven Van Asbroeck
  2021-04-29 15:16 ` Greg KH
  2 siblings, 0 replies; 7+ messages in thread
From: Sven Van Asbroeck @ 2021-04-29 14:38 UTC (permalink / raw)
  To: Carlos; +Cc: rust-for-linux

On Thu, Apr 29, 2021 at 10:34 AM Carlos <carloscarral13@gmail.com> wrote:
>
> 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 <ben@decadent.org.uk>
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.

    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    Reviewed-by: Dave Jones <davej@redhat.com>
    Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (patched
oops-tracing.txt)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Loading an out-of-tree module
  2021-04-29 14:32 Loading an out-of-tree module Carlos
  2021-04-29 14:38 ` Sven Van Asbroeck
@ 2021-04-29 14:52 ` Sven Van Asbroeck
  2021-04-29 15:16 ` Greg KH
  2 siblings, 0 replies; 7+ messages in thread
From: Sven Van Asbroeck @ 2021-04-29 14:52 UTC (permalink / raw)
  To: Carlos; +Cc: rust-for-linux

On Thu, Apr 29, 2021 at 10:34 AM Carlos <carloscarral13@gmail.com> wrote:
>
> 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) ?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Loading an out-of-tree module
  2021-04-29 14:32 Loading an out-of-tree module Carlos
  2021-04-29 14:38 ` Sven Van Asbroeck
  2021-04-29 14:52 ` Sven Van Asbroeck
@ 2021-04-29 15:16 ` Greg KH
  2021-04-29 15:56   ` Carlos
  2 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2021-04-29 15:16 UTC (permalink / raw)
  To: Carlos; +Cc: rust-for-linux

On Thu, Apr 29, 2021 at 09:32:34AM -0500, Carlos wrote:
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Loading an out-of-tree module
  2021-04-29 15:16 ` Greg KH
@ 2021-04-29 15:56   ` Carlos
  2021-04-29 16:05     ` Wedson Almeida Filho
  2021-04-29 16:06     ` Miguel Ojeda
  0 siblings, 2 replies; 7+ messages in thread
From: Carlos @ 2021-04-29 15:56 UTC (permalink / raw)
  To: rust-for-linux; +Cc: Greg KH, Sven Van Asbroeck

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.
-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Loading an out-of-tree module
  2021-04-29 15:56   ` Carlos
@ 2021-04-29 16:05     ` Wedson Almeida Filho
  2021-04-29 16:06     ` Miguel Ojeda
  1 sibling, 0 replies; 7+ messages in thread
From: Wedson Almeida Filho @ 2021-04-29 16:05 UTC (permalink / raw)
  To: Carlos; +Cc: rust-for-linux, Greg KH, Sven Van Asbroeck

On Thu, Apr 29, 2021 at 10:56:06AM -0500, Carlos wrote:
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Loading an out-of-tree module
  2021-04-29 15:56   ` Carlos
  2021-04-29 16:05     ` Wedson Almeida Filho
@ 2021-04-29 16:06     ` Miguel Ojeda
  1 sibling, 0 replies; 7+ messages in thread
From: Miguel Ojeda @ 2021-04-29 16:06 UTC (permalink / raw)
  To: Carlos; +Cc: rust-for-linux, Greg KH, Sven Van Asbroeck

Hi Carlos,

On Thu, Apr 29, 2021 at 5:56 PM Carlos <carloscarral13@gmail.com> wrote:
>
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-29 16:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 14:32 Loading an out-of-tree module Carlos
2021-04-29 14:38 ` Sven Van Asbroeck
2021-04-29 14:52 ` Sven Van Asbroeck
2021-04-29 15:16 ` Greg KH
2021-04-29 15:56   ` Carlos
2021-04-29 16:05     ` Wedson Almeida Filho
2021-04-29 16:06     ` Miguel Ojeda

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).