[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230908102022.GB6849@willie-the-truck>
Date: Fri, 8 Sep 2023 11:20:23 +0100
From: Will Deacon <will@...nel.org>
To: Bjorn Andersson <andersson@...nel.org>
Cc: Justin Stitt <justinstitt@...gle.com>,
Catalin Marinas <catalin.marinas@....com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Kees Cook <keescook@...omium.org>,
linux-hardening@...r.kernel.org,
Konrad Dybcio <konradybcio@...nel.org>
Subject: Re: [PATCH v2] arm64/sysreg: refactor deprecated strncpy
On Thu, Sep 07, 2023 at 02:28:05PM -0700, Bjorn Andersson wrote:
> On Fri, Aug 11, 2023 at 04:33:51PM +0000, Justin Stitt wrote:
> > `strncpy` is deprecated for use on NUL-terminated destination strings
> > [1]. Which seems to be the case here due to the forceful setting of `buf`'s
> > tail to 0.
> >
> > A suitable replacement is `strscpy` [2] due to the fact that it
> > guarantees NUL-termination on its destination buffer argument which is
> > _not_ the case for `strncpy`!
> >
> > In this case, we can simplify the logic and also check for any silent
> > truncation by using `strscpy`'s return value.
> >
> > This should have no functional change and yet uses a more robust and
> > less ambiguous interface whilst reducing code complexity.
> >
>
> I'm sorry, but this patch is wrong.
>
> __parse_cmdline() is supposed to match the command line against a set of
> keywords, one word at a time. The new implementation ignores the
> word-boundaries and matches the whole command line once and then breaks
> the loop, typically without having found a match. (See below)
>
> Can we please have this patch dropped, Will?
Yup, this was fixed yesterday so please take linux-next 20230908 for a
spin and let us know how you get on.
Cheers,
Will
Powered by blists - more mailing lists