[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whYSnvfZNN1_Nr-S5C+a8-SkSMZO4Rf3NDAO046+rTNXQ@mail.gmail.com>
Date: Mon, 25 Nov 2019 19:39:34 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Kenneth R. Crudup" <kenny@...ix.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Kirill Smelkov <kirr@...edi.com>
Subject: Re: Commit 0be0ee71 ("fs: properly and reliably lock f_pos in
fdget_pos()") breaking userspace
On Mon, Nov 25, 2019 at 7:21 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> Of course, this may fix the f_pos locking issue, but replace it with a
> "oops, the character device driver tried to look at *pos anyway", and
> that will give you a nice OOPS instead.
Confirmed. At least the x86 firmware update code uses
"simple_read_from_buffer()", which does use the file position, but
doesn't actually allow llseek().
So no, "it's a character device no llseek" does not mean that it acts
as a pure streaming device with no file position, and we'd actually
have to mark individual drivers (either by adding 'stream_open()' in
their open routines, or adding the extra field to 'struct
file_operations' that I mentioned).
I think I'll have to revert that trial commit. I'll give it another
day in case somebody has a better idea, but it looks like it's too
early to do that nice cleanup as things are now.
Linus
Powered by blists - more mailing lists