[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211207120333.rmq3mmla5js7kpuj@liuwe-devbox-debian-v2>
Date: Tue, 7 Dec 2021 12:03:33 +0000
From: Wei Liu <wei.liu@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: "K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
Stefano Garzarella <sgarzare@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org,
linux-hyperv@...r.kernel.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] hv_sock: Extract hvs_send_data() helper that takes only
header
On Mon, Dec 06, 2021 at 10:32:17PM -0800, Kees Cook wrote:
> When building under -Warray-bounds, the compiler is especially
> conservative when faced with casts from a smaller object to a larger
> object. While this has found many real bugs, there are some cases that
> are currently false positives (like here). With this as one of the last
> few instances of the warning in the kernel before -Warray-bounds can be
> enabled globally, rearrange the functions so that there is a header-only
> version of hvs_send_data(). Silences this warning:
>
> net/vmw_vsock/hyperv_transport.c: In function 'hvs_shutdown_lock_held.constprop':
> net/vmw_vsock/hyperv_transport.c:231:32: warning: array subscript 'struct hvs_send_buf[0]' is partly outside array bounds of 'struct vmpipe_proto_header[1]' [-Warray-bounds]
> 231 | send_buf->hdr.pkt_type = 1;
> | ~~~~~~~~~~~~~~~~~~~~~~~^~~
> net/vmw_vsock/hyperv_transport.c:465:36: note: while referencing 'hdr'
> 465 | struct vmpipe_proto_header hdr;
> | ^~~
>
> This change results in no executable instruction differences.
>
> Signed-off-by: Kees Cook <keescook@...omium.org>
Acked-by: Wei Liu <wei.liu@...nel.org>
Powered by blists - more mailing lists