Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1517602rwb; Tue, 27 Sep 2022 14:29:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55ah74kimuvdujvU2uPvTXr1tGRnowJKZI8lRRx0UqVg70Vx/+HnwaTuvMOpu/lrVSiCA2 X-Received: by 2002:a17:90b:194a:b0:202:e6eb:4b62 with SMTP id nk10-20020a17090b194a00b00202e6eb4b62mr6758741pjb.33.1664314141275; Tue, 27 Sep 2022 14:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664314141; cv=none; d=google.com; s=arc-20160816; b=M0Cr3BnNTwWn3QMuw/rM/aeTNq17gVlC7/rFt4K6VWr8KvzoPybqw5Wg5DEWAC6A3P ikP+5y3QSKRTQzYnhVpxlFnhHsO62I31rBN+jFPfZlBA4eeo64CpElrKL2HVolwznHTU 7N2+ZKmXfgBH+65UZKCbj8sN/zsSjzqezHdt9npv01gzMUS3E8jl6F2VTCuS1/+LlCEz Xnzv+zYHbR0XrYJRGFgcKX3plkZpZOk0OrIMtJHULxppUXtAhYHMS6Fq3HLdDRU7a2VA CSfYw111smWtrF1ycuq9daejs21IyOq1a4KWjWDhkLDdwGD59SXYblqQD0d/A/Muof/A 41tA== 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=AVs41GVux0bxpSDCyOTBQY/cRUdKNCstV7tk8chN4jY=; b=a6+jfBFoTnw7vn0+Y5Wh21QuJ1ct/nu/Tp/Inzf2f0mDngVtw2AmX9xDtNmpuOtkgI 7AewhIqBquACuBOjcL45HO1WsQ8HuRM63LC6eVth7N8Lug18TFmqOUgJYEFj/WDys6KD yHleNHGF0yZtdq0UPeVSr/8pTwwEvxPvuBTXTsHlYSUEXtWJnFOc9HIF+zdEtYSU0Ft4 D7QiCWCXYNPX5P7K7j+9E8XD4zC94LYruJgZQhmihD6TUHDKGK6b2vSFMYnk8+AzRpSM rpCpziEavAMju2XQ0HAuDzPyf6bPsReYZ641Ux4icriJr188BWXxch+dw72MuZeRfOvh MQvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DeFeq6EO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a17090a46ca00b001f2757da25asi2647471pjg.91.2022.09.27.14.28.49; Tue, 27 Sep 2022 14:29:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DeFeq6EO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232196AbiI0VYH (ORCPT + 99 others); Tue, 27 Sep 2022 17:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231936AbiI0VYE (ORCPT ); Tue, 27 Sep 2022 17:24:04 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD6741EC9BF for ; Tue, 27 Sep 2022 14:24:01 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id x1-20020a17090ab00100b001fda21bbc90so16694622pjq.3 for ; Tue, 27 Sep 2022 14:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=AVs41GVux0bxpSDCyOTBQY/cRUdKNCstV7tk8chN4jY=; b=DeFeq6EOWo5k00wksQVeaxeRFtcLC7+qeETTnDbgFMXpBtspyh5XRAjm9zTjLkmiCO mZ6kvnWBwp1nHY3SeGufM8TDTZsLXraVYdP5gXdfEAXxIfG7AqqVbqZ0eMXbO5MQdXxS o4cyGmO6Rqv+XsJfPOOG+JKr27L1F7V0N66BM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=AVs41GVux0bxpSDCyOTBQY/cRUdKNCstV7tk8chN4jY=; b=wVt+33ahq+e79XfGl90McLd7iL05pdD2YPqbqnSd1mcsv8PVVThLMpM0e4parpyQlJ uEZ8arzCTeUvhVFry209xU08uIGYlhUne6jmq+fCafxeMRROj8vcVybNatrUKPLWSobC MMOtSOAKdJyKE5yOTjAn6EWfEuC2pdk4sCVNwSDR3n0HezobWppUEdwqG6LBv3o9AbAK hiIclNCn5RtdJc4jMbpbHOcCD0MSBXUwo+mE0ItC87K7aPGjleRoESRsHfONvG1kT/9h ZluDd/d//QzBhXN7MrNcC02SpiEz1K3lyvGXdbI5PrmASvnHN8RT7/uXwrTCFNrHRgJH Y8+g== X-Gm-Message-State: ACrzQf0cd+RAWrYIb1Wopfbtc4xpGUCiY2xcsAN6lgHf34NcQMPhAKy4 ARFBXhg5+Q4r8388LmelHfcaRw== X-Received: by 2002:a17:90b:4c50:b0:202:c7b1:b1f9 with SMTP id np16-20020a17090b4c5000b00202c7b1b1f9mr6661977pjb.77.1664313840953; Tue, 27 Sep 2022 14:24:00 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e3-20020a17090301c300b00172cb8b97a8sm2056148plh.5.2022.09.27.14.24.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 14:24:00 -0700 (PDT) Date: Tue, 27 Sep 2022 14:23:59 -0700 From: Kees Cook To: Wei Liu Cc: "K. Y. Srinivasan" , "Gustavo A. R. Silva" , Haiyang Zhang , Stephen Hemminger , Dexuan Cui , linux-hyperv@vger.kernel.org, Nathan Chancellor , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] Drivers: hv: vmbus: Split memcpy of flex-array Message-ID: <202209271423.EA345AD@keescook> References: <20220924030741.3345349-1-keescook@chromium.org> <202209232119.E32C14857@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 24, 2022 at 10:34:12AM +0000, Wei Liu wrote: > Hi Kees > > On Fri, Sep 23, 2022 at 09:22:55PM -0700, Kees Cook wrote: > > On Fri, Sep 23, 2022 at 10:42:38PM -0500, Gustavo A. R. Silva wrote: > > > On Fri, Sep 23, 2022 at 08:07:41PM -0700, Kees Cook wrote: > > > > To work around a misbehavior of the compiler's ability to see into > > > > composite flexible array structs (as detailed in the coming memcpy() > > > > hardening series[1]), split the memcpy() of the header and the payload > > > > so no false positive run-time overflow warning will be generated. As it > > > > turns out, this appears to actually reduce the text size: > > > > Er, actually, I can't read/math. ;) It _does_ grow the text size. (That's > > 2_3_ not 22 at the start of the text size...) On examination, it appears > > to unroll the already inlined memcpy further. > > Can you provide an updated commit message? No need to resend. Since I got more testing from Nathan (and the original warning message), I figured a full v2 respin would easier. Now sent. :) Thanks! -Kees -- Kees Cook