Skip to content

Commit

Permalink
i#6529: Check end of section headers mapped (#6531)
Browse files Browse the repository at this point in the history
Updates the rseq_process_module() check for the section headers being in
the mapped region to check the endpoint instead of the start point.

Tested locally: now client.drwrap-test passes when it failed with the
toolchain on my local machine.

Fixes #6529
  • Loading branch information
derekbruening authored Jan 2, 2024
1 parent 996c37d commit 1e37940
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/unix/rseq_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,9 @@ rseq_process_module(module_area_t *ma, bool at_map, bool saw_glibc_rseq_reg)
ELF_SECTION_HEADER_TYPE *sec_hdr = NULL;
char *strtab;
ssize_t load_offs = ma->start - ma->os_data.base_address;
if (at_map && elf_hdr->e_shoff + ma->start < ma->end) {
if (at_map &&
elf_hdr->e_shoff + elf_hdr->e_shnum * elf_hdr->e_shentsize + ma->start <
ma->end) {
sec_map = elf_hdr->e_shoff + ma->start;
sec_hdr = (ELF_SECTION_HEADER_TYPE *)sec_map;
/* We assume strtab is there too. */
Expand Down

0 comments on commit 1e37940

Please sign in to comment.