seccomp / libseccomp

The main libseccomp repository
GNU Lesser General Public License v2.1
794 stars 171 forks source link

BUG: seccomp v2.5.2 broken on mips #347

Closed kanavin closed 2 years ago

kanavin commented 2 years ago

After this commit https://github.com/systemd/systemd/commit/f833df38488ea40fc3d601ccefd64cfa3fce8bb4 systemd starts throwing failures on boot like this one:

[   12.372175] systemd[1]: systemd-journald.service: Main process exited, code=killed, status=5/TRAP
[   12.418169] systemd[1]: systemd-journald.service: Failed with result 'signal'.
[   12.446301] systemd[1]: Failed to start Journal Service.

This happens only on mips32 - not on mips64, not on ppc, arm 32/64 or x86 32/64. So it's reasonable to assume the issue is in seccomp and not in systemd, hence this ticket.

pcmoore commented 2 years ago

Hi @kanavin, this is likely related to issue #338; it appears we have resolved the ARM test problem but a MIPS issue still remains. Unfortunately neither @drakenclimber or I have easy access to a MIPS system so we are not in a good position to debug this, would you be able to help?

If you are able to help, I would suggest that getting the libseccomp regression tests running (see the libseccomp README.md) and focusing on the "02-sim-basic" test would be a good first step. I believe that if we can resolve whatever is causing that test to fail we should be able to solve the majority (all?) of the MIPS failures.

kanavin commented 2 years ago

I am getting the following:

 batch name: 02-sim-basic
 test mode:  c
 test type:  bpf-sim
Test 02-sim-basic%%001-00001 result:   FAILURE bpf_sim resulted in KILL
Test 02-sim-basic%%002-00001 result:   FAILURE bpf_sim resulted in KILL
Test 02-sim-basic%%003-00001 result:   FAILURE bpf_sim resulted in KILL
Test 02-sim-basic%%004-00001 result:   FAILURE bpf_sim resulted in KILL
Test 02-sim-basic%%005-00001 result:   SUCCESS
Test 02-sim-basic%%006-00001 result:   SKIPPED (architecture difference)
Test 02-sim-basic%%007-00001 result:   SKIPPED (architecture difference)
Test 02-sim-basic%%008-00001 result:   SKIPPED (architecture difference)
Test 02-sim-basic%%009-00001 result:   SKIPPED (architecture difference)
Test 02-sim-basic%%010-00001 result:   SKIPPED (architecture difference)
 test mode:  c
 test type:  bpf-sim-fuzz
Test 02-sim-basic%%011-00001 result:   SUCCESS
Test 02-sim-basic%%011-00002 result:   SUCCESS
Test 02-sim-basic%%011-00003 result:   SUCCESS
Test 02-sim-basic%%011-00004 result:   SUCCESS
Test 02-sim-basic%%011-00005 result:   SUCCESS
 test mode:  c
 test type:  bpf-valgrind
Test 02-sim-basic%%012-00001 result:   SKIPPED (valgrind not installed)
kanavin commented 2 years ago

FWIW, as a Yocto project maintainer I do not have physical hardware either. All the different architectures are tested by booting full system images in qemu emulator on x86_64 hosts (occasionally on aarch64). It's software emulation and rather slow, but it does expose target issues faithfully.

drakenclimber commented 2 years ago

FWIW, as a Yocto project maintainer I do not have physical hardware either. All the different architectures are tested by booting full system images in qemu emulator on x86_64 hosts (occasionally on aarch64). It's software emulation and rather slow, but it does expose target issues faithfully.

Agreed. I'm (slowly) setting up a mipsel qemu VM right now. It works, but it won't break any speed records. Hopefully I'll have something useful to report by 2022 or so :)

kanavin commented 2 years ago

Here's the same test run separately with slightly more verbose output:

root@qemumips:~/libseccomp/tests# ./regression -v -b 02-sim-basic
=============== Tue Oct 19 18:51:40 UTC 2021 ===============
Regression Test Report ("regression -v -b 02-sim-basic")
 batch name: 02-sim-basic
 test mode:  c
 test type:  bpf-sim
Test 02-sim-basic%%001-00001 data:     02-sim-basic              mips    3             0          139898888        40                   N        N     N     ALLOW
Test 02-sim-basic%%001-00001 result:   FAILURE bpf_sim resulted in KILL
Test 02-sim-basic%%002-00001 data:     02-sim-basic              mips    4             1          139898888        40                   N        N     N     ALLOW
Test 02-sim-basic%%002-00001 result:   FAILURE bpf_sim resulted in KILL
Test 02-sim-basic%%003-00001 data:     02-sim-basic              mips    6             4          N                N                    N        N     N     ALLOW
Test 02-sim-basic%%003-00001 result:   FAILURE bpf_sim resulted in KILL
Test 02-sim-basic%%004-00001 data:     02-sim-basic              mips    193           N          N                N                    N        N     N     ALLOW
Test 02-sim-basic%%004-00001 result:   FAILURE bpf_sim resulted in KILL
Test 02-sim-basic%%005-00001 data:     02-sim-basic              mips    5             139898888  4                N                    N        N     N     KILL
Test 02-sim-basic%%005-00001 result:   SUCCESS
Test 02-sim-basic%%006-00001 result:   SKIPPED (architecture difference)
Test 02-sim-basic%%007-00001 result:   SKIPPED (architecture difference)
Test 02-sim-basic%%008-00001 result:   SKIPPED (architecture difference)
Test 02-sim-basic%%009-00001 result:   SKIPPED (architecture difference)
Test 02-sim-basic%%010-00001 result:   SKIPPED (architecture difference)
 test mode:  c
 test type:  bpf-sim-fuzz
Test 02-sim-basic%%011-00001 data:     02-sim-basic              a3c              4d               4c94d4ee         e267b3d          2e               d2               bcb6aca6
Test 02-sim-basic%%011-00001 result:   SUCCESS
Test 02-sim-basic%%011-00002 data:     02-sim-basic              ca               e4               a726ac           0                d5bf081          ef1              770
Test 02-sim-basic%%011-00002 result:   SUCCESS
Test 02-sim-basic%%011-00003 data:     02-sim-basic              21b              c8c              87382            153c78c          71ced2           5ac              a2d
Test 02-sim-basic%%011-00003 result:   SUCCESS
Test 02-sim-basic%%011-00004 data:     02-sim-basic              169a79           ec7bdaa0         f25              6106396          74               d                f
Test 02-sim-basic%%011-00004 result:   SUCCESS
Test 02-sim-basic%%011-00005 data:     02-sim-basic              5f61             f67f             64               604              3c69             c                81
Test 02-sim-basic%%011-00005 result:   SUCCESS
 test mode:  c
 test type:  bpf-valgrind
Test 02-sim-basic%%012-00001 result:   SKIPPED (valgrind not installed)
Regression Test Summary
 tests run: 10
 tests skipped: 6
 tests passed: 6
 tests failed: 4
 tests errored: 0
============================================================
pcmoore commented 2 years ago

I believe PR #348 should resolve this problem; additional testing and review would be appreciated.

kanavin commented 2 years ago

I believe PR #348 should resolve this problem; additional testing and review would be appreciated.

This does fix the systemd issue and 02-sim-basic tests. I am now running the full make check and will report in PR itself.

pcmoore commented 2 years ago

Closing this out as I believe we have fixed this in #348.