Linux-Fsdevel Archive on lore.kernel.org
 help / color / Atom feed
From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
To: Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>
Cc: Eric Biggers <ebiggers3@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Kees Cook <keescook@chromium.org>,
	syzbot 
	<bot+e93a80c1bb7c5c56e522461c149f8bf55eab1b2b@syzkaller.appspotmail.com>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Subject: Re: [PATCH v2] fs: Allow opening only regular files during execve().
Date: Tue, 12 Feb 2019 11:01:58 +0900
Message-ID: <201902120201.x1C21wt2019144@www262.sakura.ne.jp> (raw)
In-Reply-To: <20190128154205.214ae010da6c2f02d379bbc8@linux-foundation.org>

Andrew Morton wrote:
> > --- a/fs/open.c
> > +++ b/fs/open.c
> > @@ -733,6 +733,12 @@ static int do_dentry_open(struct file *f,
> >  		return 0;
> >  	}
> >  
> > +	/* Any file opened for execve()/uselib() has to be a regular file. */
> > +	if (unlikely(f->f_flags & FMODE_EXEC && !S_ISREG(inode->i_mode))) {
> > +		error = -EACCES;
> > +		goto cleanup_file;
> > +	}
> > +
> >  	if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) {
> >  		error = get_write_access(inode);
> >  		if (unlikely(error))
> 
> This change sounds legitimate for various other reasons, but it's a
> concern that this locking error occurred in the first place.  There's a
> problem somewhere (probably the pipe code) which may bite us in other
> situations, even with this workaround in place.
> 
> 

This error seems to be introduced in 2.6.39-rc1 by commit a9712bc12c40c172
("deal with races in /proc/*/{syscall,stack,personality}"). Thus, I don't
think that this patch will bite us in other situations.
Al, how do you want to handle this?

  reply index

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <001a113f711ae2110c055f45acb8@google.com>
2017-12-02  8:12 ` possible deadlock in seq_read syzbot
2017-12-03 22:02 ` syzbot
2017-12-12 22:06 ` Eric Biggers
2017-12-27 18:30   ` Dmitry Vyukov
2018-08-27 18:20   ` Kees Cook
2018-08-27 20:57     ` Dmitry Vyukov
2019-01-21 10:14       ` [PATCH] fs: Allow opening only regular files during execve() Tetsuo Handa
2019-01-21 20:24         ` Kees Cook
2019-01-21 21:18         ` Al Viro
2019-01-22  0:50           ` [PATCH v2] " Tetsuo Handa
2019-01-28 23:42             ` Andrew Morton
2019-02-12  2:01               ` Tetsuo Handa [this message]
2019-02-12  5:26               ` Tetsuo Handa
2019-02-19  9:51                 ` Tetsuo Handa
2019-01-22  0:51           ` [PATCH] " Kees Cook

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201902120201.x1C21wt2019144@www262.sakura.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=akpm@linux-foundation.org \
    --cc=bot+e93a80c1bb7c5c56e522461c149f8bf55eab1b2b@syzkaller.appspotmail.com \
    --cc=dvyukov@google.com \
    --cc=ebiggers3@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Fsdevel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-fsdevel/0 linux-fsdevel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-fsdevel linux-fsdevel/ https://lore.kernel.org/linux-fsdevel \
		linux-fsdevel@vger.kernel.org linux-fsdevel@archiver.kernel.org
	public-inbox-index linux-fsdevel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-fsdevel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox