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:   Tue, 31 May 2022 23:01:14 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Jiri Olsa <jolsa@...nel.org>,
        Andrii Nakryiko <andrii@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Hao Luo <haoluo@...gle.com>, bpf <bpf@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Andi Kleen <ak@...ux.intel.com>,
        Song Liu <songliubraving@...com>,
        Milian Wolff <milian.wolff@...b.com>,
        linux-perf-users <linux-perf-users@...r.kernel.org>,
        Blake Jones <blakejones@...gle.com>
Subject: Re: [PATCH 2/6] perf record: Enable off-cpu analysis with BPF

On Tue, May 31, 2022 at 5:00 PM Ian Rogers <irogers@...gle.com> wrote:
>
> On Wed, May 18, 2022 at 3:47 PM Namhyung Kim <namhyung@...nel.org> wrote:
[SNIP]
> > +
> > +/*
> > + * Old kernel used to call it task_struct->state and now it's '__state'.
> > + * Use BPF CO-RE "ignored suffix rule" to deal with it like below:
> > + *
> > + * https://nakryiko.com/posts/bpf-core-reference-guide/#handling-incompatible-field-and-type-changes
> > + */
> > +static inline int get_task_state(struct task_struct *t)
> > +{
> > +       if (bpf_core_field_exists(t->__state))
> > +               return BPF_CORE_READ(t, __state);
> > +
>
> When building against a pre-5.14 kernel I'm running into a build issue here:
>
> tools/perf/util/bpf_skel/off_cpu.bpf.c:96:31: error: no member named '__
> state' in 'struct task_struct'; did you mean 'state'?
>        if (bpf_core_field_exists(t->__state))
>                                     ^~~~~~~
>                                     state
>
> This isn't covered by Andrii's BPF CO-RE reference guide. I have an
> #iffy workaround below,but this will be brittle if the 5.14+ kernel
> code is backported. Suggestions welcomed :-)

Thanks for the fix.  I think we should not guess the field name
in the current task struct and check both versions separately.
I'm afraid the version check won't work with some backported
kernels.  But do we care?

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ