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: <b976de06-2db0-443c-b504-77d3078bc022@uliege.be>
Date: Wed, 12 Mar 2025 13:38:22 +0100
From: Justin Iurman <justin.iurman@...ege.be>
To: Toke Høiland-Jørgensen <toke@...hat.com>,
 netdev@...r.kernel.org
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
 pabeni@...hat.com, horms@...nel.org, Roopa Prabhu <roopa@...dia.com>,
 Andrea Mayer <andrea.mayer@...roma2.it>,
 Stefano Salsano <stefano.salsano@...roma2.it>,
 Ahmed Abdelsalam <ahabdels.dev@...il.com>, Ido Schimmel <idosch@...dia.com>
Subject: Re: [PATCH net] net: lwtunnel: fix recursion loops

On 3/12/25 13:32, Justin Iurman wrote:
> On 3/12/25 13:29, Toke Høiland-Jørgensen wrote:
>> Justin Iurman <justin.iurman@...ege.be> writes:
>>
>>>> --- /dev/null
>>>> +++ b/net/core/lwtunnel.h
>>>> @@ -0,0 +1,42 @@
>>>> +/* SPDX-License-Identifier: GPL-2.0+ */
>>>> +#ifndef _NET_CORE_LWTUNNEL_H
>>>> +#define _NET_CORE_LWTUNNEL_H
>>>> +
>>>> +#include <linux/netdevice.h>
>>>> +
>>>> +#define LWTUNNEL_RECURSION_LIMIT 8
>>>> +
>>>> +#ifndef CONFIG_PREEMPT_RT
>>>> +static inline bool lwtunnel_recursion(void)
>>>> +{
>>>> +    return unlikely(__this_cpu_read(softnet_data.xmit.recursion) >
>>>> +            LWTUNNEL_RECURSION_LIMIT);
>>>> +}
>>>> +
>>>> +static inline void lwtunnel_recursion_inc(void)
>>>> +{
>>>> +    __this_cpu_inc(softnet_data.xmit.recursion);
>>>> +}
>>>> +
>>>> +static inline void lwtunnel_recursion_dec(void)
>>>> +{
>>>> +    __this_cpu_dec(softnet_data.xmit.recursion);
>>>> +}
>>>> +#else
>>>> +static inline bool lwtunnel_recursion(void)
>>>> +{
>>>> +    return unlikely(current->net_xmit.recursion > 
>>>> LWTUNNEL_RECURSION_LIMIT);
>>>> +}
>>>> +
>>>> +static inline void lwtunnel_recursion_inc(void)
>>>> +{
>>>> +    current->net_xmit.recursion++;
>>>> +}
>>>> +
>>>> +static inline void lwtunnel_recursion_dec(void)
>>>> +{
>>>> +    current->net_xmit.recursion--;
>>>> +}
>>>> +#endif
>>>> +
>>>> +#endif /* _NET_CORE_LWTUNNEL_H */
>>>
>>> Wondering what folks think about the above idea to reuse fields that
>>> dev_xmit_recursion() currently uses. IMO, it seems OK considering the
>>> use case and context. If not, I guess we'd need to add a new field to
>>> both softnet_data and task_struct.
>>
>> Why not just reuse the dev_xmit_recursion*() helpers directly?
>>
>> -Toke
>>
> 
> It was my initial idea, but I'm not sure I can. Looks like they're not 
> exposed (it's a local .h in net/core/).

Sorry, forget what I just said. We could indeed reuse it directly by 
including "dev.h" in lwtunnel.c.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ