Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:These are the functions used to load a.out style executables and shared* libraries. There is no binary dependent code anywhere else.

Proto:static int load_aout_binary(struct linux_binprm *bprm)

Type:int

Parameter:

TypeParameterName
struct linux_binprm *bprm
119  regs = current_pt_regs()
126  ex = *buf
127  If N_MAGIC(ex) != Code indicating demand-paged executable. && N_MAGIC(ex) != Code indicating object file or impure executable. && N_MAGIC(ex) != This indicates a demand-paged executable with the header in the text. The first page is unmapped to help trap NULL pointer references && N_MAGIC(ex) != Code indicating pure executable. || N_TRSIZE(ex) || N_DRSIZE(ex) || NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they < length of text, in bytes + length of data, in bytes + N_SYMSIZE(ex) + N_TXTOFF(ex) Then
131  Return -ENOEXEC
138  If Not mmap Then Return -ENOEXEC
141  fd_offset = N_TXTOFF(ex)
147  rlim = rlimit(RLIMIT_DATA)
148  If rlim >= RLIM_INFINITY Then rlim = ~0
150  If length of data, in bytes + length of uninitialized data area for file, in bytes > rlim Then Return -ENOMEM
154  retval = Calling this is the point of no return. None of the failures will be* seen by userspace since either the process is already taking a fatal* signal (via de_thread() or coredump), or will have SEGV raised
155  If retval Then Return retval
162  Change personality of the currently running process.(PER_LINUX)
164  setup_new_exec(bprm)
166  end_code = length of text, in bytes + (start_code = Address of text segment in memory after it is loaded. (ex))
168  end_data = length of data, in bytes + (start_data = N_DATADDR(ex))
170  brk = length of uninitialized data area for file, in bytes + (start_brk = Address of bss segment in memory after it is loaded. (ex))
173  retval = Finalizes the stack vm_area_struct. The flags and permissions are updated,* the stack is optionally relocated, and some extra space is added.
174  If retval < 0 Then Return retval
177  stall the new credentials for this executable
179  If N_MAGIC(ex) == Code indicating object file or impure executable. Then
183  text_addr = Address of text segment in memory after it is loaded. (ex)
189  pos = 32
190  map_size = length of text, in bytes + length of data, in bytes
192  error = vm_brk(text_addr & PAGE_MASK, map_size)
193  If error Then Return error
196  error = read_code(file, text_addr, pos, length of text, in bytes + length of data, in bytes )
198  If error < 0 Then Return error
200  Else
207  If (fd_offset & ~PAGE_MASK) != 0 && printk_ratelimit() Then
214  If Not mmap || (fd_offset & ~PAGE_MASK) != 0 Then
216  If error Then Return error
221  Go to beyond_if
224  error = vm_mmap(file, Address of text segment in memory after it is loaded. (ex), length of text, in bytes , page can be read | page can be executed , Interpret addr exactly | Changes are private | ETXTBSY | mark it as an executable , fd_offset)
229  If error != Address of text segment in memory after it is loaded. (ex) Then Return error
232  error = vm_mmap(file, N_DATADDR(ex), length of data, in bytes , page can be read | page can be written | page can be executed , Interpret addr exactly | Changes are private | ETXTBSY | mark it as an executable , fd_offset + length of text, in bytes )
236  If error != N_DATADDR(ex) Then Return error
239  beyond_if :
240  set_binfmt( & aout_format)
242  retval = set_brk(start_brk, brk)
243  If retval < 0 Then Return retval
246  start_stack = reate_aout_tables() parses the env- and arg-strings in new user* memory and creates the pointer tables from them, and puts their* addresses on the "stack", returning the new stack pointer value.
251  Runs immediately before start_thread() takes over.
252  start_thread(regs, start address , start_stack)
253  Return 0