From 4fb49c739b04d725f82fe4c3c52dca164235724c Mon Sep 17 00:00:00 2001 From: Luke Craig Date: Sat, 9 May 2026 16:52:25 -0400 Subject: [PATCH 1/2] test: add task size verify plugin and reasonable values for architectures --- pyplugins/testing/task_size_verify.py | 60 +++++++++++++++++++ tests/unit_tests/test_target/base_config.yaml | 1 + .../test_target/patches/arches/aarch64.yaml | 3 + .../test_target/patches/arches/armel.yaml | 3 + .../patches/arches/loongarch64.yaml | 3 + .../test_target/patches/arches/mips64eb.yaml | 3 + .../test_target/patches/arches/mips64el.yaml | 3 + .../test_target/patches/arches/mipseb.yaml | 3 + .../test_target/patches/arches/mipsel.yaml | 3 + .../test_target/patches/arches/powerpc.yaml | 3 + .../test_target/patches/arches/powerpc64.yaml | 8 ++- .../test_target/patches/arches/riscv64.yaml | 3 + .../test_target/patches/arches/x86_64.yaml | 3 + .../test_target/patches/tests/task_size.yaml | 26 ++++++++ 14 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 pyplugins/testing/task_size_verify.py create mode 100644 tests/unit_tests/test_target/patches/tests/task_size.yaml diff --git a/pyplugins/testing/task_size_verify.py b/pyplugins/testing/task_size_verify.py new file mode 100644 index 000000000..b65cd626d --- /dev/null +++ b/pyplugins/testing/task_size_verify.py @@ -0,0 +1,60 @@ +from penguin import Plugin, plugins +import os + +class TaskSizeVerify(Plugin): + def __init__(self): + super().__init__() + self.outdir = self.get_arg("outdir") + self.conf = self.get_arg("conf") + + @plugins.syscalls.syscall("on_sys_ioctl_return", comm_filter="send_syscall", + arg_filters=[0x17, 0x1234]) + def verify_task_size(self, regs, proto, syscall, fd, op, arg): + self.logger.info("TaskSizeVerify: Triggered") + + # Get expected task size from config context + expected_str = self.conf.get('env', {}).get('igloo_task_size') + if not expected_str: + self.logger.error("TaskSizeVerify: No igloo_task_size in config!") + return + + expected = int(expected_str, 16) + + # Get actual task size via OSI + proc = yield from plugins.osi.get_proc() + if not proc: + self.logger.error("TaskSizeVerify: Could not get proc info") + return + + actual = proc.task_size + self.logger.info(f"TaskSizeVerify: Expected={expected:#x}, Actual={actual:#x}") + + # Also check mappings to ensure nothing is above the limit + mappings = yield from plugins.osi.get_mappings() + max_addr = 0 + if mappings: + for m in mappings: + if m.end > max_addr: + max_addr = m.end + + self.logger.info(f"TaskSizeVerify: Max mapping end={max_addr:#x}") + + passed = True + if actual != expected: + self.logger.error(f"TaskSizeVerify: FAIL - actual task_size {actual:#x} != expected {expected:#x}") + passed = False + + if max_addr > expected: + self.logger.error(f"TaskSizeVerify: FAIL - mapping end {max_addr:#x} exceeds task_size {expected:#x}") + passed = False + for m in mappings: + self.logger.info(f"Mapping: {m.start:#x} - {m.end:#x} {m.name}") + + result = "passed" if passed else "failed" + + with open(os.path.join(self.outdir, "task_size_test.txt"), "w") as f: + f.write(f"Task size test: {result}\n") + if not passed: + f.write(f"Actual: {actual:#x}, Expected: {expected:#x}, Max Mapping: {max_addr:#x}\n") + + syscall.retval = 0 if passed else 1 diff --git a/tests/unit_tests/test_target/base_config.yaml b/tests/unit_tests/test_target/base_config.yaml index fb76a6873..983ceffb5 100644 --- a/tests/unit_tests/test_target/base_config.yaml +++ b/tests/unit_tests/test_target/base_config.yaml @@ -55,6 +55,7 @@ patches: - ./patches/tests/mtd_test.yaml - ./patches/tests/anonfs.yaml - ./patches/tests/pseudofiles_comprehensive.yaml + - ./patches/tests/task_size.yaml # - ./patches/tests/uboot_env_cmp.yaml diff --git a/tests/unit_tests/test_target/patches/arches/aarch64.yaml b/tests/unit_tests/test_target/patches/arches/aarch64.yaml index 338f2e1b9..639b7fd4b 100644 --- a/tests/unit_tests/test_target/patches/arches/aarch64.yaml +++ b/tests/unit_tests/test_target/patches/arches/aarch64.yaml @@ -1,6 +1,9 @@ core: arch: aarch64 +env: + igloo_task_size: "0x4000000000" + static_files: /igloo/utils/*: host_path: /igloo_static/aarch64/* diff --git a/tests/unit_tests/test_target/patches/arches/armel.yaml b/tests/unit_tests/test_target/patches/arches/armel.yaml index 7f48818e6..da8c245a6 100644 --- a/tests/unit_tests/test_target/patches/arches/armel.yaml +++ b/tests/unit_tests/test_target/patches/arches/armel.yaml @@ -1,6 +1,9 @@ core: arch: armel +env: + igloo_task_size: "0x7f000000" + static_files: /igloo/utils/*: host_path: /igloo_static/armel/* diff --git a/tests/unit_tests/test_target/patches/arches/loongarch64.yaml b/tests/unit_tests/test_target/patches/arches/loongarch64.yaml index 21ce24852..4f5c28d7b 100644 --- a/tests/unit_tests/test_target/patches/arches/loongarch64.yaml +++ b/tests/unit_tests/test_target/patches/arches/loongarch64.yaml @@ -1,6 +1,9 @@ core: arch: loongarch64 +env: + igloo_task_size: "0x4000000000" + static_files: /igloo/utils/*: host_path: /igloo_static/loongarch64/* diff --git a/tests/unit_tests/test_target/patches/arches/mips64eb.yaml b/tests/unit_tests/test_target/patches/arches/mips64eb.yaml index c56ab44c5..b79638a80 100644 --- a/tests/unit_tests/test_target/patches/arches/mips64eb.yaml +++ b/tests/unit_tests/test_target/patches/arches/mips64eb.yaml @@ -1,6 +1,9 @@ core: arch: mips64eb +env: + igloo_task_size: "0x4000000000" + static_files: /igloo/utils/*: host_path: /igloo_static/mips64eb/* diff --git a/tests/unit_tests/test_target/patches/arches/mips64el.yaml b/tests/unit_tests/test_target/patches/arches/mips64el.yaml index b41248468..4f725eda4 100644 --- a/tests/unit_tests/test_target/patches/arches/mips64el.yaml +++ b/tests/unit_tests/test_target/patches/arches/mips64el.yaml @@ -1,6 +1,9 @@ core: arch: mips64el +env: + igloo_task_size: "0x4000000000" + static_files: /igloo/utils/*: host_path: /igloo_static/mips64el/* diff --git a/tests/unit_tests/test_target/patches/arches/mipseb.yaml b/tests/unit_tests/test_target/patches/arches/mipseb.yaml index ee94df304..8f8fb9d2f 100644 --- a/tests/unit_tests/test_target/patches/arches/mipseb.yaml +++ b/tests/unit_tests/test_target/patches/arches/mipseb.yaml @@ -1,6 +1,9 @@ core: arch: mipseb +env: + igloo_task_size: "0x7f000000" + static_files: /igloo/utils/*: host_path: /igloo_static/mipseb/* diff --git a/tests/unit_tests/test_target/patches/arches/mipsel.yaml b/tests/unit_tests/test_target/patches/arches/mipsel.yaml index 5f5501589..343437909 100644 --- a/tests/unit_tests/test_target/patches/arches/mipsel.yaml +++ b/tests/unit_tests/test_target/patches/arches/mipsel.yaml @@ -1,6 +1,9 @@ core: arch: mipsel +env: + igloo_task_size: "0x7f000000" + static_files: /igloo/utils/*: host_path: /igloo_static/mipsel/* diff --git a/tests/unit_tests/test_target/patches/arches/powerpc.yaml b/tests/unit_tests/test_target/patches/arches/powerpc.yaml index d32266c38..a62d33458 100644 --- a/tests/unit_tests/test_target/patches/arches/powerpc.yaml +++ b/tests/unit_tests/test_target/patches/arches/powerpc.yaml @@ -1,6 +1,9 @@ core: arch: powerpc +env: + igloo_task_size: "0x7f000000" + static_files: /igloo/utils/*: host_path: /igloo_static/powerpc/* diff --git a/tests/unit_tests/test_target/patches/arches/powerpc64.yaml b/tests/unit_tests/test_target/patches/arches/powerpc64.yaml index 081d747d2..8d4f0e95c 100644 --- a/tests/unit_tests/test_target/patches/arches/powerpc64.yaml +++ b/tests/unit_tests/test_target/patches/arches/powerpc64.yaml @@ -1,8 +1,10 @@ core: - arch: powerpc64 + arch: powerpc64 -static_files: - /igloo/utils/*: +env: + igloo_task_size: "0x4000000000" + +static_files: /igloo/utils/*: host_path: /igloo_static/powerpc64/* mode: 493 type: host_file diff --git a/tests/unit_tests/test_target/patches/arches/riscv64.yaml b/tests/unit_tests/test_target/patches/arches/riscv64.yaml index 54308ef1f..e78fdc463 100644 --- a/tests/unit_tests/test_target/patches/arches/riscv64.yaml +++ b/tests/unit_tests/test_target/patches/arches/riscv64.yaml @@ -1,6 +1,9 @@ core: arch: riscv64 +env: + igloo_task_size: "0x4000000000" + static_files: /igloo/utils/*: host_path: /igloo_static/riscv64/* diff --git a/tests/unit_tests/test_target/patches/arches/x86_64.yaml b/tests/unit_tests/test_target/patches/arches/x86_64.yaml index 5014fb640..7552ba852 100644 --- a/tests/unit_tests/test_target/patches/arches/x86_64.yaml +++ b/tests/unit_tests/test_target/patches/arches/x86_64.yaml @@ -1,6 +1,9 @@ core: arch: intel64 +env: + igloo_task_size: "0x4000000000" + static_files: /igloo/utils/*: host_path: /igloo_static/x86_64/* diff --git a/tests/unit_tests/test_target/patches/tests/task_size.yaml b/tests/unit_tests/test_target/patches/tests/task_size.yaml new file mode 100644 index 000000000..61a34c0ea --- /dev/null +++ b/tests/unit_tests/test_target/patches/tests/task_size.yaml @@ -0,0 +1,26 @@ +plugins: + task_size_verify: {} + verifier: + conditions: + task_size_enforcement: + type: file_contains + file: task_size_test.txt + string: "Task size test: passed" + +static_files: + /tests/task_size.sh: + type: inline_file + contents: | + #!/igloo/utils/sh + set -x + + # Trigger verification via a specific ioctl call + /igloo/utils/send_syscall ioctl 0x17 0x1234 + + if [ $? -eq 0 ]; then + echo "Task size verification passed" + else + echo "Task size verification failed" + exit 1 + fi + mode: 755 From 6f6eec073a178f7e322023f07708c5aab3bff9f0 Mon Sep 17 00:00:00 2001 From: Luke Craig Date: Sat, 9 May 2026 16:57:46 -0400 Subject: [PATCH 2/2] flake --- Dockerfile | 2 +- pyplugins/testing/task_size_verify.py | 36 ++++++++++++++++----------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index ce958ed15..360fdc430 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ ARG REGISTRY="docker.io" ARG BASE_IMAGE="${REGISTRY}/ubuntu:22.04" ARG VPN_VERSION="1.0.25" ARG BUSYBOX_VERSION="0.0.15" -ARG LINUX_VERSION="3.5.18-beta" +ARG LINUX_VERSION="3.5.25-beta" ARG IGLOO_DRIVER_VERSION="0.0.59" ARG LIBNVRAM_VERSION="0.0.24" ARG CONSOLE_VERSION="1.0.7" diff --git a/pyplugins/testing/task_size_verify.py b/pyplugins/testing/task_size_verify.py index b65cd626d..461f7dc81 100644 --- a/pyplugins/testing/task_size_verify.py +++ b/pyplugins/testing/task_size_verify.py @@ -1,6 +1,7 @@ from penguin import Plugin, plugins import os + class TaskSizeVerify(Plugin): def __init__(self): super().__init__() @@ -11,24 +12,25 @@ def __init__(self): arg_filters=[0x17, 0x1234]) def verify_task_size(self, regs, proto, syscall, fd, op, arg): self.logger.info("TaskSizeVerify: Triggered") - + # Get expected task size from config context expected_str = self.conf.get('env', {}).get('igloo_task_size') if not expected_str: self.logger.error("TaskSizeVerify: No igloo_task_size in config!") return - + expected = int(expected_str, 16) - + # Get actual task size via OSI proc = yield from plugins.osi.get_proc() if not proc: self.logger.error("TaskSizeVerify: Could not get proc info") return - + actual = proc.task_size - self.logger.info(f"TaskSizeVerify: Expected={expected:#x}, Actual={actual:#x}") - + self.logger.info( + f"TaskSizeVerify: Expected={expected:#x}, Actual={actual:#x}") + # Also check mappings to ensure nothing is above the limit mappings = yield from plugins.osi.get_mappings() max_addr = 0 @@ -36,25 +38,29 @@ def verify_task_size(self, regs, proto, syscall, fd, op, arg): for m in mappings: if m.end > max_addr: max_addr = m.end - + self.logger.info(f"TaskSizeVerify: Max mapping end={max_addr:#x}") - + passed = True if actual != expected: - self.logger.error(f"TaskSizeVerify: FAIL - actual task_size {actual:#x} != expected {expected:#x}") + self.logger.error( + f"TaskSizeVerify: FAIL - actual task_size {actual:#x} != expected {expected:#x}") passed = False - + if max_addr > expected: - self.logger.error(f"TaskSizeVerify: FAIL - mapping end {max_addr:#x} exceeds task_size {expected:#x}") + self.logger.error( + f"TaskSizeVerify: FAIL - mapping end {max_addr:#x} exceeds task_size {expected:#x}") passed = False for m in mappings: - self.logger.info(f"Mapping: {m.start:#x} - {m.end:#x} {m.name}") + self.logger.info( + f"Mapping: {m.start:#x} - {m.end:#x} {m.name}") result = "passed" if passed else "failed" - + with open(os.path.join(self.outdir, "task_size_test.txt"), "w") as f: f.write(f"Task size test: {result}\n") if not passed: - f.write(f"Actual: {actual:#x}, Expected: {expected:#x}, Max Mapping: {max_addr:#x}\n") - + f.write( + f"Actual: {actual:#x}, Expected: {expected:#x}, Max Mapping: {max_addr:#x}\n") + syscall.retval = 0 if passed else 1