lkml.org 
[lkml]   [2019]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs: Allow opening only regular files during execve().
On Mon, Jan 21, 2019 at 07:14:39PM +0900, Tetsuo Handa wrote:
> On Tue, Dec 12, 2017 at 2:06 PM, Eric Biggers <ebiggers3@gmail.com> wrote:
> > I'm not sure what the fix will be. Maybe the proc handlers should take a
> > different lock instead of cred_guard_mutex. Or perhaps execve should check that
> > the file is a regular file before it attempts to open it.
>
> We can easily distinguish open() from execve() and open() from others. ;-)

> + /* The file or a script interpreter has to be a regular file. */
> + if (unlikely(current->in_execve && !S_ISREG(inode->i_mode))) {
> + error = -EACCES;
> + goto cleanup_file;
> + }

We are *NOT* going to use current->in_execve to propagate that information.
Come up with a cleaner solution, if you care, but this one is a non-starter.
Too ugly to live. Sorry.

\
 
 \ /
  Last update: 2019-01-21 22:19    [W:0.079 / U:1.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site