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: <CANn89iJ3Ha6pQbBjR3XgvM35HVdeCh8k9nMqScuHxamz0JVYFQ@mail.gmail.com>
Date: Wed, 14 Jan 2026 03:01:27 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: "David S . Miller" <davem@...emloft.net>, Paolo Abeni <pabeni@...hat.com>, 
	Simon Horman <horms@...nel.org>, netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH net-next] net: minor __alloc_skb() optimization

On Wed, Jan 14, 2026 at 2:54 AM Eric Dumazet <edumazet@...gle.com> wrote:
>
> On Wed, Jan 14, 2026 at 2:44 AM Jakub Kicinski <kuba@...nel.org> wrote:
> >
> > On Tue, 13 Jan 2026 13:10:17 +0000 Eric Dumazet wrote:
> > > We can directly call __finalize_skb_around()
> > > instead of __build_skb_around() because @size is not zero.
> >
> > FWIW I've been tempted to delete the zero check from
> > __build_skb_around() completely recently..
> > It's been a few years since we added slab_build_skb()
> > surely any buggy driver that's actually used would have
> > already hit that WARN_ONCE() and gotten reported?
>
> We could keep it for a while, WDYT of
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 77508cf7c41e829a11a988d8de3d2673ff1ff121..ccd287ff46e91c2548483c51fa32fc6167867940
> 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -458,7 +458,8 @@ static void __build_skb_around(struct sk_buff
> *skb, void *data,
>         /* frag_size == 0 is considered deprecated now. Callers
>          * using slab buffer should use slab_build_skb() instead.
>          */
> -       if (WARN_ONCE(size == 0, "Use slab_build_skb() instead"))
> +       if (IS_ENABLED(CONFIG_DEBUG_NET) &&
> +           WARN_ONCE(size == 0, "Use slab_build_skb() instead"))
>                 data = __slab_build_skb(data, &size);
>
>         __finalize_skb_around(skb, data, size);


BTW, for folks using clang and not up to date kernels, backporting this commit
makes sure __build_skb_around() is at least inlined.

commit 242b872239f6a7deacbc20ab9406ea40cb738ec6
Author: Xie Yuanbin <qq570070308@...il.com>
Date:   Sun Nov 9 16:37:15 2025 +0800

    include/linux/once_lite.h: fix judgment in WARN_ONCE with clang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ