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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 114F1EC8726 for ; Thu, 7 Sep 2023 17:37:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wOmSJWz2C0AxxlTSpzTRBhO1rg3oXHJT9mPCrOrmWVw=; b=fuh3XrcqMp3MxI yVbQYDRs12fIXILbisgLOkJvCma3iKm1ZTNyXNHHzsy5pQq1iWjmzjAZHdGXUe+zoy81U6hMR1fYN YdaxYCnPpriy0vb7Hch8ATemQUtJEUvxHAHgoiI5xWJW3g9b2AD0TGcuG2Cqlm+4SdnfraDnl9j6q pC16AJGPtgOcJhyX3hnQ/qDIk3EqBk9LA+TFsZcz7Fafj6QsHd3nlv7cL93Vi9BF3gqHuwZ4maVGf rsDvelc52b8TfKkQ5VSpqD9WuKuNJV1M75gMl5TUXFOen3agC4mDNrAe+TJBfH1zviyOW1krCJGFu UCiTxMgzbGjF8gay8bBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qeIwA-00CUJL-0K; Thu, 07 Sep 2023 17:37:02 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qeIw7-00CUIy-0Y for linux-arm-kernel@lists.infradead.org; Thu, 07 Sep 2023 17:37:00 +0000 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 sin.source.kernel.org (Postfix) with ESMTPS id 673C1CE1A96; Thu, 7 Sep 2023 17:36:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92B46C43395; Thu, 7 Sep 2023 17:36:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694108214; bh=Eiz6SK/GqpmCoXTlpi6rkM1vG/IzusgKaLu2J8ONxZc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=lNmwdK0igINXgKTUlE2M5AL8aAcwBLGL82xBc092o9SE8QeG66ueU70gN9x3wzaWj 7QVF1N2SAwkrvnPeRjiN/Ncs2oFKV80LqfhPi6waSgUaY7jwDNBNnMkaNrCCupKWJG iOB+mAGaBLEzOTXygDVuQSHWP9afZu1ESP6FCwCUaGHliCdPjd5rDlnTdOnQ2ynmkg xNE8UwfSkfxl0wlcSP138wN7JOF/wudkT1n2VeQw1WMAspSFxi/2so0nXUepTJD5CA Dj5Zky56qn34Zk2YnuKmBvj+RviuXBnU35mOTeAasBvKGzpPPom4cosPC+EMDbAE6Q LMc5umqDShYoA== Message-ID: Date: Thu, 7 Sep 2023 19:36:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4] arm64/sysreg: refactor deprecated strncpy Content-Language: en-US To: Justin Stitt , Catalin Marinas , Will Deacon , Mostafa Saleh Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Kees Cook , linux-hardening@vger.kernel.org References: <20230905-strncpy-arch-arm64-v4-1-bc4b14ddfaef@google.com> From: Konrad Dybcio In-Reply-To: <20230905-strncpy-arch-arm64-v4-1-bc4b14ddfaef@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230907_103659_393350_18EBFAD0 X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 5.09.2023 22:10, Justin Stitt wrote: > strncpy is deprecated [1] and should not be used if the src string is > not NUL-terminated. > > When dealing with `cmdline` we are counting the number of characters > until a space then copying these over into `buf`. Let's not use any of > the str*() functions since the src string is not necessarily NUL-terminated. > > Prefer `memcpy()` alongside a forced NUL-termination as it more > accurately describes what is going on within this function, i.e: copying > from non NUL-terminated buffer into a NUL-terminated buffer. > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Suggested-by: Kees Cook > Signed-off-by: Justin Stitt > --- Hi, some form of this patch [1] went into -next and it broke booting on at least the Qualcomm SC8280XP-based Lenovo Thinkpad X13S. Konrad [1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=d232606773a0b09ec7f1ffc25f63abe801d011fd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel