about summary refs log tree commit diff
path: root/stdio-common/fscanf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-12-15 13:58:33 -0800
committerH.J. Lu <hjl.tools@gmail.com>2022-01-21 11:18:03 -0800
commite22a4557eb39d7cba9a74d70f4582c13f1a7a83a (patch)
tree591a391f4e503c61970443d16c6e3f5881532985 /stdio-common/fscanf.c
parentee8d5e33adb284601c00c94687bc907e10aec9bb (diff)
downloadglibc-e22a4557eb39d7cba9a74d70f4582c13f1a7a83a.tar.gz
glibc-e22a4557eb39d7cba9a74d70f4582c13f1a7a83a.tar.xz
glibc-e22a4557eb39d7cba9a74d70f4582c13f1a7a83a.zip
elf: Properly align all PT_LOAD segments [BZ #28676]
Linker may set p_align of a PT_LOAD segment larger than p_align of the
first PT_LOAD segment to satisfy a section alignment:

Elf file type is DYN (Shared object file)
Entry point 0x0
There are 10 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000834 0x0000000000000834  R E    0x1000
  LOAD           0x0000000000000e00 0x0000000000001e00 0x0000000000001e00
                 0x0000000000000230 0x0000000000000230  RW     0x1000
  LOAD           0x0000000000400000 0x0000000000400000 0x0000000000400000
                 0x0000000000000004 0x0000000000000008  RW     0x400000
...

 Section to Segment mapping:
  Segment Sections...
   00     .note.gnu.property .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .plt.got .text .fini .rodata .eh_frame_hdr .eh_frame
   01     .init_array .fini_array .data.rel.ro .dynamic .got .got.plt
   02     .data .bss

We should align the first PT_LOAD segment to the maximum p_align of all
PT_LOAD segments, similar to the kernel commit:

commit ce81bb256a224259ab686742a6284930cbe4f1fa
Author: Chris Kennelly <ckennelly@google.com>
Date:   Thu Oct 15 20:12:32 2020 -0700

    fs/binfmt_elf: use PT_LOAD p_align values for suitable start address

This fixes BZ #28676.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'stdio-common/fscanf.c')
0 files changed, 0 insertions, 0 deletions