Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1571096

Re: [PATCH] [RFC] fs: Possible filp_open race experiment

From Marek Vasut <marex@denx.de>
Newsgroups linux.kernel
Subject Re: [PATCH] [RFC] fs: Possible filp_open race experiment
Date 2017-01-31 22:10 +0100
Message-ID <t5NQC-5Az-23@gated-at.bofh.it> (permalink)
References (2 earlier) <t5AJH-6bL-11@gated-at.bofh.it> <t5DHB-7V9-51@gated-at.bofh.it> <t5EaC-84y-33@gated-at.bofh.it> <t5Gcp-Nz-7@gated-at.bofh.it> <t5GvN-19j-49@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/31/2017 02:17 PM, Greg Kroah-Hartman wrote:
> On Tue, Jan 31, 2017 at 01:58:14PM +0100, Christoph Hellwig wrote:
>> On Tue, Jan 31, 2017 at 11:21:02AM +0100, Greg Kroah-Hartman wrote:
>>>
>>> -next isn't Linus's tree, sometimes stuff sits in there for years :)
>>>
>>> Anyway, if this is a configfs issue, Christoph and Joel can take a look
>>> at it.  Any reason you didn't cc: Joel as well (the MAINTAINERS file is
>>> your friend...)
>>
>> It's really a mismatched assumption.  The configfs binary file
>> code just chunks updates up into a buffer, which only gets flushed
>> at ->release time.  If we'd move that to ->flush the issue Marek reports
>> would be fixed.
>>
>> But I don't think we want that - triggering a filp_open from the update
>> of a _binary_ attribute for a start is wrong.  And second doing this
>> using ->fs of a random calling process is bound to cause problems.
>>
>> I think he is using the wrong kind of interface for the job.
> 
> Ah, that's why no one has seen this before :)
> 
> So, the DT overlay code needs to be fixed...

Well I ran into the issue when I loaded DTO using 'cat' which bound a
driver which required firmware and the firmware loader uses the
filp_open() to load the firmware file from the FS. This crashed my
kernel because the current->fs was NULL. The example I provided is a
stripped down version which checks the current->fs directly to make
things simpler.

I think the issue is in the firmware loader (or filp_open() itself?) .
Shouldn't the filp_open() somehow assure that the current->fs is valid
if it is used within instead of triggering a NULL ptr dereference when
called from ie. the configfs binary attribute write callback ?

-- 
Best regards,
Marek Vasut

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH] [RFC] fs: Possible filp_open race experiment Marek Vasut <marex@denx.de> - 2017-01-31 06:50 +0100
  Re: [PATCH] [RFC] fs: Possible filp_open race experiment Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-01-31 08:10 +0100
    Re: [PATCH] [RFC] fs: Possible filp_open race experiment Marek Vasut <marex@denx.de> - 2017-01-31 11:20 +0100
      Re: [PATCH] [RFC] fs: Possible filp_open race experiment Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-01-31 11:50 +0100
        Re: [PATCH] [RFC] fs: Possible filp_open race experiment Christoph Hellwig <hch@lst.de> - 2017-01-31 14:00 +0100
          Re: [PATCH] [RFC] fs: Possible filp_open race experiment Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-01-31 14:20 +0100
            Re: [PATCH] [RFC] fs: Possible filp_open race experiment Marek Vasut <marex@denx.de> - 2017-01-31 22:10 +0100

csiph-web