From: Marco Elver <elver@google.com>
To: elver@google.com, Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Dmitry Vyukov <dvyukov@google.com>,
linux-perf-users@vger.kernel.org, kasan-dev@googlegroups.com,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] perf: uapi: Document perf_event_attr::sig_data truncation on 32 bit architectures
Date: Mon, 31 Jan 2022 11:34:07 +0100 [thread overview]
Message-ID: <20220131103407.1971678-3-elver@google.com> (raw)
In-Reply-To: <20220131103407.1971678-1-elver@google.com>
Due to the alignment requirements of siginfo_t, as described in
3ddb3fd8cdb0 ("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 <dvyukov@google.com>
Signed-off-by: Marco Elver <elver@google.com>
---
include/uapi/linux/perf_event.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 1b65042ab1db..82858b697c05 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -465,6 +465,8 @@ struct perf_event_attr {
/*
* User provided data if sigtrap=1, passed back to user via
* siginfo_t::si_perf_data, e.g. to permit user to identify the event.
+ * Note, siginfo_t::si_perf_data is long-sized, and sig_data will be
+ * truncated accordingly on 32 bit architectures.
*/
__u64 sig_data;
};
--
2.35.0.rc2.247.g8bbb082509-goog
next prev parent reply other threads:[~2022-01-31 10:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-31 10:34 [PATCH 1/3] perf: Copy perf_event_attr::sig_data on modification Marco Elver
2022-01-31 10:34 ` [PATCH 2/3] selftests/perf_events: Test modification of perf_event_attr::sig_data Marco Elver
2022-02-01 7:33 ` Dmitry Vyukov
2022-02-03 14:33 ` [tip: perf/urgent] " tip-bot2 for Marco Elver
2022-01-31 10:34 ` Marco Elver [this message]
2022-02-01 7:33 ` [PATCH 3/3] perf: uapi: Document perf_event_attr::sig_data truncation on 32 bit architectures Dmitry Vyukov
2022-02-03 14:33 ` [tip: perf/urgent] " tip-bot2 for Marco Elver
2022-02-01 7:32 ` [PATCH 1/3] perf: Copy perf_event_attr::sig_data on modification Dmitry Vyukov
2022-02-01 11:07 ` Peter Zijlstra
2022-02-03 14:33 ` [tip: perf/urgent] " tip-bot2 for Marco Elver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220131103407.1971678-3-elver@google.com \
--to=elver@google.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=dvyukov@google.com \
--cc=jolsa@redhat.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.