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]
Date:   Wed, 19 Apr 2023 09:47:04 +0800
From:   Yang Jihong <yangjihong1@...wei.com>
To:     Peter Zijlstra <peterz@...radead.org>
CC:     <mingo@...hat.com>, <acme@...nel.org>, <mark.rutland@....com>,
        <alexander.shishkin@...ux.intel.com>, <jolsa@...nel.org>,
        <namhyung@...nel.org>, <irogers@...gle.com>,
        <adrian.hunter@...el.com>, <linux-perf-users@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf/core: Fix perf_sample_data not properly initialized
 for different swevents in perf_tp_event()

Hello,

On 2023/4/18 18:25, Peter Zijlstra wrote:
> On Tue, Apr 18, 2023 at 09:35:23AM +0800, Yang Jihong wrote:
> 
>>> I'm thinking perhaps those flags that update ->dyn_size are the problem?
>>> At the same time, Should you not also then clear dyn_size?
> 
>> Yes, according to the code, dyn_size should also be cleared.
>> Maybe we need to change it to the following, which would be more
>> appropriate?
>>
>> --- a/kernel/events/core.c
>> +++ b/kernel/events/core.c
>> @@ -10144,14 +10144,14 @@ void perf_tp_event(u16 event_type, u64 count, void
>> *record, int entry_size,
>>                  },
>>          };
>>
>> -       perf_sample_data_init(&data, 0, 0);
>> -       perf_sample_save_raw_data(&data, &raw);
>> -
>>          perf_trace_buf_update(record, event_type);
>>
>>          hlist_for_each_entry_rcu(event, head, hlist_entry) {
>> -               if (perf_tp_event_match(event, &data, regs))
>> +               if (perf_tp_event_match(event, &data, regs)) {
>> +                       perf_sample_data_init(&data, 0, 0);
>> +                       perf_sample_save_raw_data(&data, &raw);
>>                          perf_swevent_event(event, count, &data, regs);
>> +               }
>>          }
> 
> That is certainly the safe option. I just went through the list and
> while there's certainly a number of options we'll recompute for naught,
> most of them are indeed either dyn_size or event specific :/
> 
> So yeah, please send the above as v2.
> 
OK, will send v2 according to above fix solution.

Thanks,
Yang.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ