From: Beau Belgrave <beaub@linux.microsoft.com>
To: rostedt@goodmis.org, mhiramat@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
cleger@rivosinc.com, linux-kselftest@vger.kernel.org
Subject: [PATCH 0/2] tracing/user_events: Fix alignment issues for 32 on 64-bit and BE
Date: Mon, 25 Sep 2023 23:08:27 +0000 [thread overview]
Message-ID: <20230925230829.341-1-beaub@linux.microsoft.com> (raw)
All architectures should use a long aligned address passed to set_bit().
User processes can pass either a 32-bit or 64-bit sized value to be
updated when tracing is enabled when on a 64-bit kernel. Both cases are
ensured to be naturally aligned, however, that is not enough. The
address must be long aligned without affecting checks on the value
within the user process which require different adjustments for the bit
for little and big endian CPUs.
32 bit on 64 bit, even when properly long aligned, still require a 32 bit
offset to be done for BE. Due to this, it cannot be easily put into a
generic method.
The abi_test also used a long, which broke the test on 64-bit BE machines.
The change simply uses an int for 32-bit value checks and a long when on
64-bit kernels for 64-bit specific checks.
I've run these changes and self tests for user_events on ppc64 BE, x86_64
LE, and aarch64 LE. It'd be great to test this also on RISC-V, but I do
not have one.
Clément Léger originally put a patch together for the alignment issue, but
we uncovered more issues as we went further into the problem. Clément felt
my version was better [1] so I am sending this series out that addresses
the selftest, BE bit offset, and the alignment issue.
1. https://lore.kernel.org/linux-trace-kernel/713f4916-00ff-4a24-82d1-72884500a2d3@rivosinc.com/
Beau Belgrave (2):
tracing/user_events: Align set_bit() address for all archs
selftests/user_events: Fix abi_test for BE archs
kernel/trace/trace_events_user.c | 58 ++++++++++++++++---
.../testing/selftests/user_events/abi_test.c | 16 ++---
2 files changed, 60 insertions(+), 14 deletions(-)
base-commit: fc1653abba0d554aad80224e51bcad42b09895ed
--
2.34.1
next reply other threads:[~2023-09-25 23:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 23:08 Beau Belgrave [this message]
2023-09-25 23:08 ` [PATCH 1/2] tracing/user_events: Align set_bit() address for all archs Beau Belgrave
2023-09-25 23:08 ` [PATCH 2/2] selftests/user_events: Fix abi_test for BE archs Beau Belgrave
2023-10-04 0:59 ` Steven Rostedt
2023-10-04 15:10 ` Shuah Khan
2023-10-04 15:14 ` Steven Rostedt
2023-10-04 16:38 ` Shuah Khan
2023-10-05 14:48 ` Shuah Khan
2023-10-05 15:08 ` Steven Rostedt
2023-10-05 16:52 ` Beau Belgrave
2023-10-05 17:46 ` Steven Rostedt
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=20230925230829.341-1-beaub@linux.microsoft.com \
--to=beaub@linux.microsoft.com \
--cc=cleger@rivosinc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).