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: <CANn89i+uXsdSVFiQT9fDfGw+h_5QOcuHwPdWi9J=5U6oLXkQTA@mail.gmail.com>
Date: Thu, 25 Jan 2024 20:33:56 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Joe Damato <jdamato@...tly.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org, dhowells@...hat.com, 
	alexander@...alicyn.com, leitao@...ian.org, wuyun.abel@...edance.com, 
	kuniyu@...zon.com, pabeni@...hat.com, kuba@...nel.org, davem@...emloft.net
Subject: Re: [PATCH net-next] net: print error if SO_BUSY_POLL_BUDGET is large

On Thu, Jan 25, 2024 at 8:18 PM Joe Damato <jdamato@...tly.com> wrote:
>
> When drivers call netif_napi_add_weight with a weight that is larger
> than NAPI_POLL_WEIGHT, the networking code allows the larger weight, but
> prints an error.
>
> Replicate this check for SO_BUSY_POLL_BUDGET; check if the user
> specified amount exceeds NAPI_POLL_WEIGHT, allow it anyway, but print an
> error.
>
> Signed-off-by: Joe Damato <jdamato@...tly.com>
> ---
>  net/core/sock.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/net/core/sock.c b/net/core/sock.c
> index 158dbdebce6a..ed243bd0dd77 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -1153,6 +1153,9 @@ int sk_setsockopt(struct sock *sk, int level, int optname,
>                         return -EPERM;
>                 if (val < 0 || val > U16_MAX)
>                         return -EINVAL;
> +               if (val > NAPI_POLL_WEIGHT)
> +                       pr_err("SO_BUSY_POLL_BUDGET %u exceeds suggested maximum %u\n", val,
> +                              NAPI_POLL_WEIGHT);
>                 WRITE_ONCE(sk->sk_busy_poll_budget, val);
>                 return 0;

This is code run by privileged (CAP_NET_ADMIN) users,
please do not spam the console with such a message.

My point was : Do not allow an unpriv user to set an arbitrary value.

netif_napi_add_weight() is used from kernel drivers, we network
maintainers usually object
if a driver attempts to use a big value, at code review time.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ