projects/linux·blob master · refs

435 lines · 7.9 KiB

1/* SPDX-License-Identifier: GPL-2.0+ */
2
3#pragma once
4
5/*
6 * Contains declarations that are STUBBED, that is that are rendered no-ops, in
7 * order to faciliate userland VMA testing.
8 */
9
10/* Forward declarations. */
11struct mm_struct;
12struct vm_area_struct;
13struct vm_area_desc;
14struct pagetable_move_control;
15struct mmap_action;
16struct file;
17struct anon_vma;
18struct anon_vma_chain;
19struct address_space;
20struct unmap_desc;
21
22#define __bitwise
23#define __randomize_layout
24
25#define FIRST_USER_ADDRESS 0UL
26#define USER_PGTABLES_CEILING 0UL
27
28#define vma_policy(vma) NULL
29
30#define down_write_nest_lock(sem, nest_lock)
31
32#define data_race(expr) expr
33
34#define ASSERT_EXCLUSIVE_WRITER(x)
35
36struct vm_userfaultfd_ctx {};
37struct mempolicy {};
38struct mmu_gather {};
39struct mutex {};
40struct vm_fault {};
41
42static inline void userfaultfd_unmap_complete(struct mm_struct *mm,
43 struct list_head *uf)
44{
45}
46
47static inline unsigned long move_page_tables(struct pagetable_move_control *pmc)
48{
49 return 0;
50}
51
52static inline void free_pgd_range(struct mmu_gather *tlb,
53 unsigned long addr, unsigned long end,
54 unsigned long floor, unsigned long ceiling)
55{
56}
57
58static inline int ksm_execve(struct mm_struct *mm)
59{
60 return 0;
61}
62
63static inline void ksm_exit(struct mm_struct *mm)
64{
65}
66
67static inline void vma_numab_state_init(struct vm_area_struct *vma)
68{
69}
70
71static inline void vma_numab_state_free(struct vm_area_struct *vma)
72{
73}
74
75static inline void dup_anon_vma_name(struct vm_area_struct *orig_vma,
76 struct vm_area_struct *new_vma)
77{
78}
79
80static inline void free_anon_vma_name(struct vm_area_struct *vma)
81{
82}
83
84static inline int mmap_action_prepare(struct vm_area_desc *desc)
85{
86 return 0;
87}
88
89static inline int mmap_action_complete(struct vm_area_struct *vma,
90 struct mmap_action *action,
91 bool is_compat)
92{
93 return 0;
94}
95
96static inline void fixup_hugetlb_reservations(struct vm_area_struct *vma)
97{
98}
99
100static inline bool shmem_file(struct file *file)
101{
102 return false;
103}
104
105static inline vma_flags_t ksm_vma_flags(struct mm_struct *mm,
106 const struct file *file, vma_flags_t vma_flags)
107{
108 return vma_flags;
109}
110
111static inline void remap_pfn_range_prepare(struct vm_area_desc *desc, unsigned long pfn)
112{
113}
114
115static inline int remap_pfn_range_complete(struct vm_area_struct *vma, unsigned long addr,
116 unsigned long pfn, unsigned long size, pgprot_t pgprot)
117{
118 return 0;
119}
120
121static inline int do_munmap(struct mm_struct *, unsigned long, size_t,
122 struct list_head *uf)
123{
124 return 0;
125}
126
127/* Currently stubbed but we may later wish to un-stub. */
128static inline void vm_acct_memory(long pages);
129
130static inline void mmap_assert_locked(struct mm_struct *mm)
131{
132}
133
134
135static inline void anon_vma_unlock_write(struct anon_vma *anon_vma)
136{
137}
138
139static inline void i_mmap_unlock_write(struct address_space *mapping)
140{
141}
142
143static inline int userfaultfd_unmap_prep(struct vm_area_struct *vma,
144 unsigned long start,
145 unsigned long end,
146 struct list_head *unmaps)
147{
148 return 0;
149}
150
151static inline void mmap_write_downgrade(struct mm_struct *mm)
152{
153}
154
155static inline void mmap_read_unlock(struct mm_struct *mm)
156{
157}
158
159static inline void mmap_write_unlock(struct mm_struct *mm)
160{
161}
162
163static inline int mmap_write_lock_killable(struct mm_struct *mm)
164{
165 return 0;
166}
167
168static inline bool can_modify_mm(struct mm_struct *mm,
169 unsigned long start,
170 unsigned long end)
171{
172 return true;
173}
174
175static inline void arch_unmap(struct mm_struct *mm,
176 unsigned long start,
177 unsigned long end)
178{
179}
180
181static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
182{
183 return true;
184}
185
186static inline void khugepaged_enter_vma(struct vm_area_struct *vma,
187 vm_flags_t vm_flags)
188{
189}
190
191static inline bool mapping_can_writeback(struct address_space *mapping)
192{
193 return true;
194}
195
196static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma)
197{
198 return false;
199}
200
201static inline bool vma_soft_dirty_enabled(struct vm_area_struct *vma)
202{
203 return false;
204}
205
206static inline bool userfaultfd_wp(struct vm_area_struct *vma)
207{
208 return false;
209}
210
211static inline void mmap_assert_write_locked(struct mm_struct *mm)
212{
213}
214
215static inline void mutex_lock(struct mutex *lock)
216{
217}
218
219static inline void mutex_unlock(struct mutex *lock)
220{
221}
222
223static inline bool mutex_is_locked(struct mutex *lock)
224{
225 return true;
226}
227
228static inline bool signal_pending(void *p)
229{
230 return false;
231}
232
233static inline bool is_file_hugepages(const struct file *file)
234{
235 return false;
236}
237
238static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
239{
240 return 0;
241}
242
243static inline bool may_expand_vm(struct mm_struct *mm,
244 const vma_flags_t *vma_flags,
245 unsigned long npages)
246{
247 return true;
248}
249
250static inline int shmem_zero_setup(struct vm_area_struct *vma)
251{
252 return 0;
253}
254
255
256static inline void vm_acct_memory(long pages)
257{
258}
259
260static inline void mapping_rmap_tree_insert(struct vm_area_struct *vma,
261 struct address_space *mapping)
262{
263}
264
265static inline void mapping_rmap_tree_remove(struct vm_area_struct *vma,
266 struct address_space *mapping)
267{
268}
269
270static inline void flush_dcache_mmap_unlock(struct address_space *mapping)
271{
272}
273
274static inline void anon_rmap_tree_insert(struct anon_vma_chain *avc,
275 struct anon_vma *anon_vma)
276{
277}
278
279static inline void anon_rmap_tree_remove(struct anon_vma_chain *avc,
280 struct anon_vma *anon_vma)
281{
282}
283
284static inline void uprobe_mmap(struct vm_area_struct *vma)
285{
286}
287
288static inline void uprobe_munmap(struct vm_area_struct *vma,
289 unsigned long start, unsigned long end)
290{
291}
292
293static inline void i_mmap_lock_write(struct address_space *mapping)
294{
295}
296
297static inline void anon_vma_lock_write(struct anon_vma *anon_vma)
298{
299}
300
301static inline void vma_assert_write_locked(struct vm_area_struct *vma)
302{
303}
304
305static inline void ksm_add_vma(struct vm_area_struct *vma)
306{
307}
308
309static inline void perf_event_mmap(struct vm_area_struct *vma)
310{
311}
312
313static inline bool vma_is_dax(struct vm_area_struct *vma)
314{
315 return false;
316}
317
318static inline struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
319{
320 return NULL;
321}
322
323static inline bool arch_validate_flags(vm_flags_t flags)
324{
325 return true;
326}
327
328static inline void vma_close(struct vm_area_struct *vma)
329{
330}
331
332static inline int mmap_file(struct file *file, struct vm_area_struct *vma)
333{
334 return 0;
335}
336
337static inline int is_hugepage_only_range(struct mm_struct *mm,
338 unsigned long addr, unsigned long len)
339{
340 return 0;
341}
342
343static inline bool capable(int cap)
344{
345 return true;
346}
347
348static inline struct anon_vma_name *anon_vma_name(struct vm_area_struct *vma)
349{
350 return NULL;
351}
352
353static inline bool is_mergeable_vm_userfaultfd_ctx(struct vm_area_struct *vma,
354 struct vm_userfaultfd_ctx vm_ctx)
355{
356 return true;
357}
358
359static inline bool anon_vma_name_eq(struct anon_vma_name *anon_name1,
360 struct anon_vma_name *anon_name2)
361{
362 return true;
363}
364
365static inline void might_sleep(void)
366{
367}
368
369static inline void fput(struct file *file)
370{
371}
372
373static inline void mpol_put(struct mempolicy *pol)
374{
375}
376
377static inline void lru_add_drain(void)
378{
379}
380
381static inline void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm)
382{
383}
384
385static inline void update_hiwater_rss(struct mm_struct *mm)
386{
387}
388
389static inline void update_hiwater_vm(struct mm_struct *mm)
390{
391}
392
393static inline void unmap_vmas(struct mmu_gather *tlb, struct unmap_desc *unmap)
394{
395}
396
397static inline void free_pgtables(struct mmu_gather *tlb, struct unmap_desc *unmap)
398{
399}
400
401static inline void mapping_unmap_writable(struct address_space *mapping)
402{
403}
404
405static inline void flush_dcache_mmap_lock(struct address_space *mapping)
406{
407}
408
409static inline void tlb_finish_mmu(struct mmu_gather *tlb)
410{
411}
412
413static inline struct file *get_file(struct file *f)
414{
415 return f;
416}
417
418static inline int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst)
419{
420 return 0;
421}
422
423static inline void vma_adjust_trans_huge(struct vm_area_struct *vma,
424 unsigned long start,
425 unsigned long end,
426 struct vm_area_struct *next)
427{
428}
429
430static inline void hugetlb_split(struct vm_area_struct *, unsigned long) {}
431
432static inline bool vma_supports_mlock(const struct vm_area_struct *vma)
433{
434 return false;
435}