Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4958423pxv; Tue, 27 Jul 2021 22:50:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCg7MvHKp71Cu/I8jgRfPeiAt8R0h9+4oOblIVD4yq5Pu7nF2Ja3xyqFt0xBbTAngQrHah X-Received: by 2002:a6b:5c18:: with SMTP id z24mr22068539ioh.88.1627451413697; Tue, 27 Jul 2021 22:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627451413; cv=none; d=google.com; s=arc-20160816; b=jJwwMnCUWNcsXE57HItxpcPKNmpOYmZoV7L5adMpmNoE8zgZxeRm+fGt8UNDqoHds4 Wis4sjoEQztpt6WMXePYWe3hC4y47yJfi+VPZXYRc3ai38Zjk4De3O7DwMcJPQP5UJgt /+yYHd0wGVEIqs6JKDfqsE0DaWgfyg5fN55uwd0wcSXLn234Yyvkp7nQtzN4JggljgNd dBzy5dUeDXNObqHoJPfX1jG1Z5h3Yfl4gRuIbu7Oeed3e3i2F8xVGOIYf66jnuSqJF55 ngJEvIW3Z2XviSC58EwjWEV+9sfPopjFQmhGGM2W23RaBUBIjwqYBNVOJg3RuRvdBhMb 4oaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=itCVzuy6swbe8OiMARAQwS8Y1kYaolo/xAWScNaa674=; b=BQclxKwkz+2MQkg70vvdx/xYraZKcC/k6mY3VEWmcAqS51N5HrtHaReqbbndnC2BKB wIoqncI1Y9DFk+Zf6tFYHtNr83kJNj3jUWvoOf7RYG0YzkRq/iJ/JkoWSuPO4h8wrHMO DzdCIj2RvVCYM2JJcV7D6aBqX0SsGv7GGcJw/uUZJ7wHFKJi1a+hux5Q5dWTu/8V+rKg EKMMGixH/JcVXelXIJ7X0wflckjB0jTNnsh1By+MhY4uMHWK3HIdq/eNCJPLfkEeKYUe waqFHyRM1ctomHZ2uVHULgMTkQodAyZ9pRRioSIJes5yUrm1MniSCKkBWwoCiQHo9ZlD Re0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xXqgpI3g; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si5604320jam.9.2021.07.27.22.50.01; Tue, 27 Jul 2021 22:50:13 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xXqgpI3g; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233881AbhG1Ftu (ORCPT + 99 others); Wed, 28 Jul 2021 01:49:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:50802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbhG1Ftt (ORCPT ); Wed, 28 Jul 2021 01:49:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1AAED60F00; Wed, 28 Jul 2021 05:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627451388; bh=Uj+QHLYAZir2Mxo6cu76dwsKyC/KhFwLcw7JJiMlAdM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xXqgpI3gRWbEy8rq81hxDjfK+j0CJIwxB4I/Ae+KVbzLUN+qdK/pkNEczVCdkC1CB fCtfqsbsZlEcEq2hviBrmXL0uuu3qCrtSJHnbcmW2vDKkOM3HbDWqFcTxWgnkWe11v 7rqUxCHJeMJoMg8dvgFXbVdy0U19thX2bW8vYx0g= Date: Wed, 28 Jul 2021 07:49:46 +0200 From: Greg Kroah-Hartman To: Kees Cook 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 Subject: Re: [PATCH 62/64] netlink: Avoid false-positive memcpy() warning Message-ID: References: <20210727205855.411487-1-keescook@chromium.org> <20210727205855.411487-63-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210727205855.411487-63-keescook@chromium.org> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, Jul 27, 2021 at 01:58:53PM -0700, Kees Cook wrote: > In preparation for FORTIFY_SOURCE performing compile-time and run-time > field bounds checking for memcpy(), memmove(), and memset(), avoid > intentionally writing across neighboring fields. > > Add a flexible array member to mark the end of struct nlmsghdr, and > split the memcpy() to avoid false positive memcpy() warning: > > memcpy: detected field-spanning write (size 32) of single field (size 16) > > Signed-off-by: Kees Cook > --- > include/uapi/linux/netlink.h | 1 + > net/netlink/af_netlink.c | 4 +++- > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h > index 4c0cde075c27..ddeaa748df5e 100644 > --- a/include/uapi/linux/netlink.h > +++ b/include/uapi/linux/netlink.h > @@ -47,6 +47,7 @@ struct nlmsghdr { > __u16 nlmsg_flags; /* Additional flags */ > __u32 nlmsg_seq; /* Sequence number */ > __u32 nlmsg_pid; /* Sending process port ID */ > + __u8 contents[]; Is this ok to change a public, userspace visable, structure? Nothing breaks? thanks, greg k-h