Comment 2 for bug 2042388

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

The stress-ng maintainer, Colin, has investigated this, allow me to copy his comment:

Seems like a signal handler occurring in a swapped context is causing a SIGSEGV when we're using an alternative stack (via sigaltstack). Disabling the alternative stack allows the test to run successfully. I've experimented with also using ss_flags=SS_AUTODISARM when setting up the alternative stack and this also breaks with a SIGSEGV.

It seems there maybe historic issues with linux and alternative stacks when executing in a swap context, as sigaltstack man page states:

       ss.ss_flags
              This field contains either 0, or the following flag:

              SS_AUTODISARM (since Linux 4.7)
                     Clear the alternate signal stack settings on entry to the signal handler. When the signal handler
                     returns, the previous alternate signal stack settings are restored.

                     This flag was added in order to make it safe to switch away from the signal handler with swapcon‐
                     text(3). Without this flag, a subsequently handled signal will corrupt the state of the switched-
                     away signal handler. On kernels where this flag is not supported, sigaltstack() fails with the error
                     EINVAL when this flag is supplied.

since this is a regression in behaviour I think somebody with riscv libc know-how should investigate this further. Meanwhile I'll push a change that disables the use of the alternative stack for the context switch stressor.

https://github.com/ColinIanKing/stress-ng/issues/331