Skip to content

Commit

Permalink
[Pal/Linux] Fix vDSO range retrieval
Browse files Browse the repository at this point in the history
This change causes PAL to report the vDSO range based on
`/proc/self/maps`, instead of parsing the ELF mapped there and
processing PT_LOAD commands.

On my system, the former method returns 1 page, even though according to
`/proc/self/maps` vDSO occupies 2 pages. As a result, under some
circumstances (Docker and ASLR disabled) LibOS tries to map memory over
vDSO.

Signed-off-by: Paweł Marczewski <pawel@invisiblethingslab.com>
  • Loading branch information
pwmarcz committed Sep 27, 2021
1 parent 7d8a5eb commit 1eb3fa6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Pal/src/host/Linux/db_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ noreturn void pal_linux_main(void* initial_rsp, void* fini_callback) {
INIT_FAIL(-ret, "getting vdso and vvar ranges failed");
}

if (!g_vdso_start && !g_vdso_end) {
/* We did not get vdso address from the auxiliary vector. */
if (vdso_start || vdso_end) {
/* Override the range retrieved by parsing vdso: the actual mapped range might be bigger. */
g_vdso_start = vdso_start;
g_vdso_end = vdso_end;
}
Expand Down

0 comments on commit 1eb3fa6

Please sign in to comment.