From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Stephane Eranian <eranian@google.com>,
Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>
Subject: Re: [PATCH] perf test: Fix unaligned access in sample parsing test
Date: Thu, 18 Feb 2021 16:09:08 -0300 [thread overview]
Message-ID: <YC67VPX6rarQ0S8Q@kernel.org> (raw)
In-Reply-To: <870d16e1-30dc-161d-33bf-e35428260ec6@intel.com>
Em Mon, Feb 15, 2021 at 08:26:08AM +0200, Adrian Hunter escreveu:
> On 14/02/21 11:16 am, Namhyung Kim wrote:
> > The ubsan reported the following error. It was because sample's raw
> > data missed u32 padding at the end. So it broke the alignment of the
> > array after it.
> >
> > The raw data contains an u32 size prefix so the data size should have
> > an u32 padding after 8-byte aligned data.
> >
> > 27: Sample parsing :util/synthetic-events.c:1539:4:
> > runtime error: store to misaligned address 0x62100006b9bc for type
> > '__u64' (aka 'unsigned long long'), which requires 8 byte alignment
> > 0x62100006b9bc: note: pointer points here
> > 00 00 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> > ^
> > #0 0x561532a9fc96 in perf_event__synthesize_sample util/synthetic-events.c:1539:13
> > #1 0x5615327f4a4f in do_test tests/sample-parsing.c:284:8
> > #2 0x5615327f3f50 in test__sample_parsing tests/sample-parsing.c:381:9
> > #3 0x56153279d3a1 in run_test tests/builtin-test.c:424:9
> > #4 0x56153279c836 in test_and_print tests/builtin-test.c:454:9
> > #5 0x56153279b7eb in __cmd_test tests/builtin-test.c:675:4
> > #6 0x56153279abf0 in cmd_test tests/builtin-test.c:821:9
> > #7 0x56153264e796 in run_builtin perf.c:312:11
> > #8 0x56153264cf03 in handle_internal_command perf.c:364:8
> > #9 0x56153264e47d in run_argv perf.c:408:2
> > #10 0x56153264c9a9 in main perf.c:538:3
> > #11 0x7f137ab6fbbc in __libc_start_main (/lib64/libc.so.6+0x38bbc)
> > #12 0x561532596828 in _start ...
> >
> > SUMMARY: UndefinedBehaviorSanitizer: misaligned-pointer-use
> > util/synthetic-events.c:1539:4 in
Thanks, applied.
- Arnaldo
> > Fixes: 045f8cd8542d ("perf tests: Add a sample parsing test")
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
> > ---
> > tools/perf/tests/sample-parsing.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
> > index f506eabfc269..0dbe3aa99853 100644
> > --- a/tools/perf/tests/sample-parsing.c
> > +++ b/tools/perf/tests/sample-parsing.c
> > @@ -202,7 +202,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
> > .data = {1, -1ULL, 211, 212, 213},
> > };
> > u64 regs[64];
> > - const u64 raw_data[] = {0x123456780a0b0c0dULL, 0x1102030405060708ULL};
> > + const u32 raw_data[] = {0x12345678, 0x0a0b0c0d, 0x11020304, 0x05060708, 0 };
> > const u64 data[] = {0x2211443366558877ULL, 0, 0xaabbccddeeff4321ULL};
> > const u64 aux_data[] = {0xa55a, 0, 0xeeddee, 0x0282028202820282};
> > struct perf_sample sample = {
> >
>
--
- Arnaldo
prev parent reply other threads:[~2021-02-18 19:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-14 9:16 [PATCH] perf test: Fix unaligned access in sample parsing test Namhyung Kim
2021-02-15 6:26 ` Adrian Hunter
2021-02-18 19:09 ` Arnaldo Carvalho de Melo [this message]
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=YC67VPX6rarQ0S8Q@kernel.org \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@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.