[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wh2rRLv5hu4BaJ_8JGRrX+UiOA6x4mPtUHp12oNhnWJWA@mail.gmail.com>
Date: Sat, 24 Aug 2024 10:02:21 +0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Jann Horn <jannh@...gle.com>
Cc: Luis Chamberlain <mcgrof@...nel.org>, Christian Brauner <brauner@...nel.org>,
Russ Weight <russ.weight@...ux.dev>, Danilo Krummrich <dakr@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH v2] firmware_loader: Block path traversal
On Sat, 24 Aug 2024 at 09:49, Jann Horn <jannh@...gle.com> wrote:
>
> One other difference between the semantics we need here and
> LOOKUP_BENEATH is that we need to allow *symlinks* that contain ".."
> components or absolute paths; just the original path string must not
> contain them.
Yup, fair enough - a LOOKUP_NO_DOTDOT (or LOOKUP_NORMALIZED) flag
would only affect the top-most nameidata level. Which makes it
different from some of the other nameidata flags.
Not really fundamentally harder, but different - it would involve
having to also check nd->depth during the walk.
> (For what it's worth, I think I have seen many copies of this kind of
> string-based checking for ".." components in various pieces of
> userspace code. I don't think I've seen many places in the kernel that
> would benefit from that.)
Yeah, the kernel usually has trusted sources for the (relatively few)
pathnames it follows. The firmware case is probably fairly unusual,
with other sources of kernel path walking tend to be paths that have
been set by the administrator (eg the "fw_path" part that is set by a
module parameter).
I was indeed thinking of user level possibly finding this useful,
having seen a lot of "clean up pathname" code myself (git being one
example).
Linus
Powered by blists - more mailing lists