lkml.org 
[lkml]   [2023]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2] Add new open(2) flag - O_EMPTY_PATH
Date
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)

\
 
 \ /
  Last update: 2023-03-26 23:29    [W:0.070 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site