From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FEBDC54EE9 for ; Tue, 27 Sep 2022 21:24:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229951AbiI0VYG (ORCPT ); Tue, 27 Sep 2022 17:24:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231209AbiI0VYE (ORCPT ); Tue, 27 Sep 2022 17:24:04 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91B441E800E for ; Tue, 27 Sep 2022 14:24:01 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id q35-20020a17090a752600b002038d8a68fbso16746939pjk.0 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=OQop+FonUDmGkizEQs04tR3vufRvKN0dCOciwaeefkl6rpDr/qhdW5MeVehUh3d4CV uXc6BL1Qv9k5WY594YASDyxVcSrV78+beud+IjA9H+9bAZx1HBPDYqboBGrVG5U6TX0A 8QJS5M0zP/lgKP8FdhtjKh6f9Pftpz9RxbsQ8HpKDfYqV9wRiX5bR293FVoQRmc4hMk0 aJ9Gl0xhFjqRKzX8UGQvzTdpajHEo8a7lWNYtevFUYvZpChoQdc9NEi/Bu2DpnC6ibaB AxFBfLY+t5gwtNabOwbK9bUBmhnylTcXOZvGL9a8+DLi2V8K9qCdRqh+ggWMRjrtmA2b eo1g== X-Gm-Message-State: ACrzQf3ODZYAiew1efI15f9xkiDuhDNfw/BdPLzu2DVVC4eQLL4uqH6D Kkrezt8yF9JYTRFTdKrE9wfVtg== X-Google-Smtp-Source: AMsMyM5vmo9268X1rr3fivj592ANmqiYo0xnHXYRVI8INujHbyz/5EMOQO4g/UhAmT+YLx2Nuw8skg== 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: Precedence: bulk List-ID: X-Mailing-List: linux-hardening@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