Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load file system modules #1

Open
hayley-leblanc opened this issue Jan 21, 2022 · 3 comments
Open

Cannot load file system modules #1

hayley-leblanc opened this issue Jan 21, 2022 · 3 comments

Comments

@hayley-leblanc
Copy link

hayley-leblanc commented Jan 21, 2022

Hi! I am trying to set up Bento and I'm running into an issue where I can't load the included file system modules.

I've tried hello_ll, hello_ll2, xv6fs, and xv6fs2. I'm able to build bentofs, bento_utils, and the file system modules without any errors using the current nightly Rust version (1.60.0) after following the instructions in the README, and I can load the bentofs module with no issues. When I try to load one of the file system modules (e.g. hello_ll.ko), I get the following error:

insmod: ERROR: could not insert module kernel/hello_ll.ko: Invalid module format

dmesg contains this line: module: hello_ll: Unknown rela relocation: 29. I did a bit of googling, but unfortunately didn't find much; this issue was the closest to what I'm seeing, but their fix doesn't seem to be applicable here.

I am trying to run Bento on Ubuntu 20.04 with Linux kernel version 5.1.0. I ported the bentofs module and both the master and tcp_support branches to this version. I plan to try kernel 4.15 to see if it's an issue with my port or 5.1.0 in general, although ideally I'd like to stick with 5.1.0.

I've used both the current Rust nightly version (1.60.0) and nightly-1.43.0, since that appears to be the version that Bento was developed on. Unfortunately, I'm experiencing issues with 1.43.0; bento_utils compiles just fine, but attempting to compile hello_ll gives several errors of the following form:

error[E0658]: use of unstable library feature 'str_strip': newly added
  --> /home/hayley/.cargo/registry/src/github.com-1ecc6299db9ec823/clang-sys-1.3.0/build/dynamic.rs:93:51
   |
93 |     let version = if let Some(version) = filename.strip_prefix("libclang.so.") {
   |                                                   ^^^^^^^^^^^^
   |
   = note: see issue #67302 <https://github.com/rust-lang/rust/issues/67302> for more information
   = help: add `#![feature(str_strip)]` to the crate attributes to enable

I tried adding #![feature(str_strip)] to various lib.rs files with no luck. I suspect that this error might be due to some kind of version issues that might be tricky to fix.

Have any of these issues been encountered before?

Thanks in advance for your help!

@smiller123
Copy link
Owner

Hello!

Yeah I've bumped into the Unknown rela relocation: 29 issue a number of times. It's sometimes hard to tell the Rust compiler not to generate certain types of ELF sections that don't work in a kernel module. I thought that had gotten better, but either it hasn't or I don't know what build options I need for 1.60.0. I've had the most success with dealing with the issue by changing to compiler versions that don't produce the offending sections, but I can also try to dig into the code or build options if we can't find a working compiler version. For the tcp_support branch, which I've been running on a 5.8 kernel, I'm using Rust version 1.54.0-nightly (657bc0188 2021-05-31). Can you give that one a try and see if it fixes the issue?

I haven't run into that issue with clang-sys before, but I seem to be on clang version 1.2.2 instead of 1.3.0. A bit of googling makes me thing that Rust 1.54 will fix the issue, but if it doesn't, I should be able to either add the feature somewhere or pin the version of clang.

Let me know what works!

@hayley-leblanc
Copy link
Author

No luck with kernel 5.8 and Rust 1.54 on the tcp_support branch, I'm still running into the Unknown rela relocation error. :/ I tried re-installing Rust just to make sure there wasn't any old toolchain weirdness sticking around and causing problems, but it didn't seem to help.

I realized that I can use the file systems in userspace, so that should give me enough to mess around with for a bit, but are there any other build options that I could try?

@smiller123
Copy link
Owner

I have no real clue then. It's probably something in one of the libraries we use that's causing the Unknown rela relocation sections, then. If you want to send me your Cargo.toml, I can take a look and try to figure out what's going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants