Skip to content

Conversation

ovpanait
Copy link
Contributor

A PT_PHDR corruption was previously reported and fixed in [1]: the issue was
that the VirtAddr field of the PT_PHDR program header would get overwritten
with the file offset of the program header table rather than the virtual
address. A testcase for this was also added in [2]. However, the tescase is not
included in the Makefile.am regression testsuite and also tries to run a x86_64
prebuilt binary unconditionally, which would not work on other architectures.

To fix this, create a standalone testcase for the PT_PHDR VirtAddr field
corruption and include it in Makefile.am. In order to reproduce [1], a binary
with the following characteristics is needed:

  • the ELF file type must be ET_DYN
  • the ELF file must contain a PT_PHDR program header
  • the file offset and the VirtAddr field of the PT_PHDR program header must be
    different

[1] #243
[2] 8f94e11

Signed-off-by: Ovidiu Panait ovpanait@gmail.com

Thank you!

Please do your best to include a regression test
so that the quality of future releases can be preserved.

A PT_PHDR corruption was previously reported and fixed in [1]: the issue was
that the VirtAddr field of the PT_PHDR program header would get overwritten
with the file offset of the program header table rather than the virtual
address. A testcase for this was also added in [2]. However, the tescase is not
included in the Makefile.am regression testsuite and also tries to run a x86_64
prebuilt binary unconditionally, which would not work on other architectures.

To fix this, create a standalone testcase for the PT_PHDR VirtAddr field
corruption and include it in Makefile.am. In order to reproduce [1], a binary
with the following characteristics is needed:
- the ELF file type must be ET_DYN
- the ELF file must contain a PT_PHDR program header
- the file offset and the VirtAddr field of the PT_PHDR program header must be
  different

[1] NixOS#243
[2] NixOS@8f94e11

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
@Mic92 Mic92 merged commit 5875040 into NixOS:master Sep 26, 2021
@Mic92
Copy link
Member

Mic92 commented Sep 26, 2021

Thanks. This is a lot better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants