criu/compel
Pavel Tikhomirov 98fbb766d6 compel/handle-elf: override unexpected precalculated addresses
We've seen addresses in parasite.built-in.o precalculated by linker but
in some unexpected manner:

readelf -WS criu/pie/parasite.built-in.o
Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 1] .text             PROGBITS        0000000000000000 000040 00400a 00  AX  0   0 16
  [87] .data             PROGBITS        0000000000000000 005000 000068 00  WA  0   0 4096
  [88] .rodata           PROGBITS        0000000000000080 005080 001016 00   A  0   0 32

(Notes: All other sections does not have SHF_ALLOC or are of size 0, so I
skip them. Need to add "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1" to
CFLAGS to reproduce.)

Section 88 has address 0x80 in elf file but in our "consequent"
addresses precalculation algorithm it should be at 0x5080:

  addr(.text) == 0x0
  addr(.data) == 0x400a + (0x1000 - 0x400a % 0x1000) + 0x68 == 0x5068
  addr(.rodata) == 0x5068 + (0x20 - 0x5068 % 0x20) == 0x5080

Probably the linker advises us to move 4096 aligned section to the
beginning to save some space, but it's just a guess.

So probably we should be ready to "non-consequent" alignments
precalculated and just override them.

https://github.com/checkpoint-restore/criu/issues/1301

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2021-09-03 10:31:00 -07:00
..
arch compel: don't mmap parasite as RWX 2021-09-03 10:31:00 -07:00
include compel: don't mmap parasite as RWX 2021-09-03 10:31:00 -07:00
plugins compel/log: Provide %u specifier parsing 2021-09-03 10:31:00 -07:00
src compel/handle-elf: override unexpected precalculated addresses 2021-09-03 10:31:00 -07:00
test compel: Remove compel.h 2020-03-27 19:36:20 +03:00
.gitignore compel: adapt .gitgnore for aarch64 and ppc64le 2017-08-09 18:51:42 +03:00
compel-host compel cli: show includes 2017-03-15 00:09:55 +03:00
Makefile compel: Don't use CFLAGS_PIE for libcompel.so 2019-09-07 15:59:50 +03:00