linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Kan Liang <kan.liang@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org,
	Howard Chu <howardchu95@gmail.com>
Subject: [BUG] perf trace: Unaligned access in timespec
Date: Thu, 19 Dec 2024 13:43:31 -0800	[thread overview]
Message-ID: <Z2STgyD1p456Qqhg@google.com> (raw)

Hello,

I found perf trace is getting core dump due to illegal instruction by
misaligned pointer access.  It seems to come with the new clang changes
and I got this UBsan message.

  $ sudo ./perf trace -a sleep 1
  ...
  tools/perf/trace/beauty/timespec.c:10:64: runtime error: member access within misaligned address
  					  0x7f57636105e4 for type 'struct augmented_arg',
  					  which requires 8 byte alignment
  0x7f57636105e4: note: pointer points here
    ad 7f 00 00 10 00 00 00  00 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
                ^ 
      #0 0x5637d68d0ed7 in syscall_arg__scnprintf_augmented_timespec tools/perf/trace/beauty/timespec.c:10:64
      #1 0x5637d68d0ed7 in syscall_arg__scnprintf_timespec tools/perf/trace/beauty/timespec.c:18:10
      #2 0x5637d688dfef in syscall_arg_fmt__scnprintf_val tools/perf/builtin-trace.c:2316:10
      #3 0x5637d688dfef in syscall__scnprintf_args tools/perf/builtin-trace.c:2394:15
      #4 0x5637d68838ee in trace__sys_enter tools/perf/builtin-trace.c:2675:13
      #5 0x5637d688ec8c in trace__handle_event tools/perf/builtin-trace.c:3495:3
      #6 0x5637d688ec8c in __trace__deliver_event tools/perf/builtin-trace.c:4045:3
      #7 0x5637d6886841 in trace__deliver_event tools/perf/builtin-trace.c:4072:10
      #8 0x5637d6886841 in trace__run tools/perf/builtin-trace.c:4432:10
      #9 0x5637d688112b in cmd_trace tools/perf/builtin-trace.c:5521:9
      #10 0x5637d67af002 in run_builtin tools/perf/perf.c:351:11
      #11 0x5637d67aee36 in handle_internal_command tools/perf/perf.c:404:8
      #12 0x5637d67ae76e in run_argv tools/perf/perf.c:448:2
      #13 0x5637d67ae76e in main tools/perf/perf.c:562:3
      #14 0x7f576498a3d3 in __libc_start_main (/usr/lib64/libc.so.6+0x613d3)
      #15 0x5637d6793f69 in _start /usr/src/csu/../sysdeps/x86_64/start.S:120
  
  SUMMARY: UndefinedBehaviorSanitizer: misaligned-pointer-use tools/perf/trace/beauty/timespec.c:10:64

Thanks,
Namhyung


                 reply	other threads:[~2024-12-19 21:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Z2STgyD1p456Qqhg@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=howardchu95@gmail.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@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 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).