Skip to content

Commit a6c19df

Browse files
amlutotorvalds
authored andcommitted
arm64,ia64,ppc,s390,sh,tile,um,x86,mm: remove default gate area
The core mm code will provide a default gate area based on FIXADDR_USER_START and FIXADDR_USER_END if !defined(__HAVE_ARCH_GATE_AREA) && defined(AT_SYSINFO_EHDR). This default is only useful for ia64. arm64, ppc, s390, sh, tile, 64-bit UML, and x86_32 have their own code just to disable it. arm, 32-bit UML, and x86_64 have gate areas, but they have their own implementations. This gets rid of the default and moves the code into ia64. This should save some code on architectures without a gate area: it's now possible to inline the gate_area functions in the default case. Signed-off-by: Andy Lutomirski <luto@amacapital.net> Acked-by: Nathan Lynch <nathan_lynch@mentor.com> Acked-by: H. Peter Anvin <hpa@linux.intel.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [in principle] Acked-by: Richard Weinberger <richard@nod.at> [for um] Acked-by: Will Deacon <will.deacon@arm.com> [for arm64] Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Jeff Dike <jdike@addtoit.com> Cc: Richard Weinberger <richard@nod.at> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Nathan Lynch <Nathan_Lynch@mentor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e0d9bf4 commit a6c19df

21 files changed

Lines changed: 53 additions & 182 deletions

File tree

‎arch/arm64/include/asm/page.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
2929
#define PAGE_MASK (~(PAGE_SIZE-1))
3030

31-
/* We do define AT_SYSINFO_EHDR but don't use the gate mechanism */
32-
#define __HAVE_ARCH_GATE_AREA 1
33-
3431
/*
3532
* The idmap and swapper page tables need some space reserved in the kernel
3633
* image. Both require pgd, pud (4 levels only) and pmd tables to (section)

‎arch/arm64/kernel/vdso.c‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -194,25 +194,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
194194
return PTR_ERR(ret);
195195
}
196196

197-
/*
198-
* We define AT_SYSINFO_EHDR, so we need these function stubs to keep
199-
* Linux happy.
200-
*/
201-
int in_gate_area_no_mm(unsigned long addr)
202-
{
203-
return 0;
204-
}
205-
206-
int in_gate_area(struct mm_struct *mm, unsigned long addr)
207-
{
208-
return 0;
209-
}
210-
211-
struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
212-
{
213-
return NULL;
214-
}
215-
216197
/*
217198
* Update the vDSO data page to keep in sync with kernel timekeeping.
218199
*/

‎arch/ia64/include/asm/page.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,6 @@ get_order (unsigned long size)
231231
#define PERCPU_ADDR (-PERCPU_PAGE_SIZE)
232232
#define LOAD_OFFSET (KERNEL_START - KERNEL_TR_PAGE_SIZE)
233233

234+
#define __HAVE_ARCH_GATE_AREA 1
235+
234236
#endif /* _ASM_IA64_PAGE_H */

‎arch/ia64/mm/init.c‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,37 @@ setup_gate (void)
278278
ia64_patch_gate();
279279
}
280280

281+
static struct vm_area_struct gate_vma;
282+
283+
static int __init gate_vma_init(void)
284+
{
285+
gate_vma.vm_mm = NULL;
286+
gate_vma.vm_start = FIXADDR_USER_START;
287+
gate_vma.vm_end = FIXADDR_USER_END;
288+
gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
289+
gate_vma.vm_page_prot = __P101;
290+
291+
return 0;
292+
}
293+
__initcall(gate_vma_init);
294+
295+
struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
296+
{
297+
return &gate_vma;
298+
}
299+
300+
int in_gate_area_no_mm(unsigned long addr)
301+
{
302+
if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END))
303+
return 1;
304+
return 0;
305+
}
306+
307+
int in_gate_area(struct mm_struct *mm, unsigned long addr)
308+
{
309+
return in_gate_area_no_mm(addr);
310+
}
311+
281312
void ia64_mmu_init(void *my_cpu_data)
282313
{
283314
unsigned long pta, impl_va_bits;

‎arch/powerpc/include/asm/page.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ extern unsigned int HPAGE_SHIFT;
4848
#define HUGE_MAX_HSTATE (MMU_PAGE_COUNT-1)
4949
#endif
5050

51-
/* We do define AT_SYSINFO_EHDR but don't use the gate mechanism */
52-
#define __HAVE_ARCH_GATE_AREA 1
53-
5451
/*
5552
* Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we
5653
* assign PAGE_MASK to a larger type it gets extended the way we want

‎arch/powerpc/kernel/vdso.c‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -840,19 +840,3 @@ static int __init vdso_init(void)
840840
return 0;
841841
}
842842
arch_initcall(vdso_init);
843-
844-
int in_gate_area_no_mm(unsigned long addr)
845-
{
846-
return 0;
847-
}
848-
849-
int in_gate_area(struct mm_struct *mm, unsigned long addr)
850-
{
851-
return 0;
852-
}
853-
854-
struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
855-
{
856-
return NULL;
857-
}
858-

‎arch/s390/include/asm/page.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,4 @@ static inline int devmem_is_allowed(unsigned long pfn)
162162
#include <asm-generic/memory_model.h>
163163
#include <asm-generic/getorder.h>
164164

165-
#define __HAVE_ARCH_GATE_AREA 1
166-
167165
#endif /* _S390_PAGE_H */

‎arch/s390/kernel/vdso.c‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -316,18 +316,3 @@ static int __init vdso_init(void)
316316
return 0;
317317
}
318318
early_initcall(vdso_init);
319-
320-
int in_gate_area_no_mm(unsigned long addr)
321-
{
322-
return 0;
323-
}
324-
325-
int in_gate_area(struct mm_struct *mm, unsigned long addr)
326-
{
327-
return 0;
328-
}
329-
330-
struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
331-
{
332-
return NULL;
333-
}

‎arch/sh/include/asm/page.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,6 @@ typedef struct page *pgtable_t;
186186
#include <asm-generic/memory_model.h>
187187
#include <asm-generic/getorder.h>
188188

189-
/* vDSO support */
190-
#ifdef CONFIG_VSYSCALL
191-
#define __HAVE_ARCH_GATE_AREA
192-
#endif
193-
194189
/*
195190
* Some drivers need to perform DMA into kmalloc'ed buffers
196191
* and so we have to increase the kmalloc minalign for this.

‎arch/sh/kernel/vsyscall/vsyscall.c‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,3 @@ const char *arch_vma_name(struct vm_area_struct *vma)
9292

9393
return NULL;
9494
}
95-
96-
struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
97-
{
98-
return NULL;
99-
}
100-
101-
int in_gate_area(struct mm_struct *mm, unsigned long address)
102-
{
103-
return 0;
104-
}
105-
106-
int in_gate_area_no_mm(unsigned long address)
107-
{
108-
return 0;
109-
}

0 commit comments

Comments
 (0)