lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 6 Mar 2023 20:43:30 -0800
From:   Namhyung Kim <namhyung@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Martin KaFai Lau <martin.lau@...nel.org>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        bpf@...r.kernel.org
Subject: Re: [PATCH] perf lock contention: Fix builtin detection

Hi Ian,

On Mon, Mar 6, 2023 at 7:21 PM Ian Rogers <irogers@...gle.com> wrote:
>
> __has_builtin was passed the macro rather than the actual builtin
> feature.

Oh, I missed it's a macro define in tools/lib/bpf/bpf_core_read.h file.

Looking at some BPF test codes, it seems you also need to check the
clang compiler version.  Please take a look at the file below:

  tools/testing/selftests/bpf/progs/test_core_reloc_type_base.c

Thanks,
Namhyung

>
> Fixes: 1bece1351c65 ("perf lock contention: Support old rw_semaphore type")
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
>  tools/perf/util/bpf_skel/lock_contention.bpf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/bpf_skel/lock_contention.bpf.c b/tools/perf/util/bpf_skel/lock_contention.bpf.c
> index e6007eaeda1a..e422eee0f942 100644
> --- a/tools/perf/util/bpf_skel/lock_contention.bpf.c
> +++ b/tools/perf/util/bpf_skel/lock_contention.bpf.c
> @@ -182,7 +182,7 @@ static inline struct task_struct *get_lock_owner(__u64 lock, __u32 flags)
>                 struct mutex *mutex = (void *)lock;
>                 owner = BPF_CORE_READ(mutex, owner.counter);
>         } else if (flags == LCB_F_READ || flags == LCB_F_WRITE) {
> -#if __has_builtin(bpf_core_type_matches)
> +#if __has_builtin(__builtin_preserve_type_info)
>                 if (bpf_core_type_matches(struct rw_semaphore___old)) {
>                         struct rw_semaphore___old *rwsem = (void *)lock;
>                         owner = (unsigned long)BPF_CORE_READ(rwsem, owner);
> --
> 2.40.0.rc0.216.gc4246ad0f0-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ