[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea8739b122674695ba9bf991b589817c@AcuMS.aculab.com>
Date: Fri, 6 Jan 2023 09:21:46 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Ameer Hamza' <ahamza@...ystems.com>
CC: "viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"jlayton@...nel.org" <jlayton@...nel.org>,
"chuck.lever@...cle.com" <chuck.lever@...cle.com>,
"arnd@...db.de" <arnd@...db.de>,
"guoren@...nel.org" <guoren@...nel.org>,
"palmer@...osinc.com" <palmer@...osinc.com>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"slark_xiao@....com" <slark_xiao@....com>,
"richard.henderson@...aro.org" <richard.henderson@...aro.org>,
"ink@...assic.park.msu.ru" <ink@...assic.park.msu.ru>,
"mattst88@...il.com" <mattst88@...il.com>,
"James.Bottomley@...senPartnership.com"
<James.Bottomley@...senPartnership.com>,
"deller@....de" <deller@....de>,
"davem@...emloft.net" <davem@...emloft.net>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
"awalker@...ystems.com" <awalker@...ystems.com>,
"sparclinux@...r.kernel.org" <sparclinux@...r.kernel.org>,
"linux-parisc@...r.kernel.org" <linux-parisc@...r.kernel.org>,
"linux-alpha@...r.kernel.org" <linux-alpha@...r.kernel.org>
Subject: RE: [PATCH v2] Add new open(2) flag - O_EMPTY_PATH
From: Ameer Hamza
> Sent: 02 January 2023 14:36
>
> On Mon, Jan 02, 2023 at 02:01:38PM +0000, David Laight wrote:
> > From: Ameer Hamza
> > > Sent: 31 December 2022 23:56
> > >
> > > This patch adds a new flag O_EMPTY_PATH that allows openat and open
> > > system calls to open a file referenced by fd if the path is empty,
> > > and it is very similar to the FreeBSD O_EMPTY_PATH flag. This can be
> > > beneficial in some cases since it would avoid having to grant /proc
> > > access to things like samba containers for reopening files to change
> > > flags in a race-free way.
> > >
> >
> > But what does it do?
> > (Apart from add code to a common kernel code path.)
> >
> > David
>
> It can convert an O_PATH descriptor to one suitable for r/w work.
> If we already have a file descriptor: {opath_fd = open(<path>, O_PATH);}, we can call
> {openat(opath_fd, "", O_EMPTY_PATH | O_RDWR)} instead of going through procfs
> {open(/proc/self/fd/<opath_fd>, O_RDWR)}.
Aren't both of those security problems?
Testing the file's inode permission allow write access isn't enough
to verify that the program could actually open the file for writing.
The program also needs 'directory search' access on all the directories
back as far as an open directory fd.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists