mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
mm: unexport vm_brk_flags() and eliminate vm_flags parameter
This function is only used by elf_load(), and that is a static function that doesn't need an exported symbol to invoke an internal function, so un-EXPORT_SYMBOLS() it. Also, the vm_flags parameter is unnecessary, as we only ever set VM_EXEC, so simply make this parameter a boolean. While we're here, clean up the mm.h definitions for the various vm_xxx() helpers so we actually specify parameter names and elide the redundant extern's. Link: https://lkml.kernel.org/r/7bada48ddf3f9dbd3e6c4fc50ec2f4de97706f52.1774034900.git.ljs@kernel.org Signed-off-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org> Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Alexandre Ghiti <alex@ghiti.fr> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com> Cc: "Borislav Petkov (AMD)" <bp@alien8.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Chengming Zhou <chengming.zhou@linux.dev> Cc: Christian Borntraeger <borntraeger@linux.ibm.com> Cc: Christian Brauner <brauner@kernel.org> Cc: David Hildenbrand <david@kernel.org> Cc: Dinh Nguyen <dinguyen@kernel.org> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jan Kara <jack@suse.cz> Cc: Jann Horn <jannh@google.com> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: Kees Cook <kees@kernel.org> Cc: Liam Howlett <liam.howlett@oracle.com> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Ondrej Mosnacek <omosnace@redhat.com> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Paul Moore <paul@paul-moore.com> Cc: Pedro Falcato <pfalcato@suse.de> Cc: Richard Weinberger <richard@nod.at> Cc: Russell King <linux@armlinux.org.uk> Cc: Stephen Smalley <stephen.smalley.work@gmail.com> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Sven Schnelle <svens@linux.ibm.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Vineet Gupta <vgupta@kernel.org> Cc: WANG Xuerui <kernel@xen0n.name> Cc: Will Deacon <will@kernel.org> Cc: xu xin <xu.xin16@zte.com.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
b22a48ec09
commit
5fb55e951c
@@ -453,14 +453,13 @@ static unsigned long elf_load(struct file *filep, unsigned long addr,
|
||||
zero_end = ELF_PAGEALIGN(zero_end);
|
||||
|
||||
error = vm_brk_flags(zero_start, zero_end - zero_start,
|
||||
prot & PROT_EXEC ? VM_EXEC : 0);
|
||||
prot & PROT_EXEC);
|
||||
if (error)
|
||||
map_addr = error;
|
||||
}
|
||||
return map_addr;
|
||||
}
|
||||
|
||||
|
||||
static unsigned long total_mapping_size(const struct elf_phdr *phdr, int nr)
|
||||
{
|
||||
elf_addr_t min_addr = -1;
|
||||
|
||||
@@ -3991,12 +3991,12 @@ static inline void mm_populate(unsigned long addr, unsigned long len) {}
|
||||
#endif
|
||||
|
||||
/* This takes the mm semaphore itself */
|
||||
extern int __must_check vm_brk_flags(unsigned long, unsigned long, unsigned long);
|
||||
extern int vm_munmap(unsigned long, size_t);
|
||||
extern unsigned long __must_check vm_mmap(struct file *, unsigned long,
|
||||
unsigned long, unsigned long,
|
||||
unsigned long, unsigned long);
|
||||
extern unsigned long __must_check vm_mmap_shadow_stack(unsigned long addr,
|
||||
int __must_check vm_brk_flags(unsigned long addr, unsigned long request, bool is_exec);
|
||||
int vm_munmap(unsigned long start, size_t len);
|
||||
unsigned long __must_check vm_mmap(struct file *file, unsigned long addr,
|
||||
unsigned long len, unsigned long prot,
|
||||
unsigned long flag, unsigned long offset);
|
||||
unsigned long __must_check vm_mmap_shadow_stack(unsigned long addr,
|
||||
unsigned long len, unsigned long flags);
|
||||
|
||||
struct vm_unmapped_area_info {
|
||||
|
||||
@@ -1201,8 +1201,9 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int vm_brk_flags(unsigned long addr, unsigned long request, vm_flags_t vm_flags)
|
||||
int vm_brk_flags(unsigned long addr, unsigned long request, bool is_exec)
|
||||
{
|
||||
const vm_flags_t vm_flags = is_exec ? VM_EXEC : 0;
|
||||
struct mm_struct *mm = current->mm;
|
||||
struct vm_area_struct *vma = NULL;
|
||||
unsigned long len;
|
||||
@@ -1217,10 +1218,6 @@ int vm_brk_flags(unsigned long addr, unsigned long request, vm_flags_t vm_flags)
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
/* Until we need other flags, refuse anything except VM_EXEC. */
|
||||
if ((vm_flags & (~VM_EXEC)) != 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (mmap_write_lock_killable(mm))
|
||||
return -EINTR;
|
||||
|
||||
@@ -1246,7 +1243,6 @@ limits_failed:
|
||||
mmap_write_unlock(mm);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(vm_brk_flags);
|
||||
|
||||
static
|
||||
unsigned long tear_down_vmas(struct mm_struct *mm, struct vma_iterator *vmi,
|
||||
|
||||
Reference in New Issue
Block a user