From: lion@... Date: 2018-07-02T19:21:56+00:00 Subject: [ruby-core:87756] [Ruby trunk Bug#14883] Ruby 2.5 Fails to Build on PowerPC 32-bit (BE) Issue #14883 has been updated by lion (Daming Yang). Bingo. It is also an issue for the systemd-nspawn container indeed. systemd-nspawn have used a libseccomp whitelist instead of a blacklist by default since last year. `rt_sigprocmask()` & `sigprocmask()` are on the whitelist, but `swapcontext()` is not. Addressed the container issue at https://github.com/systemd/systemd/issues/9485 **You may add `--system-call-filter=swapcontext` on your systemd-nspawn command line as a workaround.** I hope Ruby will have an enhancement for reporting the error of `getcontext()`. lion (Daming Yang) wrote: > contd. > > When it comes to a glibc function `getcontext()`, 'the root issue' of the bug, we can check it in this way: > > ~~~c > // cat lion_getcontext.c > #include > #include > int main() { > ucontext_t c; > if (getcontext(&c) < 0) > return errno; > return 0; > } > // gcc lion_getcontext.c && ./a.out; echo $? > ~~~ > > Note that the 'host' Bai has, is 32-bit (PPC32) userspace container(systemd-nspawn) on a 64-bit (PPC64) kernel. > > Although the container is a kind of virtualisation, I think it does matter when it comes to glibc and syscall. > > After running the test program, I got > - 0 on my amd64 laptop, > - 0 on Bai's PPC64 machine, > - 1(EPERM) on the PPC32-over-PPC64 container. This is why Ruby SEGV'ed on here. > > Use `strace ./a.out` to trace syscalls. Interesting, the underlying syscalls are different. > ~~~ > AMD64: rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 > PPC64: rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 > PPC32-over-PPC64: swapcontext(0xfffa8dc8, 0) = -1 EPERM (Operation not permitted) > ~~~ > > But it was weird. > It seems that neither https://github.com/torvalds/linux/blob/v4.8/arch/powerpc/kernel/signal_64.c#L588 > nor https://github.com/torvalds/linux/blob/v4.8/arch/powerpc/kernel/signal_32.c#L1121 > has `return -EPERM;` or does likewise. > > Why was the errno `EPERM`? SELinux is disabled. > Is it a Linux *capability* issue only if programs run in a systemd-nspawn container? ---------------------------------------- Bug #14883: Ruby 2.5 Fails to Build on PowerPC 32-bit (BE) https://bugs.ruby-lang.org/issues/14883#change-72780 * Author: mingcongbai (Mingcong Bai) * Status: Feedback * Priority: Normal * Assignee: * Target version: * ruby -v: 2.5.1 * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- When building Ruby 2.5.1 on a PowerPC 32-bit (Big Endian) host, the build fails as it generates rdoc - segmentation fault. The build log is as follows: https://pastebin.aosc.io/paste/jJWjWPadcmJeLEkvpgnMqQ Configure parameters... ... \ --enable-shared \ --disable-rpath \ --with-dbm-type=gdbm_compat On the same host with the same build environment, Ruby 2.4 builds just fine. The current Git master exhibits the same issue. -- https://bugs.ruby-lang.org/ Unsubscribe: