hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/include/linux/mman.h
....@@ -57,8 +57,12 @@
5757
5858 #ifdef CONFIG_SMP
5959 extern s32 vm_committed_as_batch;
60
+extern void mm_compute_batch(int overcommit_policy);
6061 #else
6162 #define vm_committed_as_batch 0
63
+static inline void mm_compute_batch(int overcommit_policy)
64
+{
65
+}
6266 #endif
6367
6468 unsigned long vm_memory_committed(void);
....@@ -74,11 +78,16 @@
7478 }
7579
7680 /*
77
- * Allow architectures to handle additional protection bits
81
+ * Allow architectures to handle additional protection and flag bits. The
82
+ * overriding macros must be defined in the arch-specific asm/mman.h file.
7883 */
7984
8085 #ifndef arch_calc_vm_prot_bits
8186 #define arch_calc_vm_prot_bits(prot, pkey) 0
87
+#endif
88
+
89
+#ifndef arch_calc_vm_flag_bits
90
+#define arch_calc_vm_flag_bits(flags) 0
8291 #endif
8392
8493 #ifndef arch_vm_get_page_prot
....@@ -97,6 +106,19 @@
97106 return (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) == 0;
98107 }
99108 #define arch_validate_prot arch_validate_prot
109
+#endif
110
+
111
+#ifndef arch_validate_flags
112
+/*
113
+ * This is called from mmap() and mprotect() with the updated vma->vm_flags.
114
+ *
115
+ * Returns true if the VM_* flags are valid.
116
+ */
117
+static inline bool arch_validate_flags(unsigned long flags)
118
+{
119
+ return true;
120
+}
121
+#define arch_validate_flags arch_validate_flags
100122 #endif
101123
102124 /*
....@@ -131,7 +153,8 @@
131153 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |
132154 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) |
133155 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ) |
134
- _calc_vm_trans(flags, MAP_SYNC, VM_SYNC );
156
+ _calc_vm_trans(flags, MAP_SYNC, VM_SYNC ) |
157
+ arch_calc_vm_flag_bits(flags);
135158 }
136159
137160 unsigned long vm_commit_limit(void);