diff --git a/lisa/_assets/kmodules/lisa/Makefile b/lisa/_assets/kmodules/lisa/Makefile index 857ef2eb4f8ae5101124a811e83d06f0e6e5fa04..17b972429e27c447bfeaca8384c1d558fbc30c7c 100644 --- a/lisa/_assets/kmodules/lisa/Makefile +++ b/lisa/_assets/kmodules/lisa/Makefile @@ -32,6 +32,15 @@ clean-files := $(GENERATED) RUST_VERSION ?= nightly RUSTFLAGS := -Clinker=rust-lld -Clink-self-contained=y -Clto=n -Crelocation-model=static -Cno-redzone=y -Ctarget-cpu=generic -Cforce-frame-pointers=y -Ccodegen-units=1 -Zfunction-sections=y +# For now, simply make Rust transparent wrt to the shadow callstack: +# https://doc.rust-lang.org/beta/unstable-book/compiler-flags/fixed-x18.html +ifeq ($(ARCH),arm64) + ifneq ($(CONFIG_SHADOW_CALL_STACK),) + RUSTFLAGS += -Zfixed-x18 + endif +endif + + LISA_EVAL_C := $(MODULE_SRC)/lisa-eval-c.sh RUSTUP_HOME ?= $(HOME)/.rustup diff --git a/lisa/_assets/kmodules/lisa/lisa-eval-c.sh b/lisa/_assets/kmodules/lisa/lisa-eval-c.sh index 7126f1a6b9f678d8b5d9034748e820d915f7a876..687ac9e35f81723252dc8e672ae7123eff895a66 100755 --- a/lisa/_assets/kmodules/lisa/lisa-eval-c.sh +++ b/lisa/_assets/kmodules/lisa/lisa-eval-c.sh @@ -21,9 +21,11 @@ trap cleanup EXIT # extract the symbol size from the symbol table after compiling. This is works # reliably on any compiler and provides the value in hex format. +# We add +1 to the expression, as symbol size for a zero-sized array seems to +# be 1 weirdly enough. That +1 is then substracted in the awk post-processing cat > $src << EOM $c_headers -static char __attribute__((used)) LISA_C_CONST_VALUE[$c_expr]; +static char __attribute__((used)) LISA_C_CONST_VALUE[($c_expr) + 1]; EOM CC=${CC:=cc} @@ -54,5 +56,5 @@ fi # All -I are relative to the kernel tree root, so we need to run from there. cd "$KERNEL_SRC" && -$CC $LISA_EVAL_C_CFLAGS "${clang_args[@]}" -c "$src" -o "$object" && $NM -S "$object" | awk '{if ($4 == "LISA_C_CONST_VALUE") {print "0x" $2}}' +$CC $LISA_EVAL_C_CFLAGS "${clang_args[@]}" -c "$src" -o "$object" && $NM -S "$object" | awk '{if ($4 == "LISA_C_CONST_VALUE") {print strtonum("0x" $2) - 1}}' diff --git a/lisa/_assets/kmodules/lisa/rust/lisakmod/src/lib.rs b/lisa/_assets/kmodules/lisa/rust/lisakmod/src/lib.rs index 226e0bea73d61f9ccef10ec5bd05624428b74464..fc30807c768f007d54874b5bf7fc7a30412d498e 100644 --- a/lisa/_assets/kmodules/lisa/rust/lisakmod/src/lib.rs +++ b/lisa/_assets/kmodules/lisa/rust/lisakmod/src/lib.rs @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ #![no_std] #![no_builtins] -#![feature(once_cell_try)] #![feature(adt_const_params)] #![feature(maybe_uninit_fill)] #![feature(coerce_unsized)] diff --git a/lisa/_kmod.py b/lisa/_kmod.py index d5ac168c250d204f7f0260efe6169a3d2c451f7d..d20da9909ecb2c5f5ec327bfeb80e350cbfa420e 100644 --- a/lisa/_kmod.py +++ b/lisa/_kmod.py @@ -189,7 +189,7 @@ class KmodVersionError(Exception): pass -_ALPINE_DEFAULT_VERSION = '3.20.3' +_ALPINE_DEFAULT_VERSION = '3.21.3' _ALPINE_ROOTFS_URL = 'https://dl-cdn.alpinelinux.org/alpine/v{minor}/releases/{arch}/alpine-minirootfs-{version}-{arch}.tar.gz' _ALPINE_PACKAGE_INFO_URL = 'https://pkgs.alpinelinux.org/package/v{version}/{repo}/{arch}/{package}' @@ -2448,6 +2448,7 @@ class _KernelBuildEnv(Loggable, SerializeViaConstructor): checksum=dir_cache.get_key_token(key), ) else: + logger.debug(f'Kernel tree prepare step will not be cached as no cache key could be computed for it.') with _overlay_folders([base_path], backend=overlay_backend, copy_filter=copy_filter) as path: prepare_overlay(path) yield dict( @@ -2466,15 +2467,17 @@ class _KernelBuildEnv(Loggable, SerializeViaConstructor): repo_root = git.find_root(tree_path) sha1 = git.get_sha1(tree_path) patch = git.get_uncommitted_patch(tree_path) - except (FileNotFoundError, subprocess.CalledProcessError): - key = None + except (FileNotFoundError, subprocess.CalledProcessError) as e: + logger.debug(f'Could not compute a cache key for kernel tree at {tree_path}: ({e.__class__.__qualname__}) {e}') + tree_key = None else: if repo_root.resolve() == Path(tree_path).resolve(): patch_sha1 = hashlib.sha1(patch.encode()).hexdigest() - key = f'{sha1}-{patch_sha1}' + tree_key = ('checksum', f'{sha1}-{patch_sha1}') else: - key = None - yield (tree_path, key) + logger.debug(f'Could not compute a cache key for kernel tree at {tree_path} as the root of the kernel tree is not the root of a git repository') + tree_key = None + yield (tree_path, tree_key) elif version is None: raise ValueError('Kernel version is required in order to download the kernel sources') elif cache: @@ -2488,13 +2491,13 @@ class _KernelBuildEnv(Loggable, SerializeViaConstructor): # Assume that the URL will always provide the same tarball yield ( dir_cache.get_entry(url), - url, + ('url', url), ) else: with tempfile.TemporaryDirectory() as path: yield ( cls._make_tree(version, path), - version, + ('version', version), ) cm = chain_cm(overlay_cm, tree_cm)