Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1730461
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH v8 2/2] mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags |
| Date | 2017-09-11 19:30 +0200 |
| Message-ID | <uoAH2-6oD-19@gated-at.bofh.it> (permalink) |
| References | <unxrQ-36G-11@gated-at.bofh.it> <unxrR-36G-29@gated-at.bofh.it> <uotvP-19R-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Sep 11, 2017 at 2:47 AM, Jan Kara <jack@suse.cz> wrote: > On Fri 08-09-17 12:35:13, Dan Williams wrote: >> The mmap(2) syscall suffers from the ABI anti-pattern of not validating >> unknown flags. However, proposals like MAP_SYNC and MAP_DIRECT need a >> mechanism to define new behavior that is known to fail on older kernels >> without the support. Define a new MAP_SHARED_VALIDATE flag pattern that >> is guaranteed to fail on all legacy mmap implementations. >> >> With this in place new flags can be defined as: >> >> #define MAP_new (MAP_SHARED_VALIDATE | val) > > Is this changelog stale? Given MAP_SHARED_VALIDATE will be new mapping > type, I'd expect we define new flags just as any other mapping flags... > I see no reason why MAP_SHARED_VALIDATE should be or'ed to that. True, it will just by a new MAP_TYPE plus new flags. I will fix this up comment. [..] >> diff --git a/arch/alpha/include/uapi/asm/mman.h b/arch/alpha/include/uapi/asm/mman.h >> index 3b26cc62dadb..c32276c4196a 100644 >> --- a/arch/alpha/include/uapi/asm/mman.h >> +++ b/arch/alpha/include/uapi/asm/mman.h >> @@ -14,6 +14,7 @@ >> #define MAP_TYPE 0x0f /* Mask for type of mapping (OSF/1 is _wrong_) */ >> #define MAP_FIXED 0x100 /* Interpret addr exactly */ >> #define MAP_ANONYMOUS 0x10 /* don't use a file */ >> +#define MAP_SHARED_VALIDATE (MAP_SHARED|MAP_PRIVATE) /* validate extension flags */ > > And I'd explicitely define MAP_SHARED_VALIDATE as the first unused value > among mapping types (which is in fact enum embedded inside mapping flags). > I.e. 0x03 on alpha, x86, and probably all other archs - it has nothing to > do with MAP_SHARED|MAP_PRIVATE - it is just another type of the mapping > which happens to have most of the MAP_SHARED semantics... Ok, I'll make it 0x3 everywhere.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[RFC PATCH v8 2/2] mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags Dan Williams <dan.j.williams@intel.com> - 2017-09-08 21:50 +0200
Re: [RFC PATCH v8 2/2] mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags Jan Kara <jack@suse.cz> - 2017-09-11 11:50 +0200
Re: [RFC PATCH v8 2/2] mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags Christoph Hellwig <hch@lst.de> - 2017-09-11 13:20 +0200
Re: [RFC PATCH v8 2/2] mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags Jan Kara <jack@suse.cz> - 2017-09-11 13:50 +0200
Re: [RFC PATCH v8 2/2] mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags Dan Williams <dan.j.williams@intel.com> - 2017-09-11 19:10 +0200
Re: [RFC PATCH v8 2/2] mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags Dan Williams <dan.j.williams@intel.com> - 2017-09-11 19:30 +0200
csiph-web