Re: [PATCH v4 0/5] siginfo: ABI fixes for TRAP_PERF

From: Eric W. Biederman
Date: Mon May 17 2021 - 23:47:04 EST


Marco Elver <elver@xxxxxxxxxx> writes:

> On Mon, 17 May 2021 at 21:58, Eric W. Biederman <ebiederm@xxxxxxxxxxxx> wrote:
>>
>> During the merge window an issue with si_perf and the siginfo ABI came
>> up. The alpha and sparc siginfo structure layout had changed with the
>> addition of SIGTRAP TRAP_PERF and the new field si_perf.
>>
>> The reason only alpha and sparc were affected is that they are the
>> only architectures that use si_trapno.
>>
>> Looking deeper it was discovered that si_trapno is used for only
>> a few select signals on alpha and sparc, and that none of the
>> other _sigfault fields past si_addr are used at all. Which means
>> technically no regression on alpha and sparc.
>>
>> While the alignment concerns might be dismissed the abuse of
>> si_errno by SIGTRAP TRAP_PERF does have the potential to cause
>> regressions in existing userspace.
>>
>> While we still have time before userspace starts using and depending on
>> the new definition siginfo for SIGTRAP TRAP_PERF this set of changes
>> cleans up siginfo_t.
>>
>> - The si_trapno field is demoted from magic alpha and sparc status and
>> made an ordinary union member of the _sigfault member of siginfo_t.
>> Without moving it of course.
>>
>> - si_perf is replaced with si_perf_data and si_perf_type ending the
>> abuse of si_errno.
>>
>> - Unnecessary additions to signalfd_siginfo are removed.
>>
>> v3: https://lkml.kernel.org/r/m1tuni8ano.fsf_-_@xxxxxxxxxxxxxxxxx
>> v2: https://lkml.kernel.org/r/m14kfjh8et.fsf_-_@xxxxxxxxxxxxxxxxx
>> v1: https://lkml.kernel.org/r/m1zgxfs7zq.fsf_-_@xxxxxxxxxxxxxxxxx
>>
>> This version drops the tests and fine grained handling of si_trapno
>> on alpha and sparc (replaced assuming si_trapno is valid for
>> all but the faults that defined different data).
>
> And just to clarify, the rest of the series (including static-asserts)
> for the next merge-window will be sent once this series is all sorted,
> correct?

That is the plan.

I really wonder about alphas use of si_trapno, and alphas use send_sig
instead of force_sig. It could be worth looking into those as it
has the potential to simplify the code.

>> Eric W. Biederman (5):
>> siginfo: Move si_trapno inside the union inside _si_fault
>> signal: Implement SIL_FAULT_TRAPNO
>> signal: Factor force_sig_perf out of perf_sigtrap
>> signal: Deliver all of the siginfo perf data in _perf
>> signalfd: Remove SIL_PERF_EVENT fields from signalfd_siginfo
>
> Looks good, thank you! I build-tested (defconfig -- x86_64, i386, arm,
> arm64, m68k, sparc, alpha) this series together with a local patch to
> pull in the static asserts from v3. Also re-ran perf_events kselftests
> on x86_64 (native and 32bit compat).

Thanks,

Can I have your Tested-by?

Eric