[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFhGd8pMeTuvn_OqzYtRbfAM7L_-Jb_hFA4WY0hMap_eG=F7RA@mail.gmail.com>
Date: Thu, 7 Sep 2023 11:17:08 -0700
From: Justin Stitt <justinstitt@...gle.com>
To: Konrad Dybcio <konradybcio@...nel.org>
Cc: Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Mostafa Saleh <smostafa@...gle.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Kees Cook <keescook@...omium.org>,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v4] arm64/sysreg: refactor deprecated strncpy
On Thu, Sep 7, 2023 at 10:37 AM Konrad Dybcio <konradybcio@...nel.org> wrote:
>
>
>
> 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@...r.kernel.org
> > Suggested-by: Kees Cook <keescook@...omium.org>
> > Signed-off-by: Justin Stitt <justinstitt@...gle.com>
> > ---
> Hi,
>
> some form of this patch [1] went into -next and it broke booting
> on at least the Qualcomm SC8280XP-based Lenovo Thinkpad X13S.
>
Thanks for the heads up! The previous versions of the patch (including
the one that was applied) had some errors. This patch should be good
and Will is looking to apply it to arm64 fixes tree.
> Konrad
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=d232606773a0b09ec7f1ffc25f63abe801d011fd
Powered by blists - more mailing lists