Skip to content

Commit ddecd22

Browse files
melverPeter Zijlstra
authored andcommitted
perf: uapi: Document perf_event_attr::sig_data truncation on 32 bit architectures
Due to the alignment requirements of siginfo_t, as described in 3ddb3fd ("signal, perf: Fix siginfo_t by avoiding u64 on 32-bit architectures"), siginfo_t::si_perf_data is limited to an unsigned long. However, perf_event_attr::sig_data is an u64, to avoid having to deal with compat conversions. Due to being an u64, it may not immediately be clear to users that sig_data is truncated on 32 bit architectures. Add a comment to explicitly point this out, and hopefully help some users save time by not having to deduce themselves what's happening. Reported-by: Dmitry Vyukov <[email protected]> Signed-off-by: Marco Elver <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Dmitry Vyukov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 95d29fa commit ddecd22

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/uapi/linux/perf_event.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,8 @@ struct perf_event_attr {
465465
/*
466466
* User provided data if sigtrap=1, passed back to user via
467467
* siginfo_t::si_perf_data, e.g. to permit user to identify the event.
468+
* Note, siginfo_t::si_perf_data is long-sized, and sig_data will be
469+
* truncated accordingly on 32 bit architectures.
468470
*/
469471
__u64 sig_data;
470472
};

0 commit comments

Comments
 (0)