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 1CD15C001DF for ; Wed, 2 Aug 2023 20:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230392AbjHBUYB (ORCPT ); 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> Precedence: bulk List-ID: X-Mailing-List: linux-hardening@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--