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 10 lines · Florian Weimer
Quoted 8 lines · Dave Martin

This new record can be added in sigframe.__reserved[] if there is a need to allocate extra space beyond the standard signal frame. The extra block of memory referenced by extra_context can then be parsed in the same way as sigcontext.__reserved[]. Old code should just ignore the whole thing as an unrecognised record. To maintain backward compatibility, signal context records defined today are always placed directly in __reserved[], never in the block referenced by extra_context.

Quoted 6 lines

Do you add this extra information only if the stack is sufficiently large?

x86_64 adds the new information even for small stacks set up with sigaltstack, leading to memory corruption on bleeding-edge hardware:

<https://bugzilla.kernel.org/show_bug.cgi?id=153531>

Hmmm, not yet. We already check that the whole frame is writable user memory, but this isn't sufficient to avoid user corruption in the case of alternate signal stacks. I'll fix this -- thanks for flagging it.

If the stack isn't large enough, we'll still have to SEGV the task though.

We can (and should) bump up the SIG{,MIN}STKSZ constants when adding the SVE support proper to the kernel, but this doesn't solve the problem of existing binaries. For backwards compatibility the kernel would still have to permit the historical (too-small) values of these constants for calls to sigaltstack(2) though, which is not ideal.

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

Cheers
---Dave