From: Greg KH <gregkh@linuxfoundation.org>
To: Tadeusz Struk <tadeusz.struk@linaro.org>
Cc: stable <stable@vger.kernel.org>,
Kees Cook <keescook@chromium.org>,
Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH 2/2] skbuff: Extract list pointers to silence compiler warnings
Date: Wed, 30 Mar 2022 18:39:03 +0200 [thread overview]
Message-ID: <YkSHpzOJSO7GWVvG@kroah.com> (raw)
In-Reply-To: <20220329220256.72283-2-tadeusz.struk@linaro.org>
On Tue, Mar 29, 2022 at 03:02:56PM -0700, Tadeusz Struk wrote:
> Please apply this to stable 5.10.y, and 5.15.y
> ---8<---
>
> From: Kees Cook <keescook@chromium.org>
>
> Upstream commit: 1a2fb220edca ("skbuff: Extract list pointers to silence compiler warnings")
>
> Under both -Warray-bounds and the object_size sanitizer, the compiler is
> upset about accessing prev/next of sk_buff when the object it thinks it
> is coming from is sk_buff_head. The warning is a false positive due to
> the compiler taking a conservative approach, opting to warn at casting
> time rather than access time.
>
> However, in support of enabling -Warray-bounds globally (which has
> found many real bugs), arrange things for sk_buff so that the compiler
> can unambiguously see that there is no intention to access anything
> except prev/next. Introduce and cast to a separate struct sk_buff_list,
> which contains _only_ the first two fields, silencing the warnings:
>
> In file included from ./include/net/net_namespace.h:39,
> from ./include/linux/netdevice.h:37,
> from net/core/netpoll.c:17:
> net/core/netpoll.c: In function 'refill_skbs':
> ./include/linux/skbuff.h:2086:9: warning: array subscript 'struct sk_buff[0]' is partly outside array bounds of 'struct sk_buff_head[1]' [-Warray-bounds]
> 2086 | __skb_insert(newsk, next->prev, next, list);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> net/core/netpoll.c:49:28: note: while referencing 'skb_pool'
> 49 | static struct sk_buff_head skb_pool;
> | ^~~~~~~~
>
> This also upsets UBSAN, which throws a runtime object-size-mismatch
> error complaining about skbuff queue helpers, as below, when the kernel
> is built with clang and -fsanitize=undefined flag set:
>
> UBSAN: object-size-mismatch in ./include/linux/skbuff.h:2023:28
> member access within address ffffc90000cb71c0 with insufficient space
> for an object of type 'struct sk_buff'
>
> This change results in no executable instruction differences.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Link: https://lore.kernel.org/r/20211207062758.2324338-1-keescook@chromium.org
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
> ---
> include/linux/skbuff.h | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
Again, this diff is modified from the original.
I'm not going to take either of these now, sorry,
greg k-h
next prev parent reply other threads:[~2022-03-30 16:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-29 22:02 [PATCH 1/2] stddef: Introduce struct_group() helper macro Tadeusz Struk
2022-03-29 22:02 ` [PATCH 2/2] skbuff: Extract list pointers to silence compiler warnings Tadeusz Struk
2022-03-30 14:46 ` Greg KH
2022-03-30 14:59 ` Tadeusz Struk
2022-03-30 15:29 ` Greg KH
2022-03-30 15:38 ` Tadeusz Struk
2022-03-30 21:46 ` Kees Cook
2022-03-30 22:53 ` Tadeusz Struk
2022-03-30 16:37 ` Greg KH
2022-03-30 17:10 ` Tadeusz Struk
2022-03-30 16:39 ` Greg KH [this message]
2022-03-30 4:44 ` [PATCH 1/2] stddef: Introduce struct_group() helper macro Greg KH
2022-03-30 14:38 ` Tadeusz Struk
2022-03-30 14:45 ` Greg KH
2022-03-30 14:58 ` Tadeusz Struk
2022-03-30 16:37 ` Greg KH
2022-03-30 16:55 ` Tadeusz Struk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YkSHpzOJSO7GWVvG@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tadeusz.struk@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox