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]
Message-ID: <87344e6b7z.fsf@nvidia.com>
Date: Fri, 9 Jan 2026 16:43:16 +0100
From: Petr Machata <petrm@...dia.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: Petr Machata <petrm@...dia.com>, <davem@...emloft.net>,
	<netdev@...r.kernel.org>, <edumazet@...gle.com>, <pabeni@...hat.com>,
	<andrew+netdev@...n.ch>, <horms@...nel.org>, <leitao@...ian.org>,
	<jdamato@...tly.com>
Subject: Re: [PATCH net-next 2/2] selftests: net: py: ensure defer() is only
 used within a test case


Jakub Kicinski <kuba@...nel.org> writes:

> On Fri, 9 Jan 2026 09:23:54 +0100 Petr Machata wrote:
>> > I wasted a couple of hours recently after accidentally adding
>> > a defer() from within a function which itself was called as
>> > part of defer(). This leads to an infinite loop of defer().
>> > Make sure this cannot happen and raise a helpful exception.
>> >
>> > I understand that the pair of _ksft_defer_arm() calls may
>> > not be the most Pythonic way to implement this, but it's
>> > easy enough to understand.
>> >
>> > Signed-off-by: Jakub Kicinski <kuba@...nel.org>  
>> 
>> I think we achieve the same without the extra globals though? Just drain
>> the queue and walk through a copy of it?
>> 
>>     defer_queue = utils.GLOBAL_DEFER_QUEUE
>>     utils.GLOBAL_DEFER_QUEUE = []
>>     for i, entry in enumerate(defer_queue):
>>         ...
>>     if utils.GLOBAL_DEFER_QUEUE:
>>         warning / exception
>
> That's what I had initially (IIUC), I was assigning None to the queue,
> and then [] only while inside a test case. It gets slightly hairy
> because either we need to pass in the queue into the flush function;
> or we have to restore the queue if something raises and exception during
> flush (in which case ksft_run() prints a warning and calls
> ksft_flush_defer() one more time).

Hmm, yeah, the exception robustness will complicate it. OK, let's have
it your way then :)

Reviewed-by: Petr Machata <petrm@...dia.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ