From: Alexey Dobriyan <adobriyan@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, wangkefeng.wang@huawei.com,
lstoakes@gmail.com, liushixin2@huawei.com, david@redhat.com,
bhe@redhat.com, azeemshaikh38@gmail.com,
akpm@linux-foundation.org
Subject: Re: + procfs-replace-all-non-returning-strlcpy-with-strscpy.patch added to mm-nonmm-unstable branch
Date: Sat, 13 May 2023 13:55:22 +0300 [thread overview]
Message-ID: <39b334c4-48e3-47ec-ae31-adeff2bf4839@p183> (raw)
In-Reply-To: <20230511043449.99AE6C433EF@smtp.kernel.org>
On Wed, May 10, 2023 at 09:34:49PM -0700, Andrew Morton wrote:
> Subject: procfs: replace all non-returning strlcpy with strscpy
> 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].
This is funny. C strings are always NUL-terminated by definition.
Reviewed-by: Alexey Dobriyan <adobriyan@gmail.com>
> --- 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);
parent reply other threads:[~2023-05-13 10:55 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20230511043449.99AE6C433EF@smtp.kernel.org>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=39b334c4-48e3-47ec-ae31-adeff2bf4839@p183 \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=azeemshaikh38@gmail.com \
--cc=bhe@redhat.com \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liushixin2@huawei.com \
--cc=lstoakes@gmail.com \
--cc=wangkefeng.wang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®