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] [day] [month] [year] [list]
Message-ID: <CAM9d7cjFMSxA_E_EqAVpJeCYy0+78jsi2W1+cX-e7YAZuDKV3Q@mail.gmail.com>
Date:   Wed, 7 Sep 2022 10:44:13 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Jiri Olsa <jolsa@...hat.com>, Ian Rogers <irogers@...gle.com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf script: Fix sample type validation of dummy events

On Wed, Sep 7, 2022 at 8:49 AM Adrian Hunter <adrian.hunter@...el.com> wrote:
>
> Dummy events need the sample type only for ID samples and we expect perf
> to set up their sample type correctly for that purpose. Consequently
> there is no reason to attempt to validate the sample type against
> user-specified fields like 'iregs'.
>
> So skip sample type validation for dummy events.
>
> Example:
>
>  Before:
>
>    $ perf record --intr-regs=di,r8,dx,cx -e br_inst_retired.near_call:p,dummy -c 1000 uname
>    Linux
>    [ perf record: Woken up 1 times to write data ]
>    [ perf record: Captured and wrote 0.017 MB (18 samples) ]
>    $ perf script -F ip,sym,iregs
>    Samples for 'dummy' event do not have IREGS attribute set. Cannot print 'iregs' field.
>
>  After:
>
>    $ perf script -F ip,sym,iregs
>     ffffffffabf816f0 perf_iterate_ctx ABI:2    CX:0x0    DX:0xffffab5802bbfb60    DI:0xffff9f5e8a2a0800    R8:0x1
>     ffffffffabe034a0 x86_pmu_filter_match ABI:2    CX:0x0    DX:0xffffab5802bbfc68    DI:0xffff9f5fc7ad0ba0    R8:0xffff9f5fbf0504a0
>     ffffffffabe315c0 fpregs_assert_state_consistent ABI:2    CX:0x0    DX:0x0    DI:0xffffffffad0e77f1    R8:0x0
>     ffffffffabf90260 perf_event_mmap ABI:2    CX:0x0    DX:0xffffffffabfcedc0    DI:0xffff9f5fbf050540    R8:0x0
>     ffffffffabee76c0 __rcu_read_unlock ABI:2    CX:0x70    DX:0xffff9f5e812a300c    DI:0x7    R8:0xffffffffadc93aa0
>     ffffffffac85a1a0 debug_smp_processor_id ABI:2    CX:0x0    DX:0xffffab5802bbfd28    DI:0xffffffffad0e77f1    R8:0xffff9f5f69b869e0
>     ffffffffac0178e0 policy_nodemask ABI:2    CX:0x7fc123152000    DX:0xffffffffadc8ac80    DI:0x100cca    R8:0x0
>         7fc1231880d0 add_to_global_resize ABI:2    CX:0x7fc1231b7650    DX:0x7ffd7e896168    DI:0x5635ea713b0c    R8:0x7fc12317aa50
>     ffffffffabfcecc0 vmacache_update ABI:2    CX:0xffff9f5f69ab8000    DX:0xffff9f5f69b861a0    DI:0x7fc123055480    R8:0x0
>     ffffffffac85a1a0 debug_smp_processor_id ABI:2    CX:0x0    DX:0x0    DI:0xffffffffad0e77f1    R8:0x1
>     ffffffffac85a1a0 debug_smp_processor_id ABI:2    CX:0x0    DX:0xffffab5802bbfdb8    DI:0xffffffffad0e77f1    R8:0xffff9f5f69b86e60
>     ffffffffac00c120 PageHeadHuge ABI:2    CX:0x53    DX:0xf    DI:0xffffe312c47c1740    R8:0xffff9f5e83cb66c8
>     ffffffffabea1530 preempt_count_add ABI:2    CX:0xffffe312c886aa40    DX:0x5635eb38a    DI:0x1    R8:0x0
>     ffffffffabfedb90 flush_tlb_batched_pending ABI:2    CX:0x103a68067    DX:0x1    DI:0xffff9f5e80262c00    R8:0xffffab5802bbfd90
>     ffffffffabfe7340 __tlb_remove_page_size ABI:2    CX:0x25    DX:0x1000    DI:0xffffab5802bbfe00    R8:0x33f905025
>     ffffffffabfee490 page_remove_rmap ABI:2    CX:0x25    DX:0x0    DI:0xffffe312c4581e00    R8:0x116078025
>     ffffffffac85a1a0 debug_smp_processor_id ABI:2    CX:0x40    DX:0x8    DI:0xffff9f622042a540    R8:0x1
>     ffffffffabe6be00 vm_area_free ABI:2    CX:0x8015000f    DX:0x80000000    DI:0xffff9f5fbf050000    R8:0x1
>
> Cc: stable@...r.kernel.org
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>

Please see https://lore.kernel.org/all/20220831124041.219925-1-jolsa@kernel.org/

Thanks,
Namhyung


> ---
>  tools/perf/builtin-script.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 585171479876..eb263cdf51ee 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -411,7 +411,7 @@ static int evsel__do_check_stype(struct evsel *evsel, u64 sample_type, const cha
>         int type = output_type(attr->type);
>         const char *evname;
>
> -       if (attr->sample_type & sample_type)
> +       if (evsel__is_dummy_event(evsel) || attr->sample_type & sample_type)
>                 return 0;
>
>         if (output[type].user_set_fields & field) {
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ