aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2022-10-10 12:35:56 -0700
committerPaul Eggert2022-10-10 12:36:38 -0700
commit345de32a5db8ef165feeda77c99ce56e4d6e911c (patch)
tree6ad41cbca2e50dfaaa7fdc20609e46440795b557 /lib-src
parent8851a75ca7642ce071a23c24a81e22e443be0b05 (diff)
downloademacs-345de32a5db8ef165feeda77c99ce56e4d6e911c.tar.gz
emacs-345de32a5db8ef165feeda77c99ce56e4d6e911c.zip
Port bwrap/allows-stdout test to Ubuntu 22.04.1
Without this patch, Ubuntu 22.04.1 x86-64 "make check" reports a failure in test/src/emacs-tests.el’s emacs-tests/bwrap/allows-stdout. One can reproduce the bug without using the Emacs executable, by running this script: #!/bin/bash export LC_ALL=C exec strace -f -o /tmp/tr bwrap --ro-bind / / --seccomp 20 -- \ cat /dev/null 20< lib-src/seccomp-filter-exec.bpf This script exits with status 159, because "cat" didn’t get started (it got a SIGSYS signal early on). The command "journalctl -g SECCOMP" indicated that rseq (syscall 334) was the problem. This syscall is issued by /lib64/ld-linux-x86-64.so.2 before ‘main’ is called. There’s another problem with the clone3 syscall, which is used by pthread_create starting in glibc 2.34. pthread_create is called by g_child_watch_source_new, which is called by init_process_emacs. * lib-src/seccomp-filter.c (main): Allow rseq, clone3. This causes the test to pass. Perhaps a fancier, more accurate patch could be written by someone who has the time.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/seccomp-filter.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib-src/seccomp-filter.c b/lib-src/seccomp-filter.c
index 041bf5c749b..e45aa0c17f6 100644
--- a/lib-src/seccomp-filter.c
+++ b/lib-src/seccomp-filter.c
@@ -206,6 +206,9 @@ main (int argc, char **argv)
206 SCMP_A2_32 (SCMP_CMP_MASKED_EQ, 206 SCMP_A2_32 (SCMP_CMP_MASKED_EQ,
207 ~(PROT_NONE | PROT_READ | PROT_WRITE), 0)); 207 ~(PROT_NONE | PROT_READ | PROT_WRITE), 0));
208 208
209 /* Allow restartable sequences. The dynamic linker uses them. */
210 RULE (SCMP_ACT_ALLOW, SCMP_SYS (rseq));
211
209 /* Futexes are used everywhere. */ 212 /* Futexes are used everywhere. */
210 RULE (SCMP_ACT_ALLOW, SCMP_SYS (futex), 213 RULE (SCMP_ACT_ALLOW, SCMP_SYS (futex),
211 SCMP_A1_32 (SCMP_CMP_EQ, FUTEX_WAKE_PRIVATE)); 214 SCMP_A1_32 (SCMP_CMP_EQ, FUTEX_WAKE_PRIVATE));
@@ -324,6 +327,8 @@ main (int argc, char **argv)
324 | CLONE_SETTLS | CLONE_PARENT_SETTID 327 | CLONE_SETTLS | CLONE_PARENT_SETTID
325 | CLONE_CHILD_CLEARTID), 328 | CLONE_CHILD_CLEARTID),
326 0)); 329 0));
330 /* glibc 2.34+ pthread_create uses clone3. */
331 RULE (SCMP_ACT_ALLOW, SCMP_SYS (clone3));
327 RULE (SCMP_ACT_ALLOW, SCMP_SYS (sigaltstack)); 332 RULE (SCMP_ACT_ALLOW, SCMP_SYS (sigaltstack));
328 RULE (SCMP_ACT_ALLOW, SCMP_SYS (set_robust_list)); 333 RULE (SCMP_ACT_ALLOW, SCMP_SYS (set_robust_list));
329 334