[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190413173836.GO2217@ZenIV.linux.org.uk>
Date: Sat, 13 Apr 2019 18:38:36 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Kirill Smelkov <kirr@...edi.com>, Arnd Bergmann <arnd@...db.de>,
Christoph Hellwig <hch@....de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [PATCH 1/2] vfs: pass ppos=NULL to .read()/.write() of
FMODE_STREAM files
On Sat, Apr 13, 2019 at 10:27:00AM -0700, Linus Torvalds wrote:
> And I'd really like to have people (Al?) look at this and go "yeah,
> makes sense". I do think that moving to a model where we wither have a
> (properly locked) file position or no pos pointer at all is the right
> model (ie I'd really like to get rid of the mixed case), but there
> might be some practical problem that makes it impractical.
>
> Because the *real* problem with the mixed case is not "insane people
> who do bad things might get odd results". No, the real problem with
> the mixed case is that it could be a security issue (ie: one process
> intentionally changes the file position just as another process is
> going a 'read' and then avoids some limit test because the limit test
> was done using the old 'pos' value but the actual IO was done using
> the new one).
>
> So I suspect that we will have to either
>
> - get rid of the mixed case entirely (and do only properly locked
> f_pos accesses or pass is a NULL f_pos)
Good luck. Character devices
get no exclusion
often do use position
are many
might be buried behind several layers of indirection
... and often left unmaintained for a decade or two
IOW, I don't see how you'd go about eliminating the mixed case...
Powered by blists - more mailing lists