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: <d8dafc4c-3799-40be-9c06-0a35e2466d8f@oracle.com>
Date: Thu, 16 Jan 2025 02:10:44 +1100
From: imran.f.khan@...cle.com
To: Thomas Gleixner <tglx@...utronix.de>, anna-maria@...utronix.de,
        frederic@...nel.org
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] timers: WARN if add_timer_on is used with offlined
 cpu.

Hello Thomas,
On 16/1/2025 1:39 am, Thomas Gleixner wrote:
> On Thu, Jan 16 2025 at 00:41, Imran Khan wrote:
>> timer started on an offlined cpu will not fire after
>> its expiry time and may never fire if that cpu remains
>> offline.
>> So add a WARN_ON_ONCE in add_timer_on, to indicate
>> if any of its users are (wrongly) starting a timer
>> on an offlined cpu.
>>
>> Suggested-by: Thomas Gleixner <tglx@...utronix.de>
>> Signed-off-by: Imran Khan <imran.f.khan@...cle.com>
>> ---
>>  kernel/time/timer.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/kernel/time/timer.c b/kernel/time/timer.c
>> index a5860bf6d16f9..ec9eb58e45241 100644
>> --- a/kernel/time/timer.c
>> +++ b/kernel/time/timer.c
>> @@ -1370,6 +1370,12 @@ void add_timer_on(struct timer_list *timer, int cpu)
>>  	if (!timer->function)
>>  		goto out_unlock;
>>  
>> +	/*
>> +	 * WARN if specified cpu is offline, because on offlined cpu
>> +	 * timer will not fire even after its expiry.
>> +	 */
>> +	WARN_ON_ONCE(!cpu_online(cpu));
> 
> Then why queueing the timer in the first place?
> 

The queueing is for the case, if the cpu becomes online again.
Warning tells that timer is being put on an offlined cpu so may never fire,
if the cpu remains offline. But if the cpu becomes online, the timer
will fire.

Or should I just return after warning, like currently being done for
timer_pending. In that case I can move the warning before lock_timer_base.

Thanks,
Imran

> Thanks,
> 
>         tglx


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ