[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whDkekE8n2LdPiKHeTdRnV--ys0V0nPZ76oPaE0fn-d+g@mail.gmail.com>
Date: Sat, 10 Jul 2021 11:21:34 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Kalesh Singh <kaleshsingh@...gle.com>
Cc: Kees Cook <keescook@...omium.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Christian Brauner <christian.brauner@...ntu.com>,
Christian Koenig <christian.koenig@....com>,
Suren Baghdasaryan <surenb@...gle.com>,
Hridya Valsaraju <hridya@...gle.com>,
Android Kernel Team <kernel-team@...roid.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH] procfs: Prevent unpriveleged processes accessing fdinfo
On Thu, Jul 8, 2021 at 8:57 AM Kalesh Singh <kaleshsingh@...gle.com> wrote:
>
> The file permissions on the fdinfo dir from were changed from
> S_IRUSR|S_IXUSR to S_IRUGO|S_IXUGO, and a PTRACE_MODE_READ check was
> added for opening the fdinfo files [1]. However, the ptrace permission
> check was not added to the directory, allowing anyone to get the open FD
> numbers by reading the fdinfo directory.
>
> Add the missing ptrace permission check for opening the fdinfo directory.
The more I look at this, the more I feel like we should look at
instead changing how "get_proc_task()" works.
That's one of the core functions for /proc, and I wonder if we
couldn't just make it refuse to look up a task that has gone through a
suid execve() since the proc inode was opened.
I don't think it's basically ever ok to open something for one thread,
and then use it after the thread has gone through a suid thing.
In fact, I wonder if we could make it even stricter, and go "any exec
at all", but I think a suid exec might be the minimum we should do.
Then the logic really becomes very simple: we did the permission
checks at open time (like UNIX permission checks should be done), and
"get_proc_task()" basically verifies that "yeah, that open-time
decision is still valid".
Wouldn't that make a lot of sense?
Linus
Powered by blists - more mailing lists