Linux-Security-Module Archive on lore.kernel.org
 help / color / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Al Viro <viro@zeniv.linux.org.uk>,
	keescook@chromium.org, Scott Branden <scott.branden@broadcom.com>,
	Mimi Zohar <zohar@linux.vnet.ibm.com>,
	linux-security-module@vger.kernel.org, jmorris@namei.org,
	serge@hallyn.com, ast@kernel.org, daniel@iogearbox.net,
	kafai@fb.com, songliubraving@fb.com, yhs@fb.com, andriin@fb.com,
	john.fastabend@gmail.com, kpsingh@chromium.org
Cc: Shuah Khan <skhan@linuxfoundation.org>,
	axboe@kernel.dk, zohar@linux.vnet.ibm.com,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd()
Date: Wed, 13 May 2020 13:13:35 +0000
Message-ID: <20200513131335.GN11244@42.do-not-panic.com> (raw)
In-Reply-To: <20200513054950.GT23230@ZenIV.linux.org.uk>

On Wed, May 13, 2020 at 06:49:50AM +0100, Al Viro wrote:
> On Tue, May 12, 2020 at 01:43:05PM -0600, Shuah Khan wrote:
> > diff --git a/fs/exec.c b/fs/exec.c
> > index 06b4c550af5d..ea24bdce939d 100644
> > --- a/fs/exec.c
> > +++ b/fs/exec.c
> > @@ -1021,8 +1021,8 @@ int kernel_read_file_from_fd(int fd, void **buf, loff_t *size, loff_t max_size,
> >  		goto out;
> >  
> >  	ret = kernel_read_file(f.file, buf, size, max_size, id);
> > -out:
> >  	fdput(f);
> > +out:
> >  	return ret;
> 
> Incidentally, why is that thing exported?

Both kernel_read_file_from_fd() and kernel_read_file() are exported
because they have users, however kernel_read_file() only has security
stuff as a user. Do we want to get rid of the lsm hook for it?

I also have some non-posted patches which tucks away these kernel_read*()
exports under a symbol namespace, to avoid wide-spread use / abuse on
areas in the kernel, so I'd be happy to take this on if we want to
remove it export / lsm hook as part of my series. I did this as there
is another series of patches for a new driver which extend these family
of functions with a now pread() variant....

  Luis

       reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1589311577.git.skhan@linuxfoundation.org>
     [not found] ` <1159d74f88d100521c568037327ebc8ec7ffc6ef.1589311577.git.skhan@linuxfoundation.org>
     [not found]   ` <20200513054950.GT23230@ZenIV.linux.org.uk>
2020-05-13 13:13     ` Luis Chamberlain [this message]
2020-05-13 14:19       ` Luis Chamberlain
2020-05-22 21:59         ` Scott Branden
2020-05-22 22:14           ` Scott Branden
2020-05-22 22:47             ` Luis Chamberlain

Reply instructions:

You may reply publicly 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=20200513131335.GN11244@42.do-not-panic.com \
    --to=mcgrof@kernel.org \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=daniel@iogearbox.net \
    --cc=jmorris@namei.org \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=keescook@chromium.org \
    --cc=kpsingh@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=scott.branden@broadcom.com \
    --cc=serge@hallyn.com \
    --cc=skhan@linuxfoundation.org \
    --cc=songliubraving@fb.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yhs@fb.com \
    --cc=zohar@linux.vnet.ibm.com \
    /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-Security-Module Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-security-module/0 linux-security-module/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-security-module linux-security-module/ https://lore.kernel.org/linux-security-module \
		linux-security-module@vger.kernel.org
	public-inbox-index linux-security-module

Example config snippet for mirrors

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


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