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: <73edda3b-7305-4903-8950-8528c94051b1@arm.com>
Date: Mon, 10 Mar 2025 16:27:44 +0000
From: Mark Barnett <mark.barnett@....com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: mingo@...hat.com, acme@...nel.org, namhyung@...nel.org,
 irogers@...gle.com, ben.gainey@....com, deepak.surti@....com,
 ak@...ux.intel.com, will@...nel.org, james.clark@....com,
 mark.rutland@....com, alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
 adrian.hunter@...el.com, linux-perf-users@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v3 3/5] perf: Allow adding fixed random jitter to the
 alternate sampling period

On 3/10/25 12:47, Peter Zijlstra wrote:
> On Fri, Mar 07, 2025 at 08:22:45PM +0000, mark.barnett@....com wrote:
>> @@ -9922,7 +9923,10 @@ static int __perf_event_overflow(struct perf_event *event,
>>   	if (event->attr.alt_sample_period) {
>>   		bool using_alt = hwc->using_alt_sample_period;
>>   		u64 sample_period = (using_alt ? event->attr.sample_period
>> -					       : event->attr.alt_sample_period);
>> +					       : event->attr.alt_sample_period)
>> +				  + (event->attr.jitter_alt_period
>> +					? get_random_u32_below(2 << event->attr.jitter_alt_period)
>> +					: 0);
> 
> So, ... this here is NMI context, right? Have you looked at the guts of
> get_random_u32_below() ?
> 
> I would strongly suggest you go do so.
> 

Good catch. I think a pseudo-random generator would be fine here and it 
looks like the implementation of prandom is safe to use in an interrupt 
context. I can change to use that.

>>   
>>   		hwc->sample_period = sample_period;
>>   		hwc->using_alt_sample_period = !using_alt;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ