cloud-hypervisor/scripts
Philipp Schuster d580ed55c6 seccomp: add SYS_getcwd (79) to support proper Rust backtraces
When a proper Rust backtrace is printed, the Rust std wants to use the
SYS_getcwd(79) system call to prettify some paths while printing. In
Cloud Hypervisor, this is at least relevant for printing panics or if
a `anyhow::Error` value is printed using `{e:?}` (but not `{e:#?}`).

The syscall cause can be found in `impl fmt::Display for Backtrace {}`
in `library/std/src/backtrace.rs`.

Without this addition, the seccomp violation of the SYS_getcwd (79)
hinders the proper error message including a full backtrace from showing
up. This annoying behaviour already delayed many debugging efforts. With
this fix, things just work. The new syscall itself should be pretty
harmless for normal operation.

```
thread 'vmm' panicked at virtio-devices/src/rng.rs:224:9:
Yikes, things went horribly wrong!

==== Possible seccomp violation ====
Try running with `strace -ff` to identify the cause and open an issue: https://github.com/cloud-hypervisor/cloud-hypervisor/issues/new
[1]    287683 invalid system call (core dumped)  RUST_BACKTRACE=full cargo run --bin cloud-hypervisor -- --api-socket  --kerne
```

```
thread 'vmm' panicked at virtio-devices/src/rng.rs:224:9:
Yikes, things went horribly wrong!
stack backtrace:
   0:     0x557d91286b62 - std::backtrace_rs::backtrace::libunwind::trace::hc20b48b31ee52608
                               at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1:     0x557d91286b62 - std::backtrace_rs::backtrace::trace_unsynchronized::h5d207cd20f193d88
                               at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14

...

  67:                0x0 - <unknown>
Error: Cloud Hypervisor exited with the following error:
  Failed to join on VMM thread: Any { .. }

Debug Info: ThreadJoin(Any { .. })
```

- add any panic, for example into the create or drop function of a
  device
- add --seccomp=true|log to analyze the situation

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-26 20:50:57 +00:00
..
gitlint/rules seccomp: add SYS_getcwd (79) to support proper Rust backtraces 2025-06-26 20:50:57 +00:00
build-custom-image.sh scripts: Add a script to automate the custom image construction 2024-10-17 19:51:05 +00:00
ch-trace-visualiser.py scripts: ch-trace-visualiser.py: remove unused import 'xml' 2023-02-17 11:48:37 -08:00
check-image-compatibility.sh scripts: fix shell scripts according to shellcheck errors 2024-02-13 10:20:18 +00:00
common-aarch64.sh scripts: fix shell scripts according to shellcheck errors 2024-02-13 10:20:18 +00:00
create-cloud-init.sh scripts: fix shell scripts format according to shfmt 2024-02-13 10:20:18 +00:00
dev_cli.sh build: Bump MSRV to 1.83.0 2025-04-12 18:31:02 +01:00
package-consistency-check.py scripts: Add consistency check script 2024-11-02 16:09:09 +00:00
prepare_vdpa.sh build: add REUSE Compliance Check 2024-04-19 17:35:45 +00:00
run_coverage.sh scripts: fix code coverage script args parsing 2024-10-23 18:38:34 +01:00
run_integration_tests_aarch64.sh ci: Update reference kernel to 'v6.12.8-20250613' 2025-06-16 17:59:22 +00:00
run_integration_tests_live_migration.sh ci: Update reference kernel to 'v6.12.8-20250613' 2025-06-16 17:59:22 +00:00
run_integration_tests_rate_limiter.sh scripts: Replace download_linux with prepare_linux 2024-11-12 16:27:20 +00:00
run_integration_tests_sgx.sh tests: Update version of Jammy image in use 2024-10-17 19:51:05 +00:00
run_integration_tests_vfio.sh misc: Fix spelling issues 2024-06-08 16:31:30 +00:00
run_integration_tests_windows_aarch64.sh scripts: fix shell scripts according to shellcheck errors 2024-02-13 10:20:18 +00:00
run_integration_tests_windows_x86_64.sh scripts: fix shell scripts according to shellcheck errors 2024-02-13 10:20:18 +00:00
run_integration_tests_x86_64.sh ci: Update reference kernel to 'v6.12.8-20250613' 2025-06-16 17:59:22 +00:00
run_metrics.sh scripts: Replace download_linux with prepare_linux 2024-11-12 16:27:20 +00:00
run_openapi_tests.sh scripts: fix shell scripts according to shellcheck errors 2024-02-13 10:20:18 +00:00
run_unit_tests.sh scripts: add cargo test args for code coverage reports 2024-09-28 13:59:40 +00:00
sha1sums-aarch64 tests: Remove download of unused bionic image for aarch64 2024-02-22 12:28:40 +00:00
sha1sums-x86_64 tests: Update version of Jammy image in use 2024-10-17 19:51:05 +00:00
test-util.sh ci: Update reference kernel to 'v6.12.8-20250613' 2025-06-16 17:59:22 +00:00
windows-11-iot-enterprise-aarch64.raw.sha1 ci: Initial Windows image integration 2022-08-12 15:04:06 +01:00