Skip to content
Snippets Groups Projects
Unverified Commit b3cabd85 authored by s0me0ne-unkn0wn's avatar s0me0ne-unkn0wn Committed by GitHub
Browse files

Fix landlock presence test (#5037)

Closes #4951 (hopefully)

@alvicsam can you please check if it passes in the new environment?
parent b862b181
Branches
No related merge requests found
Pipeline #485449 waiting for manual action with stages
in 15 minutes and 16 seconds
...@@ -523,20 +523,17 @@ async fn prepare_can_run_serially() { ...@@ -523,20 +523,17 @@ async fn prepare_can_run_serially() {
#[cfg(all(feature = "ci-only-tests", target_os = "linux"))] #[cfg(all(feature = "ci-only-tests", target_os = "linux"))]
#[tokio::test] #[tokio::test]
async fn all_security_features_work() { async fn all_security_features_work() {
// Landlock is only available starting Linux 5.13, and we may be testing on an old kernel.
let can_enable_landlock = { let can_enable_landlock = {
let sysinfo = sc_sysinfo::gather_sysinfo(); let res = unsafe { libc::syscall(libc::SYS_landlock_create_ruleset, 0usize, 0usize, 1u32) };
// The version will look something like "5.15.0-87-generic". if res == -1 {
let version = sysinfo.linux_kernel.unwrap(); let err = std::io::Error::last_os_error().raw_os_error().unwrap();
let version_split: Vec<&str> = version.split(".").collect(); if err == libc::ENOSYS {
let major: u32 = version_split[0].parse().unwrap(); false
let minor: u32 = version_split[1].parse().unwrap(); } else {
if major >= 6 { panic!("Unexpected errno from landlock check: {err}");
true }
} else if major == 5 {
minor >= 13
} else { } else {
false true
} }
}; };
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment