Dan Williams
1c97259740
mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags
...
The mmap(2) syscall suffers from the ABI anti-pattern of not validating
unknown flags. However, proposals like MAP_SYNC 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.
It is worth noting that the original proposal was for a standalone
MAP_VALIDATE flag. However, when that could not be supported by all
archs Linus observed:
I see why you *think* you want a bitmap. You think you want
a bitmap because you want to make MAP_VALIDATE be part of MAP_SYNC
etc, so that people can do
ret = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED
| MAP_SYNC, fd, 0);
and "know" that MAP_SYNC actually takes.
And I'm saying that whole wish is bogus. You're fundamentally
depending on special semantics, just make it explicit. It's already
not portable, so don't try to make it so.
Rename that MAP_VALIDATE as MAP_SHARED_VALIDATE, make it have a value
of 0x3, and make people do
ret = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED_VALIDATE
| MAP_SYNC, fd, 0);
and then the kernel side is easier too (none of that random garbage
playing games with looking at the "MAP_VALIDATE bit", but just another
case statement in that map type thing.
Boom. Done.
Similar to ->fallocate() we also want the ability to validate the
support for new flags on a per ->mmap() 'struct file_operations'
instance basis. Towards that end arrange for flags to be generically
validated against a mmap_supported_flags exported by 'struct
file_operations'. By default all existing flags are implicitly
supported, but new flags require MAP_SHARED_VALIDATE and
per-instance-opt-in.
Cc: Jan Kara <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Cc: Andy Lutomirski <[email protected] >
Cc: Andrew Morton <[email protected] >
Suggested-by: Christoph Hellwig <[email protected] >
Suggested-by: Linus Torvalds <[email protected] >
Reviewed-by: Ross Zwisler <[email protected] >
Signed-off-by: Dan Williams <[email protected] >
Signed-off-by: Jan Kara <[email protected] >
Signed-off-by: Dan Williams <[email protected] >
2017-11-03 06:26:22 -07:00
..
kasan
Merge branch 'linus' into locking/core, to pick up fixes
2017-08-10 12:20:53 +02:00
backing-dev.c
mm/backing-dev.c: fix an error handling path in 'cgwb_create()'
2017-09-11 14:16:44 -06:00
balloon_compaction.c
mm/migrate: new migrate mode MIGRATE_SYNC_NO_COPY
2017-09-08 18:26:46 -07:00
bootmem.c
cleancache.c
fs: switch ->s_uuid to uuid_t
2017-06-05 16:59:12 +02:00
cma.c
cma: fix calculation of aligned offset
2017-07-10 16:32:32 -07:00
cma.h
cma: Store a name in the cma structure
2017-04-18 20:41:12 +02:00
cma_debug.c
mm/cma_debug.c: fix stack corruption due to sprintf usage
2017-08-18 15:32:02 -07:00
compaction.c
mm,compaction: serialize waitqueue_active() checks (for real)
2017-10-03 17:54:24 -07:00
debug.c
mm: make tlb_flush_pending global
2017-08-10 15:54:07 -07:00
debug_page_ref.c
dmapool.c
early_ioremap.c
x86/mm: Add support to access boot related data in the clear
2017-07-18 11:38:02 +02:00
fadvise.c
mm: fadvise: avoid fadvise for fs without backing device
2017-09-08 18:26:47 -07:00
failslab.c
filemap.c
mm: have filemap_check_and_advance_wb_err clear AS_EIO/AS_ENOSPC
2017-10-03 17:54:24 -07:00
frame_vector.c
treewide: use kv[mz]alloc* rather than opencoded variants
2017-05-08 17:15:13 -07:00
frontswap.c
gup.c
mm/device-public-memory: device memory cache coherent with CPU
2017-09-08 18:26:46 -07:00
highmem.c
hmm.c
mm/hmm: avoid bloating arch that do not make use of HMM
2017-09-08 18:26:46 -07:00
huge_memory.c
mm: soft-dirty: keep soft-dirty bits over thp migration
2017-09-08 18:26:45 -07:00
hugetlb.c
powerpc updates for 4.14
2017-09-07 10:15:40 -07:00
hugetlb_cgroup.c
hwpoison-inject.c
mm: hwpoison: call shake_page() unconditionally
2017-05-03 15:52:12 -07:00
init-mm.c
internal.h
mm, oom: do not rely on TIF_MEMDIE for memory reserves access
2017-09-06 17:27:30 -07:00
interval_tree.c
lib/interval_tree: fast overlap detection
2017-09-08 18:26:49 -07:00
Kconfig
mm/hmm: avoid bloating arch that do not make use of HMM
2017-09-08 18:26:46 -07:00
Kconfig.debug
mm: enable page poisoning early at boot
2017-05-03 15:52:10 -07:00
khugepaged.c
mm: make PR_SET_THP_DISABLE immediately active
2017-07-10 16:32:31 -07:00
kmemcheck.c
mm: Rename SLAB_DESTROY_BY_RCU to SLAB_TYPESAFE_BY_RCU
2017-04-18 11:42:36 -07:00
kmemleak-test.c
kmemleak.c
mm: kmemleak: treat vm_struct as alternative reference to vmalloc'ed objects
2017-07-06 16:24:34 -07:00
ksm.c
ksm: fix unlocked iteration over vmas in cmp_and_merge_page()
2017-10-03 17:54:23 -07:00
list_lru.c
mm: memcontrol: use vmalloc fallback for large kmem memcg arrays
2017-10-03 17:54:25 -07:00
maccess.c
madvise.c
mm, hugetlb, soft_offline: save compound page order before page migration
2017-10-03 17:54:24 -07:00
Makefile
mm/hmm: avoid bloating arch that do not make use of HMM
2017-09-08 18:26:46 -07:00
memblock.c
mm/memblock.c: reversed logic in memblock_discard()
2017-08-25 16:12:46 -07:00
memcontrol.c
mm/memcg: avoid page count check for zone device
2017-10-03 17:54:24 -07:00
memory-failure.c
x86/mm, mm/hwpoison: Clear PRESENT bit for kernel 1:1 mappings of poison pages
2017-08-17 10:30:49 +02:00
memory.c
mm/device-public-memory: fix edge case in _vm_normal_page()
2017-10-03 17:54:25 -07:00
memory_hotplug.c
mm/memory_hotplug: define find_{smallest|biggest}_section_pfn as unsigned long
2017-10-03 17:54:26 -07:00
mempolicy.c
mm/mempolicy.c: remove BUG_ON() checks for VMA inside mpol_misplaced()
2017-09-08 18:26:47 -07:00
mempool.c
sched/wait: Rename wait_queue_t => wait_queue_entry_t
2017-06-20 12:18:27 +02:00
memtest.c
migrate.c
mm/hmm: avoid bloating arch that do not make use of HMM
2017-09-08 18:26:46 -07:00
mincore.c
mlock.c
mm/mlock.c: use page_zone() instead of page_zone_id()
2017-09-08 18:26:47 -07:00
mm_init.c
mmap.c
mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags
2017-11-03 06:26:22 -07:00
mmu_context.c
mmu_notifier.c
mm/mmu_notifier: kill invalidate_page
2017-08-31 16:13:00 -07:00
mmzone.c
mprotect.c
mm/ZONE_DEVICE: new type of ZONE_DEVICE for unaddressable memory
2017-09-08 18:26:46 -07:00
mremap.c
mm: thp: check pmd migration entry in common path
2017-09-08 18:26:45 -07:00
msync.c
nobootmem.c
mm: discard memblock data later
2017-08-18 15:32:01 -07:00
nommu.c
Merge branch 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
2017-09-14 18:13:32 -07:00
oom_kill.c
mm, oom_reaper: skip mm structs with mmu notifiers
2017-10-03 17:54:24 -07:00
page-writeback.c
mm: rename global_page_state to global_zone_page_state
2017-09-06 17:27:29 -07:00
page_alloc.c
mm, page_alloc: add scheduling point to memmap_init_zone
2017-10-03 17:54:25 -07:00
page_counter.c
page_ext.c
mm, page_ext: periodically reschedule during page_ext_init()
2017-09-06 17:27:26 -07:00
page_idle.c
mm/page_idle.c: constify attribute_group structures
2017-09-06 17:27:27 -07:00
page_io.c
Merge branch 'for-4.14/block' of git://git.kernel.dk/linux-block
2017-09-07 11:59:42 -07:00
page_isolation.c
mm: unify new_node_page and alloc_migrate_target
2017-07-10 16:32:31 -07:00
page_owner.c
mm, page_owner: skip unnecessary stack_trace entries
2017-09-13 18:53:16 -07:00
page_poison.c
mm: enable page poisoning early at boot
2017-05-03 15:52:10 -07:00
page_vma_mapped.c
mm/migrate: support un-addressable ZONE_DEVICE page in migration
2017-09-08 18:26:46 -07:00
pagewalk.c
mm/hugetlb: add size parameter to huge_pte_offset()
2017-07-06 16:24:34 -07:00
percpu-internal.h
percpu: skip chunks if the alloc does not fit in the contig hint
2017-07-26 17:41:05 -04:00
percpu-km.c
percpu: replace area map allocator with bitmap
2017-07-26 17:41:05 -04:00
percpu-stats.c
percpu: fix starting offset for chunk statistics traversal
2017-09-27 14:45:57 -07:00
percpu-vm.c
percpu: fix static checker warnings in pcpu_destroy_chunk
2017-06-29 11:23:38 -04:00
percpu.c
percpu: fix iteration to prevent skipping over block
2017-09-28 07:39:27 -07:00
pgtable-generic.c
mm: thp: enable thp migration in generic path
2017-09-08 18:26:45 -07:00
process_vm_access.c
quicklist.c
readahead.c
rmap.c
lib/interval_tree: fast overlap detection
2017-09-08 18:26:49 -07:00
rodata_test.c
mm: fix RODATA_TEST failure "rodata_test: test data was not read only"
2017-10-03 17:54:24 -07:00
shmem.c
mm: treewide: remove GFP_TEMPORARY allocation flag
2017-09-13 18:53:16 -07:00
slab.c
mm: memcontrol: account slab stats per lruvec
2017-07-06 16:24:35 -07:00
slab.h
locking/lockdep: Rework FS_RECLAIM annotation
2017-08-10 12:29:03 +02:00
slab_common.c
mm: memcontrol: use vmalloc fallback for large kmem memcg arrays
2017-10-03 17:54:25 -07:00
slob.c
locking/lockdep: Rework FS_RECLAIM annotation
2017-08-10 12:29:03 +02:00
slub.c
mm: treewide: remove GFP_TEMPORARY allocation flag
2017-09-13 18:53:16 -07:00
sparse-vmemmap.c
mm, sparse, page_ext: drop ugly N_HIGH_MEMORY branches for allocations
2017-09-06 17:27:26 -07:00
sparse.c
mm/sparse.c: fix typo in online_mem_sections
2017-09-08 18:26:47 -07:00
swap.c
mm: avoid marking swap cached page as lazyfree
2017-10-03 17:54:24 -07:00
swap_cgroup.c
mm, THP, swap: delay splitting THP during swap out
2017-07-06 16:24:31 -07:00
swap_slots.c
mm/swap_slots.c: don't disable preemption while taking the per-CPU cache
2017-07-10 16:32:32 -07:00
swap_state.c
mm: fix data corruption caused by lazyfree page
2017-10-03 17:54:25 -07:00
swapfile.c
mm/swapfile.c: fix swapon frontswap_map memory leak on error
2017-09-08 18:26:47 -07:00
truncate.c
mm/truncate.c: fix THP handling in invalidate_mapping_pages()
2017-07-10 16:32:32 -07:00
usercopy.c
mm/usercopy: Drop extra is_vmalloc_or_module() check
2017-04-05 12:30:18 -07:00
userfaultfd.c
userfaultfd: shmem: wire up shmem_mfill_zeropage_pte
2017-09-06 17:27:28 -07:00
util.c
mm: rename global_page_state to global_zone_page_state
2017-09-06 17:27:29 -07:00
vmacache.c
vmalloc.c
mm/vmalloc.c: don't reinvent the wheel but use existing llist API
2017-09-06 17:27:29 -07:00
vmpressure.c
mm, vmpressure: pass-through notification support
2017-07-10 16:32:31 -07:00
vmscan.c
mm, THP, swap: add THP swapping out fallback counting
2017-09-06 17:27:28 -07:00
vmstat.c
mm: consider the number in local CPUs when reading NUMA stats
2017-09-08 18:26:47 -07:00
workingset.c
mm: memcontrol: per-lruvec stats infrastructure
2017-07-06 16:24:35 -07:00
z3fold.c
z3fold: fix stale list handling
2017-10-03 17:54:24 -07:00
zbud.c
zpool.c
zsmalloc.c
mm/zsmalloc.c: change stat type parameter to int
2017-09-08 18:26:47 -07:00
zswap.c
mm/zswap.c: delete an error message for a failed memory allocation in zswap_dstmem_prepare()
2017-07-06 16:24:35 -07:00