[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6c11b9e7-6aac-65c9-4755-99d41fbdcb4e@linux.alibaba.com>
Date: Fri, 13 Aug 2021 01:35:57 +0800
From: Wen Yang <wenyang@...ux.alibaba.com>
To: Eric Dumazet <eric.dumazet@...il.com>, davem@...emloft.net,
David Ahern <dsahern@...nel.org>,
Jakub Kicinski <kuba@...nel.org>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Baoyou Xie <baoyou.xie@...baba-inc.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] net: return early for possible invalid uaddr
在 2021/8/12 上午12:11, Eric Dumazet 写道:
>
>
> On 8/11/21 5:24 PM, Wen Yang wrote:
>> The inet_dgram_connect() first calls inet_autobind() to select an
>> ephemeral port, then checks uaddr in udp_pre_connect() or
>> __ip4_datagram_connect(), but the port is not released until the socket
>> is closed. This could cause performance issues or even exhaust ephemeral
>> ports if a malicious user makes a large number of UDP connections with
>> invalid uaddr and/or addr_len.
>>
>>
>
> This is a big patch.
>
> Can the malicious user still use a large number of UDP sockets,
> with valid uaddr/add_len and consequently exhaust ephemeral ports ?
>
> If yes, it does not seem your patch is helping.
>
Thank you for your comments.
However, we could make these optimizations:
1, If the user passed in some invalid parameters, we should return as
soon as possible. We shouldn't assume that these parameters are valid
first, then do some real work (such as select an ephemeral port), and
then finally check that they are indeed valid or not.
2. Unify the code for checking parameters in udp_pre_connect() and
__ip4_datagram_connect() to make the code clearer.
> If no, have you tried instead to undo the autobind, if the connect fails ?
>
Thanks. Undo the autobind is useful if the connect fails.
We will add this logic and submit the v3 patch later.
--
Best wishes,
Wen
Powered by blists - more mailing lists