Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2438835rdb; Wed, 4 Oct 2023 00:41:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHD2Q6f+G24ZsJhlayXZm/stekIk4ztmjXsUdcB9fUUDEiC4eUCeaU+XKrDc1lQnZz7t8oj X-Received: by 2002:a05:6a21:8195:b0:161:4251:51c6 with SMTP id pd21-20020a056a21819500b00161425151c6mr1458358pzb.34.1696405289905; Wed, 04 Oct 2023 00:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696405289; cv=none; d=google.com; s=arc-20160816; b=0I9M2xNIc46uqPcT8FN223WYtHpN4ggx8zPb0O23J373qITYEpPSWhJ2xGEwfmUWbp 0foHoM+CPjJ0ycg7pkEx5GT7850spgXydjT1TXeKKUDODPpMqLY14Z0EmyDtgBG4zpXo AWHzlTmONiA5JexUAGvcte7oKR4PX+26yRq3co8vcPj6pU7lrGtOBYb4FWIon6R2wHOC hqUUCrFrJcJAsjGp+apA6LR4W1YphtgUp3UQoS52SPuF15utcn2ktrFTT1tG22W94jyH MxNyCwCZ4kKxplhA6XS3qFTH97Cm5a1cTswFrZFiLeoNar6Gj9WI3WiNG3Pi0B15m7RD EQiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=N3DAeRCTXgcmL6wGVPGeNq0prqCeKyw0QqbONR1xZzA=; fh=nbezmC2TbzCfv1UOM39SZTxMPRfdCCVj1Grwuunxz9I=; b=IeBbjEEYxSCuKGr7oq0LxohqJfj2dLua/Ep6UAT/aT9sltQ2pBxIgjWiAVwomtydOP /4re8g3fmIX0W1Mgm4xK57E4YicqNTJApEPPO/tpqQjU94o+HYEdXzr26XnQln2VNRXu WulrUQeYglp04dPliVavTnPgC9dKMTCF+QpmWjdNTbDj/UsshdVIzlGwGrxkqQTztntm QvW4L7oFCVtWEaMJtW3RcHgAFaNESqpDuKnCjJpYXVphURaU8moYPgVyVHBJgadYFxg0 PDhnk5X9jX/emCPZa/Z3JKdyUk8pZMnMRwW8Oqhz699jYcxET0Pg3tnaEnCNyrE+9JVl nmVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Q+wQZ0+k; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id fc35-20020a056a002e2300b00690d8405fe2si3436647pfb.60.2023.10.04.00.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 00:41:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Q+wQZ0+k; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 9610981355FA; Wed, 4 Oct 2023 00:41:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241562AbjJDHlS (ORCPT + 99 others); Wed, 4 Oct 2023 03:41:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241543AbjJDHlQ (ORCPT ); Wed, 4 Oct 2023 03:41:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C128AD; Wed, 4 Oct 2023 00:41:11 -0700 (PDT) Date: Wed, 04 Oct 2023 07:41:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696405269; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N3DAeRCTXgcmL6wGVPGeNq0prqCeKyw0QqbONR1xZzA=; b=Q+wQZ0+kZ+Df3U8BgTnZQUMdhZE3NH1TUEbqHW/kRE/0PeUE1ueE734AyeBuuVELApI8Yf eObZh6nDTDMxCCWvrAomMqgvlGCiu7T7P6B8+ljoR4xEwQS4k9mX9x/hG1o2InJ0qA4hd8 +pKt1UdZfPgKeuYHi2xCzQsSaYx29d5h6Vow2xAND9EHI3PhW0ht3O6BH8H2LHHyjbRLJn 6xYobE47r5Y+F+4aDxRRvjBM/cH3wuF6QPnaiPJRW9+8doGF6ZwcY+U5zxI8/OTEqJfCW5 5ri7rtAzAV6AOfg2jAZdAF4jmPDdOBZeUJ+UkHGMSNZMK04qB47LBPkW1shosQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696405269; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N3DAeRCTXgcmL6wGVPGeNq0prqCeKyw0QqbONR1xZzA=; b=YziiVtxsZ1a8Jf5cVXyQ7mu4FCn3bG8pZhRWIt7QOBXwC9SjsDEtR9IRdm2KqO7ZNHpv87 b1fNN8FaqoCt/VDQ== From: "tip-bot2 for Justin Stitt" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] x86/tdx: Replace deprecated strncpy() with strtomem_pad() Cc: Justin Stitt , Ingo Molnar , Kees Cook , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231003-strncpy-arch-x86-coco-tdx-tdx-c-v2-1-0bd21174a217@google.com> References: <20231003-strncpy-arch-x86-coco-tdx-tdx-c-v2-1-0bd21174a217@google.com> MIME-Version: 1.0 Message-ID: <169640526821.3135.14252605949556446798.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Wed, 04 Oct 2023 00:41:27 -0700 (PDT) The following commit has been merged into the x86/mm branch of tip: Commit-ID: c9babd5d95abf3fae6e798605ce5cac98e08daf9 Gitweb: https://git.kernel.org/tip/c9babd5d95abf3fae6e798605ce5cac98e08daf9 Author: Justin Stitt AuthorDate: Tue, 03 Oct 2023 21:54:59 Committer: Ingo Molnar CommitterDate: Wed, 04 Oct 2023 09:34:07 +02:00 x86/tdx: Replace deprecated strncpy() with strtomem_pad() strncpy() works perfectly here in all cases, however, it is deprecated and as such we should prefer more robust and less ambiguous string APIs: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings Let's use strtomem_pad() as this matches the functionality of strncpy() and is _not_ deprecated. Signed-off-by: Justin Stitt Signed-off-by: Ingo Molnar Reviewed-by: Kees Cook Acked-by: Dave Hansen Link: https://github.com/KSPP/linux/issues/90 Link: https://lore.kernel.org/r/20231003-strncpy-arch-x86-coco-tdx-tdx-c-v2-1-0bd21174a217@google.com --- arch/x86/coco/tdx/tdx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c index 1d6b863..2e1be59 100644 --- a/arch/x86/coco/tdx/tdx.c +++ b/arch/x86/coco/tdx/tdx.c @@ -119,7 +119,7 @@ static void __noreturn tdx_panic(const char *msg) } message; /* VMM assumes '\0' in byte 65, if the message took all 64 bytes */ - strncpy(message.str, msg, 64); + strtomem_pad(message.str, msg, '\0'); args.r8 = message.r8; args.r9 = message.r9;