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 D5EBDC7EE2E for ; Sat, 10 Jun 2023 00:45:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230171AbjFJApK (ORCPT ); Fri, 9 Jun 2023 20:45:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbjFJApG (ORCPT ); Fri, 9 Jun 2023 20:45:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0E393A98 for ; Fri, 9 Jun 2023 17:45:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5DA67651B5 for ; Sat, 10 Jun 2023 00:45:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5433C433D2; Sat, 10 Jun 2023 00:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1686357904; bh=CE/pCzSx3MpN249BS+38LbXZAz25ElsbQ7jP3QZbM0Q=; h=Date:To:From:Subject:From; b=JGc1iu183J9/tZ7Tor4eq2xkF29C31oZ8F2f4IfW6gDG3HdLpVglzPUSKoDR/5DgX 5sKb5+T0Y3210XEElHwjBT+kG8APATQQmPpuL5Jpzhoy8DC+A5Z+rn/X+esuMWA7bZ wZe8bpDQygp2tlDotFV2hxgOqkNPhoCPjAqLwMUU= Date: Fri, 09 Jun 2023 17:45:04 -0700 To: mm-commits@vger.kernel.org, wangkefeng.wang@huawei.com, lstoakes@gmail.com, liushixin2@huawei.com, keescook@chromium.org, david@redhat.com, bhe@redhat.com, adobriyan@gmail.com, azeemshaikh38@gmail.com, akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-nonmm-stable] procfs-replace-all-non-returning-strlcpy-with-strscpy.patch removed from -mm tree Message-Id: <20230610004504.B5433C433D2@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The quilt patch titled Subject: procfs: replace all non-returning strlcpy with strscpy has been removed from the -mm tree. Its filename was procfs-replace-all-non-returning-strlcpy-with-strscpy.patch This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: Azeem Shaikh Subject: procfs: replace all non-returning strlcpy with strscpy Date: Wed, 10 May 2023 21:24:57 +0000 strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated [1]. In an effort to remove strlcpy() completely [2], replace strlcpy() here with strscpy(). No return values were used, so direct replacement is safe. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [2] https://github.com/KSPP/linux/issues/89 Link: https://lkml.kernel.org/r/20230510212457.3491385-1-azeemshaikh38@gmail.com Signed-off-by: Azeem Shaikh Reviewed-by: Kees Cook Reviewed-by: Alexey Dobriyan Cc: Baoquan He Cc: David Hildenbrand Cc: Kefeng Wang Cc: Liu Shixin Cc: Lorenzo Stoakes Signed-off-by: Andrew Morton --- fs/proc/kcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/proc/kcore.c~procfs-replace-all-non-returning-strlcpy-with-strscpy +++ a/fs/proc/kcore.c @@ -419,7 +419,7 @@ static ssize_t read_kcore_iter(struct ki char *notes; size_t i = 0; - strlcpy(prpsinfo.pr_psargs, saved_command_line, + strscpy(prpsinfo.pr_psargs, saved_command_line, sizeof(prpsinfo.pr_psargs)); notes = kzalloc(notes_len, GFP_KERNEL); _ Patches currently in -mm which might be from azeemshaikh38@gmail.com are