Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2280697rdb; Tue, 3 Oct 2023 16:47:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHu6IksOQEXpxct/uTga3eBpDogwAy/MBHW4V0M+NqUVU6ECRxByJVCZVRnN4CBFtfof9Q4 X-Received: by 2002:a17:902:e74f:b0:1c6:112f:5cff with SMTP id p15-20020a170902e74f00b001c6112f5cffmr1207284plf.61.1696376821333; Tue, 03 Oct 2023 16:47:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696376821; cv=none; d=google.com; s=arc-20160816; b=JQb2Vxj3p48QkREJQb1+rP3AZlGFXbG51OicgJAX46T8Pxn1VKT/VIfS5V6hehtf4v yNu3oeNJgoTmUgoAniSP+l43AdTcjfTiHmzH9CEmojdnhChInx42GvzybXQ91tx2qCIq gvVZlqgemziVr2pp8KmcyklEfXu8oXZGVJau6DFBUzZEAEl5n/NCTedSTG0HHSd7/jUW UoaDDgRSDt3BlvKUJsmOde7Vl9NhTUwczFwumjVGaVZckows2d/9018yQiYywgLmuyFd /oa3kC3dvmAZeLzqH8d3zkqQZ4ff6UgVoQIa2gADU29XzFlC/RHyKvu7mxnD/INQuDsA t/ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=u7vKL2CVe5cxag62Gx1y/7hcNCwZyv8A6efdoKR42K4=; fh=9aU2cvo7x7CmhpvUn6EAVE1Ci3Fe7F75gAmorYUOhmg=; b=U3xvI+hs4AhnJ8RWxIc9l5G3IpCAdSUYkWNYIBJPZQo2Q5Jn7XYzZmjDd0YEwWg/AE 8dXh1lK9RIcIZtcEnQ8vtEvHHED3UfmHJV5ej98UmCOr5YlrMeCYMvvLeBVjYzRhoyff F6H18rPn6EAXWwiUWWc+XryBwtdwSoL1qeR175MrJGOQXkLI4PnVS4hEq7EXj/YgRPJe VsrU8T0iLlXJOH+AynNh3hHEXaVEkt+/L7ZlMAqzzTgftJLX6k/uSb+I7nOLtaDhvAlB HOILXLhxJytZmICit2oRcaSBDiyI6leI1IqlYAL6fc8TUuzXmkzj34R1LlR44Qj2MmU1 +Csg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=R2PA3oY7; 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=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i10-20020a17090332ca00b001c7545405b5si2805950plr.519.2023.10.03.16.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 16:47:01 -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=@intel.com header.s=Intel header.b=R2PA3oY7; 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=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5812780267D5; Tue, 3 Oct 2023 16:47:00 -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 S238612AbjJCXq6 (ORCPT + 99 others); Tue, 3 Oct 2023 19:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238456AbjJCXqz (ORCPT ); Tue, 3 Oct 2023 19:46:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B66B90; Tue, 3 Oct 2023 16:46:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696376811; x=1727912811; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=6GK598Ys0x4CTUm7I5dEo18AfNIpeD89Epow/8DL42A=; b=R2PA3oY7OwnanvkMpxVWb7R+s9oTJs1x/XJseO85e0Qm8/pLpBdxn61H GZGF1z0k0wpYKjQS5KjJZbgCRDO6oMQFht1uPD7dOM5uC4O3nxUFDjtuZ BKXeTEVYY8YMwvbTeyFTyd9MdmOxf7lNwuEG9i7k7NWdxshL0ELzgJLCr BSeoo7j9z48L8Px7suiEGPXEDsD0ANWmA4RFhxpmE3dHVn+hHkj8Vo2OR WNG0q8wShXY/6nruGJ6QlavDTYOxGxAdUnJM9gxne9GolCrBiffgsEkWP ct21aVQH46jHPB/J3alen62Riy84ExMR7nBjgaKTlRbgDyziWDRXjv/jS w==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="363275671" X-IronPort-AV: E=Sophos;i="6.03,198,1694761200"; d="scan'208";a="363275671" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 16:46:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="821440501" X-IronPort-AV: E=Sophos;i="6.03,198,1694761200"; d="scan'208";a="821440501" Received: from ddiaz-mobl4.amr.corp.intel.com (HELO [10.209.57.36]) ([10.209.57.36]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 16:46:50 -0700 Message-ID: <7f8479be-e4fd-07a8-2a3f-d85740d14f86@intel.com> Date: Tue, 3 Oct 2023 16:46:49 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v2] x86/tdx: replace deprecated strncpy with strtomem_pad Content-Language: en-US To: Justin Stitt , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Kees Cook References: <20231003-strncpy-arch-x86-coco-tdx-tdx-c-v2-1-0bd21174a217@google.com> From: Dave Hansen In-Reply-To: <20231003-strncpy-arch-x86-coco-tdx-tdx-c-v2-1-0bd21174a217@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham 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]); Tue, 03 Oct 2023 16:47:00 -0700 (PDT) On 10/3/23 14:54, Justin Stitt wrote: > Note: Ingo Molnar has some concerns about the comment being out of sync > [1] but I believe the comment still has a place as we can still > theoretically copy 64 bytes into our destination buffer without a > NUL-byte. The extra information about the 65th byte being NUL may serve > helpful to future travelers of this code. What do we think? I can drop > the comment in a v3 if needed. The comment looks fine to me as you've left it. It _might_ be better to say something like: Empty space in 'message.str' needs to be overwritten but does not need to be NULL-terminated. But I wouldn't bother messing with it any more. Acked-by: Dave Hansen I'll stick this into the tdx branch tomorrow unless someone has stronger feelings about it.