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

taskstats crashes on Linux kernels v5.19 and newer #12

Closed
jac-cbi opened this issue May 8, 2024 · 3 comments
Closed

taskstats crashes on Linux kernels v5.19 and newer #12

jac-cbi opened this issue May 8, 2024 · 3 comments

Comments

@jac-cbi
Copy link

jac-cbi commented May 8, 2024

While attempting to run zenith on my Gentoo x86_64 box, I get an immediate crash:

thread '<unnamed>' panicked at 'range end index 432 out of range for slice of length 416', $HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/linux-taskstats-0.5.0/src/model.rs:127:39

The change 662ce1dc9caf4 in the Linux kernel extended struct taskstats by 16 bytes.

@@ -194,6 +194,10 @@ struct taskstats {
        __u64   ac_exe_dev;     /* program binary device ID */
        __u64   ac_exe_inode;   /* program binary inode number */
        /* v12 end */
+
+       /* v13: Delay waiting for write-protect copy */
+       __u64    wpcopy_count;
+       __u64    wpcopy_delay_total;
 };

This change landed in Linux kernel v5.19. So all kernels newer than that should break in the same way.

Looking at the comment in the src/lib.rs, it might be a good idea to revisit the decision to open code the rust struct vice letting bindgen do it. Maybe setting an MSRV would work here?

@kawamuray
Copy link
Owner

Thanks for reporting.

it might be a good idea to revisit the decision to open code the rust struct vice letting bindgen do it.

Agree. I have to admit that the actual definition of taskstats struct in kernel is evolving much aggressively than I initially expected.

Maybe for backward compatibility we can keep the current definition of taskstats struct in src/lib.rs w/ enabling it w/ a feature flag.

@thinkgos
Copy link

thinkgos commented Jun 7, 2024

me too, but build with statically linked. install use cargo install --git https://github.com/bvaisvil/zenith.git --target x86_64-unknown-linux-musl

thread '<unnamed>' panicked at 'range end index 352 out of range for slice of length 328', /home/thinkgo/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/linux-taskstats-0.5.0/src/model.rs:127:39

my os system call uname -a show follow:

Linux localhost.localdomain 3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

@kawamuray
Copy link
Owner

should be fixed by #13

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

3 participants