Skip to content

binfmt_elf: Clean up codes related to total_size passed into elf_map()

Baoquan He linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3binfmt_elf: Clean up the variable name of map flagsfs/binfmt_elf.c+6 -60 replies
2/3binfmt_elf: Get the total_size only for dynamic loader in load_elf_binary()fs/binfmt_elf.c+9 -80 replies
3/3binfmt_elf: Search an unmapped area with total_size but not map the whole imagefs/binfmt_elf.c+14 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] binfmt_elf: Clean up codes related to total_size passed into elf_map()

Currently total_size passed into elf_map() is non-zero only for dynamic loader, either in load_elf_interp(), or in load_elf_binary() for ET_DYN without INTERP case. Now PIE programs are loaded offset from ELF_ET_DYN_BASE, and map flags has been set as MAP_FIXED, no need to use tatal_size strategy.

And in elf_map(), Oleg pointed out that the mmap(total_size) + munmap(extra_size) way looks very ugly. We can search the unmapped area of total_size big, then only map the 1st PT_LOAD segment with the searched address.

In this patchset, clean up them all.

Baoquan He (3):
binfmt_elf: Clean up the variable name of map flags
binfmt_elf: Get the total_size only for dynamic loader in
load_elf_binary()
binfmt_elf: Search an unmapped area with total_size but not map the
whole image

 fs/binfmt_elf.c | 50 +++++++++++++++++++++++++++-----------------------
 1 file changed, 27 insertions(+), 23 deletions(-)
Signature · 1 line
2.5.5