Skip to content

Commit

Permalink
fix: bump min supported kernel version to 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
kxxt committed Oct 20, 2024
1 parent 09e1824 commit 634c5ac
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,19 @@ async fn main() -> color_eyre::Result<()> {
} else {
None
};
// Seccomp-bpf ptrace behavior is changed on 4.8. I haven't tested on older kernels.
let min_support_kver = (4, 8);
if !is_current_kernel_greater_than(min_support_kver)? {
// PTRACE_GET_SYSCALL_INFO requires at least linux 5.3.
let min_support_kver = (5, 3);
if !is_current_kernel_ge(min_support_kver)? {
log::warn!(
"Current kernel version is not supported! Minimum supported kernel version is {}.{}.",
min_support_kver.0,
min_support_kver.1
);
eprintln!(
"Current kernel version is not supported! Minimum supported kernel version is {}.{}.",
min_support_kver.0,
min_support_kver.1
);
}
if !cli.no_profile {
match Config::load(cli.profile.clone()) {
Expand Down Expand Up @@ -353,7 +358,7 @@ async fn main() -> color_eyre::Result<()> {
Ok(())
}

fn is_current_kernel_greater_than(min_support: (u32, u32)) -> color_eyre::Result<bool> {
fn is_current_kernel_ge(min_support: (u32, u32)) -> color_eyre::Result<bool> {
let utsname = nix::sys::utsname::uname()?;
let kstr = utsname.release().as_bytes();
let pos = kstr.iter().position(|&c| c != b'.' && !c.is_ascii_digit());
Expand Down

0 comments on commit 634c5ac

Please sign in to comment.