Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1421531rwo; Wed, 2 Aug 2023 13:56:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlEtF2T5i4R+9tQMXeHT/lxkBb2piqPutQ3kNlB81HLF0e5Y42Zwc7nqo733FDPmVqqNPIvY X-Received: by 2002:a2e:9d10:0:b0:2b9:4c17:7939 with SMTP id t16-20020a2e9d10000000b002b94c177939mr5658947lji.12.1691009781448; Wed, 02 Aug 2023 13:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691009781; cv=none; d=google.com; s=arc-20160816; b=QbgaZMrdiUjMj8bzCwWz+68n/GBID9q7/uxB6u4XEWw3p8ip3qgtfBJj5S/8ZSfJsm qL1VwpuUhSSYMITKXxBMneG+EQuoGagBFmorwCpdc6dsFf1IT37KM5bG9yKQdJhqECAW JEhEl9OsUHBZSY7WqKLi2oB6Soc8Zo8T0vR/EKiyg7Bqp7M87GHGIdm5o1sp1PYdvBRH tXJ78S7eXVd7yN82BkvZq/BYgbkiLzwWpGWCdRu+raIZis6RTf2AuwOeOGdu8hfCT9UU sLuouwjKV9RIg3iCnX55URxBJQffCVT7nJ4SXn/6vRZUnlP1sv1ScHDg3frw9IvsTHO7 xm6w== 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=kJR5VYhsLcd26FRln9kp7D7T+g0liOZIpeMz7LbRKvw=; fh=sDFu67xHIWcCmdGFp9OiMEr6chIsFiMWQRDaEgsh9KQ=; b=ltCwIRSnfUsi0Vh98QIL/jLOJBPcl1h8Xh8z1VtMmSdBmbTgtEOGOHwvUOd/ygzcwZ ClnvBVS5DZSFeXhQLVoCymOe728SJb6fHxLbz4bm8wfiaj1rN4GzqnDVIaO/Zj3+31DK 02cK2JqOMyEYDplIaJ8v7d1ZPjxU0WTW13YBqmCAwe/pk2YlpyVGZjCv0dxzl5dlJ5y7 m6UzvyJ2vj2CBVEQ55dQpVSjoJpAiCNREe+HBDfjGDPLMnb7Wafwel0cxG6IpsmY1QwN aRDt60iSatxF+8HWGOhl9fLM1aolzYJCUuW9B4DLH8UBksR5wG3acIXQ8IVkxhZSVasL SUHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HAsVJtmd; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u23-20020a1709064ad700b00992f1a3b9d9si10387215ejt.415.2023.08.02.13.55.56; Wed, 02 Aug 2023 13:56:21 -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=@kernel.org header.s=k20201202 header.b=HAsVJtmd; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231823AbjHBUYB (ORCPT + 99 others); Wed, 2 Aug 2023 16:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230432AbjHBUYA (ORCPT ); Wed, 2 Aug 2023 16:24:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 961E9FF; Wed, 2 Aug 2023 13:23:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB9F061AF9; Wed, 2 Aug 2023 20:22:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71BFAC433C8; Wed, 2 Aug 2023 20:22:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691007765; bh=kJR5VYhsLcd26FRln9kp7D7T+g0liOZIpeMz7LbRKvw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HAsVJtmd+xwsfWAoq8Pxa8wmmHJv/sqOdYeyFmPkmEikyIRDrqBvetHVX4F27btYJ zcRk4+X63UL4qPuIkpsGFt3evh6aOmjb1qUcM3zYlDJ1wF/BVYbtnPiF5oHhESxhj1 f53TGsl/hAFLGiivG++hzpnko6iqwnuAs507xcx6QCuLE5sL1TK6EBgmGXpVifXSHc UWzW54g3h6bq1VxzK0FFTfEGGKN9oGCRKvB2e53bpW1noyN3+BnshlxSa2aB8Ceu0e h4jc2Lh7z1C8YTKNl/6ir+bzfBSV7kxU+8DYZ58YHvthEFZo3wE1pHvDWXMeWP/5aB FxidBj0fc1gEA== Date: Wed, 2 Aug 2023 21:22:41 +0100 From: Conor Dooley To: Justin Stitt Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Kees Cook , Nick Desaulniers , linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] RISC-V: cpu: refactor deprecated strncpy Message-ID: <20230802-overwrite-casino-491979427162@spud> References: <20230802-arch-riscv-kernel-v2-1-24266e85bc96@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ll5zcIRttVRYEd0J" Content-Disposition: inline In-Reply-To: <20230802-arch-riscv-kernel-v2-1-24266e85bc96@google.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 --Ll5zcIRttVRYEd0J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 02, 2023 at 12:21:58AM +0000, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. >=20 > Favor not copying strings onto stack and instead use strings directly. > This avoids hard-coding sizes and buffer lengths all together. >=20 > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Suggested-by: Kees Cook > Signed-off-by: Justin Stitt > --- > Changes in v2: > - Use strings directly instead of copying onto stack with `strscpy` (than= ks Kees) Yeah, that is what I was thinking of when I decried it as being horrid. Reviewed-by: Conor Dooley Thanks, Conor. --Ll5zcIRttVRYEd0J Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZMq7EQAKCRB4tDGHoIJi 0iONAQDvkdrvxLwjFA4k7Ta7UGh+90nAGAA+VslRU5pB4QrFTwEAxNmnJuahK1IX UT6wu7/2wDjIFon1o7pctoFyaM/SBAs= =eYZ0 -----END PGP SIGNATURE----- --Ll5zcIRttVRYEd0J--