1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2011 Richard Weinberger <richrd@nod.at>
9 static struct vm_area_struct gate_vma
;
11 static int __init
gate_vma_init(void)
13 if (!FIXADDR_USER_START
)
16 vma_init(&gate_vma
, NULL
);
17 gate_vma
.vm_start
= FIXADDR_USER_START
;
18 gate_vma
.vm_end
= FIXADDR_USER_END
;
19 gate_vma
.vm_flags
= VM_READ
| VM_MAYREAD
| VM_EXEC
| VM_MAYEXEC
;
20 gate_vma
.vm_page_prot
= __P101
;
24 __initcall(gate_vma_init
);
26 struct vm_area_struct
*get_gate_vma(struct mm_struct
*mm
)
28 return FIXADDR_USER_START
? &gate_vma
: NULL
;
31 int in_gate_area_no_mm(unsigned long addr
)
33 if (!FIXADDR_USER_START
)
36 if ((addr
>= FIXADDR_USER_START
) && (addr
< FIXADDR_USER_END
))
42 int in_gate_area(struct mm_struct
*mm
, unsigned long addr
)
44 struct vm_area_struct
*vma
= get_gate_vma(mm
);
49 return (addr
>= vma
->vm_start
) && (addr
< vma
->vm_end
);