[PATCH tip 1/2] signal, perf: Fix siginfo_t by avoiding u64 on 32-bit architectures

Jon Hunter jonathanh at nvidia.com
Thu Apr 22 09:15:30 BST 2021


On 22/04/2021 07:44, Marco Elver wrote:
> On some architectures, like Arm, the alignment of a structure is that of
> its largest member.
> 
> This means that there is no portable way to add 64-bit integers to
> siginfo_t on 32-bit architectures, because siginfo_t does not contain
> any 64-bit integers on 32-bit architectures.
> 
> In the case of the si_perf field, word size is sufficient since there is
> no exact requirement on size, given the data it contains is user-defined
> via perf_event_attr::sig_data. On 32-bit architectures, any excess bits
> of perf_event_attr::sig_data will therefore be truncated when copying
> into si_perf.
> 
> Since this field is intended to disambiguate events (e.g. encoding
> relevant information if there are more events of the same type), 32 bits
> should provide enough entropy to do so on 32-bit architectures.
> 
> For 64-bit architectures, no change is intended.
> 
> Fixes: fb6cc127e0b6 ("signal: Introduce TRAP_PERF si_code and si_perf to siginfo")
> Reported-by: Marek Szyprowski <m.szyprowski at samsung.com>
> Tested-by: Marek Szyprowski <m.szyprowski at samsung.com>
> Reported-by: Jon Hunter <jonathanh at nvidia.com>
> Signed-off-by: Marco Elver <elver at google.com>


Thanks for fixing!

Tested-by: Jon Hunter <jonathanh at nvidia.com>

Cheers
Jon

-- 
nvpublic



More information about the linux-arm-kernel mailing list