tsgates / rust.ko

A minimal Linux kernel module written in rust.
896 stars 66 forks source link

Rust nightly | Refactoring #9

Closed panicbit closed 9 years ago

panicbit commented 9 years ago
int-index commented 9 years ago

How did you manage to link to core and libc (especially libc) in a kernel module?

int-index commented 9 years ago

Turns out you actually didn't. For example, you can't use division, because it requires a panic lang item, which is defined in core, but you don't really link to it, so the resulting module can't be inserted into the kernel due to unresolved references. You can't define your own panic either, because it conflicts with the core definition.

So those patches just happen to work and fail horribly when you try to do something more than merely printing a string. You shouldn't link to anything in kernel code (e.g. no external crate).