Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp147342rdb; Fri, 29 Sep 2023 21:43:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFeEioglowYTnETbZHUEfSAIDyQzqaVnMYzPNnTlaHUiapTD577qlt3pqNNXXCjfrOc4ewU X-Received: by 2002:ac8:5892:0:b0:412:1899:76d0 with SMTP id t18-20020ac85892000000b00412189976d0mr7464493qta.63.1696048990665; Fri, 29 Sep 2023 21:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696048990; cv=none; d=google.com; s=arc-20160816; b=HitPdWWXb9YRZQoje8D3wOVxGJTYVy3ggXI6sYBuLQQNwa18rO8q5Oo9XQCJVPz2bR ndISWyp7CamEq1eaUDsLGySZFMVsqwJo1uL1Xym74f3+4+K7F2UxLwyXU2sXYj4jLkL/ /yXuqRsp6l1qRk+c/y+8UazpiOW7S4cxCOJBYg9dhB5oNI6x/GTJvvlXfU6cI+dxWzEZ 6/tDij1aJgiX7BaeMu4z42/LqPiD90Q5fS2Z2GEhwV3FgegsPnN1XdLSF33pbvLfKN4r sOifH/rK+eTa1Li+TaWk3HTC4lYzUOq1z2k8gnsTvu26D+tdjfIuKjG4u+W2qUAuD7Su JfWw== 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:sender:dkim-signature; bh=dCiSP7da6dKIVaXYl+J/yofIbbMGcrO8k/37XWQQNwI=; fh=1IPfE76X7CZHqTMozTrlvpPYC/riZWlelkNvzzGnJc0=; b=pQFKOLD5/jUQYrBn8vOrdJCNYWzkSJ10lbKyyO0SM6qtZEUPZvMmZH1yhh1O3X/I5r rkZBTbR2my7clHQTZdgD20hmjO8Hj5ZPInSMhYLdgNnittj+ykJ/Yo22ZvjeDpiq8mii gnx4YE1o4YMjoOHehVT+in9dBAH1zqBqCNBJH6SV3y2YmB3XRUUIiCZhjq3llc9w6yi4 E5h9K9hlPVmwYwhBReVzzsfry4SqwFk+rNVXsrd8+cFREaM2mZuMF6D18DkLBfj/IvzY sCIXwInOKc/ZZyoxIhzZ7fxiLa9KuV/g58hDuIQm+vzP2XT7ZttbrZejKhTLn5Pt5Am9 xuaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Crkf6RvA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id v186-20020a6389c3000000b005859c874eb5si3171551pgd.275.2023.09.29.21.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 21:43:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Crkf6RvA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6AE96807C65C; Fri, 29 Sep 2023 14:14:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233749AbjI2VOW (ORCPT + 99 others); Fri, 29 Sep 2023 17:14:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbjI2VOV (ORCPT ); Fri, 29 Sep 2023 17:14:21 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83FF01AB; Fri, 29 Sep 2023 14:14:19 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-9936b3d0286so1981309066b.0; Fri, 29 Sep 2023 14:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696022058; x=1696626858; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=dCiSP7da6dKIVaXYl+J/yofIbbMGcrO8k/37XWQQNwI=; b=Crkf6RvAP6A5wQssikxRu8KClqvkX/3qwcQnf278xKA14/bPfOuTN+wcSUHWMbJgke fzaBp/gYDosKsLQtH7GSJaBH2AgE+m2r0qbJfdVaNi7DupKGdLwKJ9Ky13reRuvNc5q5 nh8d9xXJ4tD0+Jsuuy0COq27X3jM9LMdNSTPwYxztotWeo+9qH4lP+VPfLG0tIyHGinT 08jMHXQIhfnOlo3dGO8VKhaSZkoW+NBclb+E4lJRhZQQZns0svZQE+A4QLAp74Kp8HVx K+VqKSUt43t4c42VAA+PoYIbID+Cd8KiJen9waKv6GiVHbPKwxrbr1hAwxt89s8NVe5w QhZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696022058; x=1696626858; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dCiSP7da6dKIVaXYl+J/yofIbbMGcrO8k/37XWQQNwI=; b=UK01WDC8k5ulVCMwJz6FpCvWWvJRlfup40E2QnIADSkxhGR4IAk4S5MKBmBOB0RAFp YU2XjB9wJy4iReXs5y7fU3lQmTdQYMAI1pyAPK7e4ORQNv8ghmk9UjD6JgwdiITLfwAz XxLHTgagNsrDX5F/Dex8kD1vP0TaNmG/do8ltJl0O6VSK86W2x/3nwS0qb+cjEXeB/CK vZreAhM0TZy7gAHI7lXWk1ACztrh+lhOJeYqAU29aMdkeHB7kcUys5Nx0t7L4tFvSBgd G4hW571smxUUh2siaaBUGAgq8mLnDCoMAKuupHiKn5G2pEWAjP0gJt96MFZUMfyL6ikY s3DQ== X-Gm-Message-State: AOJu0Yx3IIYk/mXvikFhymncg98mDOKRqMJaD8wiD6la0fz+1+D9ojHC D2PR7BIOavyOTgG+Jv0ahMU= X-Received: by 2002:a17:906:209e:b0:9ae:829e:d930 with SMTP id 30-20020a170906209e00b009ae829ed930mr5670424ejq.9.1696022057599; Fri, 29 Sep 2023 14:14:17 -0700 (PDT) Received: from gmail.com (84-236-113-123.pool.digikabel.hu. [84.236.113.123]) by smtp.gmail.com with ESMTPSA id b10-20020aa7df8a000000b0052284228e3bsm11640256edy.8.2023.09.29.14.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 14:14:16 -0700 (PDT) Sender: Ingo Molnar Date: Fri, 29 Sep 2023 23:14:14 +0200 From: Ingo Molnar To: Kees Cook Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Justin Stitt , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Nick Desaulniers Subject: Re: [PATCH] x86/tdx: refactor deprecated strncpy Message-ID: References: <20230911-strncpy-arch-x86-coco-tdx-tdx-c-v1-1-4b38155727f3@google.com> <169601242377.3008066.9973846266706309040.b4-ty@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <169601242377.3008066.9973846266706309040.b4-ty@chromium.org> X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, FSL_HELO_FAKE,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 14:14:27 -0700 (PDT) * Kees Cook wrote: > On Mon, 11 Sep 2023 18:27:25 +0000, Justin Stitt wrote: > > `strncpy` is deprecated and we should prefer more robust string apis. > > > > In this case, `message.str` is not expected to be NUL-terminated as it > > is simply a buffer of characters residing in a union which allows for > > named fields representing 8 bytes each. There is only one caller of > > `tdx_panic()` and they use a 59-length string for `msg`: > > | const char *msg = "TD misconfiguration: SEPT_VE_DISABLE attribute must be set."; > > > > [...] > > This appears to be trivially correct, so I can take it via my tree. > > Applied to for-next/hardening, thanks! > > [1/1] x86/tdx: refactor deprecated strncpy > https://git.kernel.org/kees/c/e32c46753312 Please don't apply - Dave had some reservations, plus after the change the comment would be now out of sync with the code ... Also, we generally carry such patches in the x86 tree. Thanks, Ingo