[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45855f4f-f7cf-b7b3-bcd6-c9ebc3a55c64@acm.org>
Date: Wed, 28 Jul 2021 18:59:08 -0700
From: Bart Van Assche <bvanassche@....org>
To: Kees Cook <keescook@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-hardening@...r.kernel.org,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Keith Packard <keithpac@...zon.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-wireless@...r.kernel.org,
netdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-staging@...ts.linux.dev, linux-block@...r.kernel.org,
linux-kbuild@...r.kernel.org, clang-built-linux@...glegroups.com
Subject: Re: [PATCH 19/64] ip: Use struct_group() for memcpy() regions
On 7/28/21 2:01 PM, Kees Cook wrote:
> On Wed, Jul 28, 2021 at 07:55:53AM +0200, Greg Kroah-Hartman wrote:
>>> struct ethhdr {
>>> - unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
>>> - unsigned char h_source[ETH_ALEN]; /* source ether addr */
>>> + union {
>>> + struct {
>>> + unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
>>> + unsigned char h_source[ETH_ALEN]; /* source ether addr */
>>> + };
>>> + struct {
>>> + unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
>>> + unsigned char h_source[ETH_ALEN]; /* source ether addr */
>>> + } addrs;
>>
>> A union of the same fields in the same structure in the same way?
>>
>> Ah, because struct_group() can not be used here? Still feels odd to see
>> in a userspace-visible header.
>
> Yeah, there is some inconsistency here. I will clean this up for v2.
>
> Is there a place we can put kernel-specific macros for use in UAPI
> headers? (I need to figure out where things like __kernel_size_t get
> defined...)
How about using two memset() calls to clear h_dest[] and h_source[]
instead of modifying the uapi header?
Thanks,
Bart.
Powered by blists - more mailing lists