Re: [PATCH v2] firmware_loader: Block path traversal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 24 Aug 2024 at 09:49, Jann Horn <jannh@xxxxxxxxxx> 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




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux