Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\binfmt_elf.c Create Date:2022-07-28 20:28:22
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:elf_map

Proto:static unsigned long elf_map(struct file *filep, unsigned long addr, const struct elf64_phdr *eppnt, int prot, int type, unsigned long total_size)

Type:unsigned long

Parameter:

TypeParameterName
struct file *filep
unsigned longaddr
const struct elf64_phdr *eppnt
intprot
inttype
unsigned longtotal_size
353  size = Segment size in file + ELF_PAGEOFFSET( Segment virtual address )
354  off = Segment file offset - ELF_PAGEOFFSET( Segment virtual address )
355  addr = ELF_PAGESTART(addr)
356  size = ELF_PAGEALIGN(size)
360  If Not size Then Return addr
371  If total_size Then
372  total_size = ELF_PAGEALIGN(total_size)
373  map_addr = vm_mmap(filep, addr, total_size, prot, type, off)
374  If Not BAD_ADDR(map_addr) Then vm_munmap(map_addr + size, total_size - size)
376  Else map_addr = vm_mmap(filep, addr, size, prot, type, off)
379  If type & MAP_FIXED which doesn't unmap underlying mapping && PTR_ERR((void * )map_addr) == -EEXIST Then pr_info("%d (%s): Uhuuh, elf segment at %px requested but the memory is mapped already\n", task_pid_nr(current process), comm, (void * )addr)
384  Return map_addr
Caller
NameDescribe
load_elf_interpThis is much more generalized than the library routine read function,so we keep this separate. Technically the library read functionis only provided so that we can read a.out libraries that havean ELF header
load_elf_binary