Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1613366

Re: RFC: reject unknown open flags

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: RFC: reject unknown open flags
Date 2017-03-30 20:50 +0200
Message-ID <tqNiX-27G-25@gated-at.bofh.it> (permalink)
References <tqLh7-GX-9@gated-at.bofh.it> <tqLK9-16I-3@gated-at.bofh.it> <tqM3w-1dT-27@gated-at.bofh.it> <tqMZz-1Yh-1@gated-at.bofh.it> <tqMZA-1Yh-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Mar 30, 2017 at 11:26 AM, Christoph Hellwig <hch@lst.de> wrote:
>
> That would be nice, but still won't work as we blindly copy f_flags
> into F_GETFL, not even masking our internal FMODE_ bits.

Ok, *that* is just silly of us, and we could try to just fix, and even backport.

There's no possible valid use I could see where that should break
(famous last words - user code does some damn odd things at times).

Of course, that won't fix old kernels that are out there, but then
neither would your original patch...

Side note: I think you *can* detect the O_ATOMIC support by using
F_SETFL, because F_SETFL only allows you to change flags that we
recognize. So somebody who really wants to *guarantee* that O_ATOMIC
is there and honored even with old kernels could presumable do
something like

   fd = open(..); // *no* O_ATOMIC
   fcnt(fd, F_SETFL, O_ATOMIC);
   if (fcnt(fd, F_GETFL, NULL) & O_ATOMIC)
        // Yay! We actually got it
   else
        // I guess we need to fall back on old behavior

although I agree that that is ridiculously inconvenient and not a
great thing, and it's worth trying to aim for some better model.

                    Linus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

RFC: reject unknown open flags Christoph Hellwig <hch@lst.de> - 2017-03-30 18:40 +0200
  [PATCH 1/2] fs: add a VALID_OPEN_FLAGS Christoph Hellwig <hch@lst.de> - 2017-03-30 18:40 +0200
  [PATCH 2/2] fs: reject unknown open flags Christoph Hellwig <hch@lst.de> - 2017-03-30 18:40 +0200
    Re: [PATCH 2/2] fs: reject unknown open flags Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-30 19:10 +0200
  Re: RFC: reject unknown open flags Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-30 19:10 +0200
    Re: RFC: reject unknown open flags Christoph Hellwig <hch@lst.de> - 2017-03-30 19:30 +0200
      Re: RFC: reject unknown open flags Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-30 20:30 +0200
        Re: RFC: reject unknown open flags Christoph Hellwig <hch@lst.de> - 2017-03-30 20:30 +0200
          Re: RFC: reject unknown open flags Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-30 20:50 +0200
            Re: RFC: reject unknown open flags Boaz Harrosh <boaz@plexistor.com> - 2017-03-30 22:10 +0200
        Re: RFC: reject unknown open flags Paul Eggert <eggert@cs.ucla.edu> - 2017-03-30 21:10 +0200
          Re: RFC: reject unknown open flags Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-30 21:20 +0200
    Re: RFC: reject unknown open flags Florian Weimer <fw@deneb.enyo.de> - 2017-03-30 21:40 +0200

csiph-web