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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <164ED8DD-C9A0-40C2-AA12-EB8FA9D4C4C1@linux.vnet.ibm.com>
Date:   Wed, 2 Nov 2022 13:49:34 +0530
From:   Athira Rajeev <atrajeev@...ux.vnet.ibm.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Ian Rogers <irogers@...gle.com>,
        Madhavan Srinivasan <maddy@...ux.ibm.com>,
        Nageswara Sastry <rnsastry@...ux.ibm.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        linux-perf-users@...r.kernel.org,
        James Clark <james.clark@....com>,
        Jiri Olsa <jolsa@...nel.org>, Kajol Jain <kjain@...ux.ibm.com>,
        Namhyung Kim <namhyung@...nel.org>, disgoel@...ux.ibm.com,
        linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH] [perf/core: Update sample_flags for raw_data in
 perf_output_sample



> On 20-Oct-2022, at 8:10 PM, Peter Zijlstra <peterz@...radead.org> wrote:
> 
> On Thu, Oct 20, 2022 at 12:36:56PM +0530, Athira Rajeev wrote:
>> commit 838d9bb62d13 ("perf: Use sample_flags for raw_data")
>> added check for PERF_SAMPLE_RAW in sample_flags in
>> perf_prepare_sample(). But while copying the sample in memory,
>> the check for sample_flags is not added in perf_output_sample().
>> Fix adds the same in perf_output_sample as well.
>> 
>> Fixes: 838d9bb62d13 ("perf: Use sample_flags for raw_data")
>> Signed-off-by: Athira Rajeev <atrajeev@...ux.vnet.ibm.com>
>> ---
>> kernel/events/core.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/kernel/events/core.c b/kernel/events/core.c
>> index 4ec3717003d5..daf387c75d33 100644
>> --- a/kernel/events/core.c
>> +++ b/kernel/events/core.c
>> @@ -7099,7 +7099,7 @@ void perf_output_sample(struct perf_output_handle *handle,
>> 	if (sample_type & PERF_SAMPLE_RAW) {
>> 		struct perf_raw_record *raw = data->raw;
>> 
>> -		if (raw) {
>> +		if (raw && (data->sample_flags & PERF_SAMPLE_RAW)) {
>> 			struct perf_raw_frag *frag = &raw->frag;
>> 
>> 			perf_output_put(handle, raw->size);
> 
> Urgh.. something smells here. We already did a PERF_SAMPLE_RAW test.
> 
> And perf_prepare_sample() explicitly makes data->raw be NULL when not
> set earlier.
> 
> So what's going wrong?

Hi Peter,

Sorry for late response. I was out on vacation couple of days.

I didn't hit any specific issue or fail with current code. But patch intention was
to keep the perf_prepare_sample and perf_output_sample to be in sync with the checks that we
are doing.

Thanks
Athira

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ