[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFxA3qoM5wpMUya7gEA8SZyJep7kMBRjrPOsOm_OudD8aQ@mail.gmail.com>
Date: Fri, 12 Jul 2013 13:21:07 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [git pull] vfs.git part 2
On Fri, Jul 12, 2013 at 12:39 PM, Al Viro <viro@...iv.linux.org.uk> wrote:
>
> I mean something like this:
>
> Safer ABI for O_TMPFILE
>
> [suggested by Rasmus Villemoes] make O_DIRECTORY | O_RDWR part of O_TMPFILE;
> that will fail on old kernels in a lot more cases than what I came up with.
So see earlier about why I'm not convinced about O_RDWR. But even if
we really want that (and it might be better to start off too narrow
than accept anything else) your patch tests those bits the wrong way
(any O_RDWR test should be done using the O_ACCMODE mask, not using
the O_RDWR value itself as a mask)
Also, to make sure that the "no preexisting file" case fails, I still
think you should also verify that O_CREAT is not set. Otherwise
Rasmus' case
open("/tmp/test/link_to_nowhere", O_DIRECTORY | O_RDWR, 0666) ->
-1; No such file or directory
can work, and the case that rasmus didn't have at all (non-existent
pathname) also just silently succeeds by creating a file instead of
the expected directory..
So you could have something like
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY | O_RDWR)
#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT | O_ACCMODE)
and then use
if ((flags & O_TMPFILE_MASK) != O_TMPFILE)
return -ENOTSUPP;
or whatever.
Hmm?
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists