facebookexperimental / hermit

Hermit launches linux x86_64 programs in a special, hermetically isolated sandbox to control their execution. Hermit translates normal, nondeterministic behavior, into deterministic, repeatable behavior. This can be used for various applications, including replay-debugging, reproducible artifacts, chaos mode concurrency testing and bug analysis.
Other
1.19k stars 31 forks source link

Cargo test failed for two cases on bare metal #40

Open PanJason opened 1 year ago

PanJason commented 1 year ago

Describe the bug A clear and concise description of what the bug is. I cloned hermit on the server and ran the cargo test. There are two failed tests.

test rdrand_rdseed_is_masked ... FAILED
test getrandom_intercepted ... FAILED

failures:

---- rdrand_rdseed_is_masked stdout ----
Expecting determinism:
Test Run 1:
thread 'rdrand_rdseed_is_masked' panicked at 'Unsupported processor with feature info: FeatureInfo { extended_family_id: 0, extended_model_id: 6, family_id: 6, model_id: 106, stepping_id: 6, brand_index: 0, cflush_cache_line_size: 8, initial_local_apic_id: 8, max_logical_processor_ids: 128, edx_ecx: SSE3 | PCLMULQDQ | DTES64 | MONITOR | DSCPL | VMX | SMX | EIST | TM2 | SSSE3 | FMA | CMPXCHG16B | PDCM | PCID | DCA | SSE41 | SSE42 | X2APIC | MOVBE | POPCNT | TSC_DEADLINE | AESNI | XSAVE | OSXSAVE | AVX | F16C | RDRAND | FPU | VME | DE | PSE | TSC | MSR | PAE | MCE | CX8 | APIC | SEP | MTRR | PGE | MCA | CMOV | PAT | PSE36 | CLFSH | DS | ACPI | MMX | FXSR | SSE | SSE2 | SS | HTT | TM | PBE | 0x4800 }
 Full family_model: (6, 106)', /home/yupan/.cargo/git/checkouts/reverie-9a587e40a0d7d3be/0e08502/reverie-ptrace/src/timer.rs:75:16
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- getrandom_intercepted stdout ----
Expecting determinism:
Test Run 1:
thread 'getrandom_intercepted' panicked at 'Unsupported processor with feature info: FeatureInfo { extended_family_id: 0, extended_model_id: 6, family_id: 6, model_id: 106, stepping_id: 6, brand_index: 0, cflush_cache_line_size: 8, initial_local_apic_id: 4, max_logical_processor_ids: 128, edx_ecx: SSE3 | PCLMULQDQ | DTES64 | MONITOR | DSCPL | VMX | SMX | EIST | TM2 | SSSE3 | FMA | CMPXCHG16B | PDCM | PCID | DCA | SSE41 | SSE42 | X2APIC | MOVBE | POPCNT | TSC_DEADLINE | AESNI | XSAVE | OSXSAVE | AVX | F16C | RDRAND | FPU | VME | DE | PSE | TSC | MSR | PAE | MCE | CX8 | APIC | SEP | MTRR | PGE | MCA | CMOV | PAT | PSE36 | CLFSH | DS | ACPI | MMX | FXSR | SSE | SSE2 | SS | HTT | TM | PBE | 0x4800 }
 Full family_model: (6, 106)', /home/yupan/.cargo/git/checkouts/reverie-9a587e40a0d7d3be/0e08502/reverie-ptrace/src/timer.rs:75:16

failures:
    getrandom_intercepted
    rdrand_rdseed_is_masked

Indicate any of these common scenarios that apply:

To Reproduce Minimal input to reproduce the behavior.

cargo test

Expected behavior A clear and concise description of what you expected to happen.

all tests passed

Environment

Additional context Attach the logs to this issue as a text file generated by hermit --log=trace --log-file=FOO run.

Add any other context about the problem here. I saw other people having a similar issue but he was running hermit inside a VM. That issue was because hermit cannot intercept CPUID instruction on VMs. Here I am running on a bare metal so I wonder what might be the reason here. Is it because of some CPU features? If that's the case, is there a list of supported CPUs by hermit. If this is a bug, I would also like to help fix it.

NicholasTroutman commented 1 year ago

I have similar issues on both a WSL and a docker test of hermit on Ubuntu 22.04

#6 49.64 failures:
#6 49.64
#6 49.64 ---- rdrand_rdseed_is_masked stdout ----
#6 49.64 Expecting determinism:
#6 49.64 Test Run 1:
#6 49.64 thread 'rdrand_rdseed_is_masked' panicked at /Python-3.8.16/hermit/vendor/safeptrace/src/lib.rs:317:22:
#6 49.64 InvalidState(Wait(Exited(Pid(761), Signaled(SIGSEGV, false))))
#6 49.64 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#6 49.64
#6 49.64 ---- getrandom_intercepted stdout ----
#6 49.64 Expecting determinism:
#6 49.64 Test Run 1:
#6 49.64 thread 'getrandom_intercepted' panicked at /Python-3.8.16/hermit/vendor/safeptrace/src/lib.rs:317:22:
#6 49.64 InvalidState(Wait(Exited(Pid(762), Signaled(SIGSEGV, false))))
#6 49.64
#6 49.64
#6 49.64 failures:
#6 49.64     getrandom_intercepted
#6 49.64     rdrand_rdseed_is_masked
#6 49.64
#6 49.64 test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
#6 49.64
#6 49.65 error: test failed, to rerun pass `-p detcore --test tests_misc`
#6 ERROR: process "/bin/sh -c cargo test --release" did not complete successfully: exit code: 101
------
 > [3/3] RUN cargo test --release:
#6 49.64 InvalidState(Wait(Exited(Pid(762), Signaled(SIGSEGV, false))))
#6 49.64
#6 49.64
#6 49.64 failures:
#6 49.64     getrandom_intercepted
#6 49.64     `rdrand_rdseed_is_masked`