Skip to content

RFC arm64: Signal context expansion

Dave Martin linux-arm-kernel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest0 of 5 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 5 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/5] arm64: Signal context expansion
Quoted 1 line · Szabolcs Nagy

On 12/09/16 12:17, Dave Martin wrote:

[...]

Quoted 1 line
Quoted 1 line
Quoted 1 line · Dave Martin

[...]

Quoted 27 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

I wonder whether we should make the signal stack size runtime discoverable through sysconf() instead...

I will likely suggest this for the future, but of course it doesn't help for current binaries.

Quoted 9 lines

Note that MINSIGSTKSZ stared life wrong for arm64, and has since gone through a few ABI breaking changes. I don't condone this, but we have form in this area :/

sigaltstack() already fails with ENOMEM for software that passes ss_size = MINSIGSTKSZ, and is built against glibc<2.22 [1], [2], running on linux>=4.3 [3], which is an ABI break in case where sigaltstack() is otherwise guaranteed to succeed.

yes, this was abi breaking change.

if glibc does not care about existing binaries that use sigaltstack with MINSIGSTKSZ then it can increase the size, but i think the kernel should not change the abi (there are other libcs and libc independent runtime systems on linux for aarch64 with their own sigaltstack setup, not all of them may care about SVE).

Quoted 2 lines

i assume the kernel can avoid saving SVE regs when they are not used by the process.

I can (and do), in my patches (not posted yet).

The real issue here is that a recently updated shared library might be optimised to use SVE, where the program using it is an older, SVE- unaware binary.

(think of an optimised math library using some new fancy SVE-based number crunching internally).

Quoted 7 lines
Quoted 6 lines

The bottom line here is that the sigaltstack() API is broken with regard to extensibility, so we cannot extend the amount of signal state without breaking something.

Quoted 5 lines

extending signal state can break things independently of sigaltstack.

binaries with strict guarantees about worst case stack usage can change behaviour.

Indeed, but this is not a new issue. Software must run with enough stack in order to be portable, but there is no portable way to determine how much stack is needed.

Quoted 6 lines

fortunately glibc PTHREAD_STACK_MIN is huge on aarch64 so applications using it are unlikely to break because of the increased signal state.
(this also means it's impossible to have threads with tiny stacks on glibc, so large amount of threads means large amount of commit charge.)

Again, not a new problem.

[...]

Cheers
---Dave