Define new MAP_SYNC flag and corresponding VMA VM_SYNC flag. As the MAP_SYNC flag is not part of LEGACY_MAP_MASK, currently it will be refused by all MAP_SHARED_VALIDATE map attempts and silently ignored for everything else.
Unified · Split
| @@ -664,6 +664,7 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) · 663 unmodified lines | ||
| 664 | 664 | [ilog2(VM_ACCOUNT)] = "ac", |
| 665 | 665 | [ilog2(VM_NORESERVE)] = "nr", |
| 666 | 666 | [ilog2(VM_HUGETLB)] = "ht", |
| 667 | + [ilog2(VM_SYNC)] = "sf", | |
| 667 | 668 | [ilog2(VM_ARCH_1)] = "ar", |
| 668 | 669 | [ilog2(VM_WIPEONFORK)] = "wf", |
| 669 | 670 | [ilog2(VM_DONTDUMP)] = "dd", |
| @@ -189,6 +189,7 @@ extern unsigned int kobjsize(const void *objp); · 188 unmodified lines | ||
| 189 | 189 | #define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */ |
| 190 | 190 | #define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */ |
| 191 | 191 | #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ |
| 192 | +#define VM_SYNC 0x00800000 /* Synchronous page faults */ | |
| 192 | 193 | #define VM_ARCH_1 0x01000000 /* Architecture-specific flag */ |
| 193 | 194 | #define VM_WIPEONFORK 0x02000000 /* Wipe VMA contents in child. */ |
| 194 | 195 | #define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */ |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | * Arrange for legacy / undefined architecture specific flags to be |
| 12 | − * ignored by default in LEGACY_MAP_MASK. | |
| 12 | + * ignored by mmap handling code. | |
| 13 | 13 | */ |
| 14 | 14 | #ifndef MAP_32BIT |
| 15 | 15 | #define MAP_32BIT 0 |
| @@ -23,6 +23,9 @@ · 7 unmodified lines | ||
| 23 | 23 | #ifndef MAP_UNINITIALIZED |
| 24 | 24 | #define MAP_UNINITIALIZED 0 |
| 25 | 25 | #endif |
| 26 | +#ifndef MAP_SYNC | |
| 27 | +#define MAP_SYNC 0 | |
| 28 | +#endif | |
| 26 | 29 | |
| 27 | 30 | /* |
| 28 | 31 | * The historical set of flags that all mmap implementations implicitly |
| @@ -126,7 +129,8 @@ calc_vm_flag_bits(unsigned long flags) · 97 unmodified lines | ||
| 126 | 129 | { |
| 127 | 130 | return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) | |
| 128 | 131 | _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) | |
| 129 | − _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ); | |
| 132 | + _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ) | | |
| 133 | + _calc_vm_trans(flags, MAP_SYNC, VM_SYNC ); | |
| 130 | 134 | } |
| 131 | 135 | |
| 132 | 136 | unsigned long vm_commit_limit(void); |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
| 13 | 13 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ |
| 14 | 14 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ |
| 15 | +#define MAP_SYNC 0x80000 /* perform synchronous page faults for the mapping */ | |
| 15 | 16 | |
| 16 | 17 | /* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */ |
| 17 | 18 | |