Repository navigation
Conversation
|
Hi all, I've been running the libseccomp test suit (make check) on my Alpha UP2000+ with a kernel patched for libseccomp support, here are some results: Regression Test Summary So it mostly works I'd say! great work with libseccomp!. Below are some of the tests that fail: Test 33-sim-socket_syscalls_be%%001-00001 result: ERROR 33-sim-socket_syscalls_be rc=14 Test 34-sim-basic_denylist%%003-00001 result: FAILURE bpf_sim resulted in ALLOW Test 43-sim-a2_order%%031-00001 result: FAILURE bpf_sim resulted in KILL Test 62-sim-arch_transactions%%001-00001 result: FAILURE bpf_sim resulted in ALLOW Test 53-sim-binary_tree%%001-00001 result: ERROR 53-sim-binary_tree rc=14 I haven't yet looked into the details as to why tests fail, seems like some of them just assumes the |
d0bd0a4 to
0590350
Compare
|
Without looking at the patch, I just want to remind everyone that we generally don't merge new architecture support until we have a released upstream kernel with seccomp support for that architecture. |
|
Looking at Linus' tree, it doesn't appear that the seccomp support patch for Alpha has landed. |
It's part of Magnus Lindholm's tree in the for-next branch and will be submitted once the merge window opens again. |
|
Great, we'll look forward to that. Hopefully that will give folks enough time to sort out the test failures. On a personal note, my first job out of college was working on Tru64 UNIX for the Alpha, merging Alpha support into libseccomp would make me very happy :) |
|
Support for SECCOMP and SECCOMP_FILTER was just merged into Linus' tree. |
|
@pcmoore Ping. All bits and pieces are now in the upstream kernel. ;-) |
drakenclimber
left a comment
There was a problem hiding this comment.
@glaubitz . I applied your Alpha patch on top of the latest proposed syscall table from Pull Request #487. I then updated syscalls.csv with an Alpha column and populated it via arch-syscall-validate. See this commit - drakenclimber@45211d9. Note that some tests are still failing, so we still have some work to do.
Hmm, I might have forgotten to pick up some changes that @linmag7 had suggested. He did a lot of testing on Alpha and also implemented the kernel bits. |
|
I just had a look and it's Unfortunately, it doesn't produce any output: Any ideas? |
5562cbe to
4a107e3
Compare
|
When I run "make check" I get this: The 38-basic-pfc_coverage fails but might that be because it the 38-basic-pfc_coverage.pfc files need updating with the expected results from alpha for the test to work? |
|
Got here now: |
|
Below is from "regression -T live" on my UP2000+ Alpha |
Shall I just add your patch to my pull request? |
yes, that probably easiest, please do. |
|
Ping. Any news on this? |
|
@pcmoore Any chance you could review this PR? |
Add the expected PFC output for SCMP_ARCH_ALPHA to the 38-basic-pfc_coverage golden file. The new block is the direct output from seccomp_export_pfc() after adding alpha to the test. It is sane as reference output: the audit arch token is AUDIT_ARCH_ALPHA, the syscall numbers match alpha (open=45, close=6, read=3, write=4, fstat=91, exit_group=405), and the rule actions/argument checks mirror the existing 64-bit architectures. No existing architecture output is changed; the golden file is only extended with the reviewed alpha section. Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
Add missing alpha entries to special_syscalls so syscall CSV generation succeeds for alpha. Also add known alpha syscall numbers for legacy/special syscalls such as tuxcall, bdflush, uselib, and afs_syscall instead of incorrectly marking them as undefined. Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
fc8c76d to
9090720
Compare
mattst88
left a comment
There was a problem hiding this comment.
I built this and ran the test suite on an AlphaServer ES47 running a 7.3 kernel with the SECCOMP_FILTER patch, and also on x86_64.
As posted, src/syscalls.csv has no alpha column but struct arch_syscall_table does, so every arch after aarch64 picks up the values from the column to its left. On x86_64, scmp_sys_resolver -a loongarch64 openat returns 288 (m68k's number) and make check has 132 failures across 10 tests. The CSV needs to be regenerated in the same commit that adds the struct fields.
To get further, I spliced an alpha column into the CSV from the kernel's alpha syscall tables. With that, everything builds cleanly on alpha. The sim and basic tests pass except for the issues noted inline, and the C live tests pass against the kernel. A few other things:
tests/16-sim-arch_basic.pyandtests/23-sim-arch_all_le_basic.pyneed the same alpha additions as their C counterparts. Without them, running the suite on an alpha host gives 9 failures with "bpf_sim resulted in KILL".- The Python live tests 21, 24, 32 and 54 fail on alpha. Alpha has no vDSO, so the interpreter's
clock_gettime()is a real syscall and gets trapped. The Python SIGSYS handler is installed without SA_SIGINFO, so it returns throughsigreturnrather thanrt_sigreturn, and that gets trapped too. 64-live-trapxfails in both C and Python because glibc on alpha implementsgetppid()withgetxpid, so the filter rule ongetppidnever matches. Callingsyscall(__NR_getppid)directly, or picking a different syscall, would fix it.- The first commit needs a commit message body and a Signed-off-by. The pfc golden file update should be squashed into the commit that adds alpha to test 38.
| int aarch64; | ||
| enum scmp_kver aarch64_kver; | ||
|
|
||
| int alpha; |
There was a problem hiding this comment.
This needs a matching alpha,alpha_kver column in src/syscalls.csv at the same position, after aarch64_kver. arch-gperf-generate fills this struct by position, so without the column every arch from loongarch64 onward is off by one.
When regenerating, note that alpha's uapi unistd.h has #define __NR_getpid __NR_getxpid, and does the same for getuid and getgid. The CSV needs 20, 24 and 47 for those, not PNR, or the build fails with '__PNR_getpid' undeclared.
There was a problem hiding this comment.
Thanks for taking a look at this Matt,
In order to run the test you first need to generate a fresh syscalls.csv, this is what I did:
first:
I had to clone the git repo for https://github.com/hrw/syscalls-table.git
./src/arch-build-kver-tables.py -d "$PWD/syscalls-table" -k
"$HOME/linux-git" -V 6.14,6.15,6.16
second:
(manually edit/shorten the kernel_versions list in the script, use same as
above, for example: 6.14,6.15,6.16 )
./src/arch-create-syscalls-csv.py -d . -k /usr/src/linux -o src/syscalls.csv
Should an updated syscalls.csv be part of this PR maybe?
| 'x32': [42, 'UNDEF'], | ||
| 'alpha': [None, 'UNDEF'], |
There was a problem hiding this comment.
x32 doesn't have nfsservctl: syscall_64.tbl lists 180 64 nfsservctl, so it's 64-bit only. 42 on x32 is connect. Alpha does reserve a number for it, 342 common nfsservctl sys_ni_syscall, which matches how afs_syscall, tuxcall, etc. are handled above.
| 'x32': [42, 'UNDEF'], | |
| 'alpha': [None, 'UNDEF'], | |
| 'x32': [None, 'UNDEF'], | |
| 'alpha': [342, 'UNDEF'], |
| if ($a2.hi32 == 0) | ||
| if ($a2.lo32 >= 2) | ||
| else | ||
| action TRAP; |
There was a problem hiding this comment.
The output format changed to action TRAP(0); in de2bf46 ("api,doc,tests: Add SCMP_ACT_TRAPX()"). This block has 8 action TRAP; lines, which is the only remaining diff in test 38. The block needs to be regenerated against current main.
| /** | ||
| * The Alpha architecture tokens | ||
| */ | ||
| #define SCMP_ARCH_ALPHA AUDIT_ARCH_ALPHA |
There was a problem hiding this comment.
The other arches have a fallback for older kernel headers. AUDIT_ARCH_ALPHA has been around long enough that it probably doesn't matter, but for consistency:
| #define SCMP_ARCH_ALPHA AUDIT_ARCH_ALPHA | |
| #ifndef AUDIT_ARCH_ALPHA | |
| #ifndef EM_ALPHA | |
| #define EM_ALPHA 0x9026 | |
| #endif /* EM_ALPHA */ | |
| #define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | |
| #endif /* AUDIT_ARCH_ALPHA */ | |
| #define SCMP_ARCH_ALPHA AUDIT_ARCH_ALPHA |
| #define __PNR_listns -10252 | ||
| #define __PNR_rseq_slice_yield -10253 | ||
| #define __PNR_uprobe -10254 | ||
| #define __PNR_open_tree_attr -10255 |
There was a problem hiding this comment.
This looks like a fix for building against kernel headers that predate open_tree_attr, not something alpha-specific (alpha's headers define it as 577). Could it go in a separate commit?
| rc_log=164 | ||
| ;; | ||
| mips|mipsel|mips64|mips64n32|mipsel64|mipsel64n32) | ||
| alpha|mips|mipsel|mips64|mips64n32|mipsel64|mipsel64n32) |
There was a problem hiding this comment.
140 is correct for alpha: SIGSYS is 12 there, the same as on MIPS. I confirmed it with the kill tests on hardware.
This adds architecture support for Alpha, the other architecture besides SPARC which is unsupported yet.
A patch to add support for
SECCOMP_FILTERwas just posted to LKML.This PR is missing the update to
src/syscalls.csvsince I have no clue how that works now. See this issue.CC @linmag7 who is working on the kernel part.