Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5729991pxv; Wed, 28 Jul 2021 18:59:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMfp5cBZwo48pQIkiXnfE/XyD9cBKPaZ2YPc9OYrXwOVL1w07CZUh5YV91boDXcgj9UnLu X-Received: by 2002:a02:9648:: with SMTP id c66mr2348586jai.73.1627523982147; Wed, 28 Jul 2021 18:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627523982; cv=none; d=google.com; s=arc-20160816; b=csr4hDBOwObaX7Y53t7MoEVE+5hoaUqCRlq/DxMNdb2+cLDOhsQ/1YZFAA5uZjV5XA CcG0IADEcSWGWNyqBY5L8nM0NnpdO/mAWvlCzmOTAWLg3DGCiyF2nagufduoIe1Uzb+P onbk9lYlEzV4Bd4ljTRdmLkNCaekau1mmpclPRZ6T4y2jCBEtFlNt58FtnnC/WbZn228 sQRq0L/uBGgIl4GJqOEkRmDVFnDPK/Ad/WuhyS29l5MMwfMlpoNbQ3HbWqc3sptnYtWb erVi3wuP086BixTLcqWjyaiIB8BcZ8OAeqd04Elj3qJYJbRguaKGvK3gvnb8LTrfEvE5 10pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=/EMnvbg1lkcKUNHoTGAUlLRl80RwVqD1WDQs78+Ryng=; b=g6YmZwiJ98b/R9AVYBaZTTdkvwkDnOxrPoKDVg/gX2EdUGa+VkBKtTSjKh8VHmam68 nxIW/uO8uUEXBTBUvwThU/sN9kM5FwITE9y5DkQhMEHSGXGCIWXLgAdQHw+xUTKCfBph 1Fqb0e3I/3eGHXM8sH21ejFgK5XIBDNsX6E7K+1W2vy1zBL6NDgP5prvKqi2Lic2sIMC idio4t+DXOXhz/J79vauplhO7J73u4IG8kXA86AVO0syCV2NEyu4ZprNt6wuV76Miflh RU68UuKmnXtidsd7EnQsIOP8cMAwUCHBohK+STQASPYxENT1Em69sxciGmZ5X6NpCNfg +olA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r8si1782836jar.122.2021.07.28.18.59.22; Wed, 28 Jul 2021 18:59:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233357AbhG2B7P (ORCPT + 99 others); Wed, 28 Jul 2021 21:59:15 -0400 Received: from mail-pl1-f181.google.com ([209.85.214.181]:42797 "EHLO mail-pl1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233241AbhG2B7O (ORCPT ); Wed, 28 Jul 2021 21:59:14 -0400 Received: by mail-pl1-f181.google.com with SMTP id t3so2929816plg.9; Wed, 28 Jul 2021 18:59:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/EMnvbg1lkcKUNHoTGAUlLRl80RwVqD1WDQs78+Ryng=; b=T9QUZci9xRPUsyFylgg8iNO/vYQvXXH1GjnR9a+ORlVU3giTSq46ZzzVStYhQzQyVX mOLRviPqB0U0VzfefMBPrH2zxRJ8GXRxTSnReCaP7uZGRjeqYbmTj93lORJJYJYJ+UWt spwGognRDV14UtNOyYroC6Y6TKIm0ruPupWUwVNOCUMrsBxsb31ONXNerdH/j3a918F6 b1iQAdIoESQs2Q/T/v45hA59MGszluDk35P6uZRV+9iIQLaLnO8CBrwXv8iBRKbboxGV uMTQpXMyK7EDxu9YSaNqUtqbtZszoI002WWUymzMfCKU66bgkqv4ECGRQIqAtlfHSLyw K/9A== X-Gm-Message-State: AOAM532Ht9g9o9CnvXn1jL8DQg1Vp5ec/nrS1+YgPRE2L2uysG8WfphN eGEAyBFxq8vZAXzvyRBjlEk= X-Received: by 2002:aa7:93dc:0:b029:328:d6c9:cae7 with SMTP id y28-20020aa793dc0000b0290328d6c9cae7mr2579458pff.53.1627523950822; Wed, 28 Jul 2021 18:59:10 -0700 (PDT) Received: from ?IPv6:2601:647:4000:d7:9eeb:60dc:7a3c:6558? ([2601:647:4000:d7:9eeb:60dc:7a3c:6558]) by smtp.gmail.com with ESMTPSA id z16sm1344383pgu.21.2021.07.28.18.59.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Jul 2021 18:59:10 -0700 (PDT) Subject: Re: [PATCH 19/64] ip: Use struct_group() for memcpy() regions To: Kees Cook , Greg Kroah-Hartman Cc: linux-hardening@vger.kernel.org, "Gustavo A. R. Silva" , Keith Packard , Andrew Morton , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-block@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com References: <20210727205855.411487-1-keescook@chromium.org> <20210727205855.411487-20-keescook@chromium.org> <202107281358.8E12638@keescook> From: Bart Van Assche Message-ID: <45855f4f-f7cf-b7b3-bcd6-c9ebc3a55c64@acm.org> Date: Wed, 28 Jul 2021 18:59:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <202107281358.8E12638@keescook> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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.