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]
Message-ID: <YVSzjzV+Jb7loGxI@krava>
Date:   Wed, 29 Sep 2021 20:42:23 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Joe Mario <jmario@...hat.com>, kan.liang@...ux.intel.com,
        linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 1/2] perf script: Fix PERF_SAMPLE_WEIGHT_STRUCT support

On Wed, Sep 29, 2021 at 01:54:39PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Sep 29, 2021 at 08:38:13AM -0700, kan.liang@...ux.intel.com escreveu:
> > From: Kan Liang <kan.liang@...ux.intel.com>
> > 
> > -F weight in perf script is broken.
> > 
> >   # ./perf mem record
> >   # ./perf script -F weight
> >   Samples for 'dummy:HG' event do not have WEIGHT attribute set. Cannot
> > print 'weight' field.
> > 
> > The sample type, PERF_SAMPLE_WEIGHT_STRUCT, is an alternative of the
> > PERF_SAMPLE_WEIGHT sample type. They share the same space, weight. The
> > lower 32 bits are exactly the same for both sample type. The higher 32
> > bits may be different for different architecture. For a new kernel on
> > x86, the PERF_SAMPLE_WEIGHT_STRUCT is used. For an old kernel or other
> > ARCHs, the PERF_SAMPLE_WEIGHT is used.
> > 
> > With -F weight, current perf script will only check the input string
> > "weight" with the PERF_SAMPLE_WEIGHT sample type. Because the commit
> > ea8d0ed6eae3 ("perf tools: Support PERF_SAMPLE_WEIGHT_STRUCT") didn't
> > update the PERF_SAMPLE_WEIGHT_STRUCT sample type for perf script. For a
> > new kernel on x86, the check fails.
> > 
> > Use PERF_SAMPLE_WEIGHT_TYPE, which supports both sample types, to
> > replace PERF_SAMPLE_WEIGHT.
> > 
> > Reported-by: Joe Mario <jmario@...hat.com>
> > Fixes: ea8d0ed6eae3 ("perf tools: Support PERF_SAMPLE_WEIGHT_STRUCT")
> 
> Hey Joe, Jiri,
> 
> 	Can I have your Tested-by?

Acked/Tested-by: Jiri Olsa <jolsa@...hat.com>

thanks,
jirka

> 
> Thanks,
> 
> - Arnaldo
> 
> > Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
> > ---
> >  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 6211d0b..9f62ac6 100644
> > --- a/tools/perf/builtin-script.c
> > +++ b/tools/perf/builtin-script.c
> > @@ -459,7 +459,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session)
> >  		return -EINVAL;
> >  
> >  	if (PRINT_FIELD(WEIGHT) &&
> > -	    evsel__check_stype(evsel, PERF_SAMPLE_WEIGHT, "WEIGHT", PERF_OUTPUT_WEIGHT))
> > +	    evsel__check_stype(evsel, PERF_SAMPLE_WEIGHT_TYPE, "WEIGHT", PERF_OUTPUT_WEIGHT))
> >  		return -EINVAL;
> >  
> >  	if (PRINT_FIELD(SYM) &&
> > -- 
> > 2.7.4
> 
> -- 
> 
> - Arnaldo
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ