mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@meta.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Howard Chu <howardchu95@gmail.com>,
	Andrea Righi <andrea.righi@linux.dev>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	linux-perf-use. <linux-perf-users@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"james.clark@linaro.org" <james.clark@linaro.org>,
	Alan Maguire <alan.maguire@oracle.com>
Subject: Re: [PATCH v2 0/2] perf trace: Fix support for the new BPF feature in clang 12
Date: Tue, 15 Oct 2024 21:37:40 +0000	[thread overview]
Message-ID: <6FEB3225-9B3F-4ECE-AB68-AFF00F5E03E8@fb.com> (raw)
In-Reply-To: <Zw7SkmEaz730uVbL@x1>



> On Oct 15, 2024, at 1:37 PM, Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> On Tue, Oct 15, 2024 at 04:58:56PM -0300, Arnaldo Carvalho de Melo wrote:
>> So I'm trying adding extra bounds checking, marking the index as
>> volatile, adding compiler barriers, etc, all the fun with the verifier,
>> but got distracted with other stuff, coming back to this now.
> 
>> Ok, the following seems to do the trick:
> 
>> [acme@dell-per740-01 perf-tools]$ git diff
>> diff --git a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
>> index 3b30aa74a3ae..ef87a04ff8d0 100644
>> --- a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
>> +++ b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
>> @@ -486,6 +486,7 @@ static int augment_sys_enter(void *ctx, struct syscall_enter_args *args)
>>                                augmented = true;
>>                } else if (size < 0 && size >= -6) { /* buffer */
>>                        index = -(size + 1);
>> +                       index &= 7; // To satisfy the bounds checking with the verifier in some kernels
>>                        aug_size = args->args[index];
>> 
>>                        if (aug_size > TRACE_AUG_MAX_BUF)
>> 
>> I'll now test it without Howard's patch to see if it fixes the RHEL8 +
>> clang 17 case.
> 
> It works with this one-liner + the simplified patch from Howard and also
> on this other system (RHEL9), as well as with Fedora 40, it would be
> nice if someone could test with clang 16 and report back the version of
> the kernel tested as well as the distro name/release, that way I can try
> to get my hands on such as system and test there as well.

I am testing this one-liner with clang 18.1.8 and an older kernel (it is 
our version of 5.12 kernel, but the BPF verifier there should be similar
to recent kernels). verifier still fails the program. IIUC, the compiler 
is smart enough to just remove the one-liner completely.


Thanks,
Song


  reply	other threads:[~2024-10-15 21:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  2:14 Howard Chu
2024-10-11  2:14 ` [PATCH v2 1/2] perf build: Change the clang check back to 12.0.1 Howard Chu
2024-10-11  2:14 ` [PATCH v2 2/2] perf trace: Rewrite BPF code to pass the verifier Howard Chu
2024-10-11  8:18 ` [PATCH v2 0/2] perf trace: Fix support for the new BPF feature in clang 12 James Clark
2024-10-15 18:32 ` Namhyung Kim
2024-10-15 19:35   ` Arnaldo Carvalho de Melo
2024-10-15 19:58     ` Arnaldo Carvalho de Melo
2024-10-15 20:37       ` Arnaldo Carvalho de Melo
2024-10-15 21:37         ` Song Liu [this message]
     [not found]           ` <CA+JHD905Xtbb2OYqm3mGbh3C1dKOd-avnC=01=uJfTVEnmA1zQ@mail.gmail.com>
2024-10-15 23:20             ` Song Liu
2024-10-16  2:06         ` Namhyung Kim
2024-10-16 14:22           ` Arnaldo Carvalho de Melo
2024-10-22 17:04             ` Namhyung Kim
2024-10-22 18:33               ` Arnaldo Carvalho de Melo
2024-10-22 23:52                 ` Namhyung Kim
2024-10-23 14:39                   ` Arnaldo Carvalho de Melo
2024-10-23 21:57                     ` Namhyung Kim

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=6FEB3225-9B3F-4ECE-AB68-AFF00F5E03E8@fb.com \
    --to=songliubraving@meta.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alan.maguire@oracle.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andrea.righi@linux.dev \
    --cc=howardchu95@gmail.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®