linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd()
       [not found]   ` <20200513054950.GT23230@ZenIV.linux.org.uk>
@ 2020-05-13 13:13     ` Luis Chamberlain
  2020-05-13 14:19       ` Luis Chamberlain
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Chamberlain @ 2020-05-13 13:13 UTC (permalink / raw)
  To: Al Viro, keescook, Scott Branden, Mimi Zohar,
	linux-security-module, jmorris, serge, ast, daniel, kafai,
	songliubraving, yhs, andriin, john.fastabend, kpsingh
  Cc: Shuah Khan, axboe, zohar, linux-fsdevel, linux-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd()
  2020-05-13 13:13     ` [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd() Luis Chamberlain
@ 2020-05-13 14:19       ` Luis Chamberlain
  2020-05-22 21:59         ` Scott Branden
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Chamberlain @ 2020-05-13 14:19 UTC (permalink / raw)
  To: Al Viro, Kees Cook, Scott Branden, Mimi Zohar,
	linux-security-module, James Morris, Serge E. Hallyn,
	Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh
  Cc: Shuah Khan, Jens Axboe, Linux FS Devel, linux-kernel

On Wed, May 13, 2020 at 7:13 AM Luis Chamberlain <mcgrof@kernel.org> wrote:
>
> 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?

Alright, yeah just the export needs to be removed. I have a patch
series dealing with these callers so will add it to my queue.

  Luis

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd()
  2020-05-13 14:19       ` Luis Chamberlain
@ 2020-05-22 21:59         ` Scott Branden
  2020-05-22 22:14           ` Scott Branden
  0 siblings, 1 reply; 5+ messages in thread
From: Scott Branden @ 2020-05-22 21:59 UTC (permalink / raw)
  To: Luis Chamberlain, Al Viro, Kees Cook, Mimi Zohar,
	linux-security-module, James Morris, Serge E. Hallyn,
	Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh
  Cc: Shuah Khan, Jens Axboe, Linux FS Devel, linux-kernel

Hi Luis,

On 2020-05-13 7:19 a.m., Luis Chamberlain wrote:
> On Wed, May 13, 2020 at 7:13 AM Luis Chamberlain <mcgrof@kernel.org> wrote:
>> 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?
> Alright, yeah just the export needs to be removed. I have a patch
> series dealing with these callers so will add it to my queue.
When will these changes make it into linux-next?
It is difficult for me to complete my patch series without these other 
misc. changes in place.
>
>    Luis
Regards,
  Scott

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd()
  2020-05-22 21:59         ` Scott Branden
@ 2020-05-22 22:14           ` Scott Branden
  2020-05-22 22:47             ` Luis Chamberlain
  0 siblings, 1 reply; 5+ messages in thread
From: Scott Branden @ 2020-05-22 22:14 UTC (permalink / raw)
  To: Luis Chamberlain, Al Viro, Kees Cook, Mimi Zohar,
	linux-security-module, James Morris, Serge E. Hallyn,
	Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh
  Cc: Shuah Khan, Jens Axboe, Linux FS Devel, linux-kernel



On 2020-05-22 2:59 p.m., Scott Branden wrote:
> Hi Luis,
>
> On 2020-05-13 7:19 a.m., Luis Chamberlain wrote:
>> On Wed, May 13, 2020 at 7:13 AM Luis Chamberlain <mcgrof@kernel.org> 
>> wrote:
>>> 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?
>> Alright, yeah just the export needs to be removed. I have a patch
>> series dealing with these callers so will add it to my queue.
> When will these changes make it into linux-next?
> It is difficult for me to complete my patch series without these other 
> misc. changes in place.
Sorry, I see the patch series is still being worked on (missing 
changelog, comments, etc).
Hopefully the patches stabilize so I can apply my changes on top fairly 
soon.
>>
>>    Luis
> Regards,
>  Scott


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd()
  2020-05-22 22:14           ` Scott Branden
@ 2020-05-22 22:47             ` Luis Chamberlain
  0 siblings, 0 replies; 5+ messages in thread
From: Luis Chamberlain @ 2020-05-22 22:47 UTC (permalink / raw)
  To: Scott Branden
  Cc: Al Viro, Kees Cook, Mimi Zohar, linux-security-module,
	James Morris, Serge E. Hallyn, Alexei Starovoitov,
	Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
	Andrii Nakryiko, John Fastabend, KP Singh, Shuah Khan,
	Jens Axboe, Linux FS Devel, linux-kernel

On Fri, May 22, 2020 at 03:14:59PM -0700, Scott Branden wrote:
> 
> 
> On 2020-05-22 2:59 p.m., Scott Branden wrote:
> > Hi Luis,
> > 
> > On 2020-05-13 7:19 a.m., Luis Chamberlain wrote:
> > > On Wed, May 13, 2020 at 7:13 AM Luis Chamberlain <mcgrof@kernel.org>
> > > wrote:
> > > > 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?
> > > Alright, yeah just the export needs to be removed. I have a patch
> > > series dealing with these callers so will add it to my queue.
> > When will these changes make it into linux-next?
> > It is difficult for me to complete my patch series without these other
> > misc. changes in place.
> Sorry, I see the patch series is still being worked on (missing changelog,
> comments, etc).
> Hopefully the patches stabilize so I can apply my changes on top fairly
> soon.

Yeah I have to redo that series to take into account feedback. I'll be
sure cc you on that. I have a few other series to attend to before that,
so I think this will take a week.

  Luis

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-22 22:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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     ` [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd() Luis Chamberlain
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).