Skip to content

Commit 6118587

Browse files
committed
rtld-elf: Fix VDSO Obj_Entry mapsize and report in utrace(2)
Subtracing addr is only appropriate for position-dependent objects, where vaddrbase would also be the same value. For position-independent objects, like the VDSO (which we already assume due to setting vaddrbase to 0), the segments start at 0, not addr. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51924
1 parent 69af14a commit 6118587

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libexec/rtld-elf/rtld.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,7 +3031,7 @@ load_kpreload(const void *addr)
30313031
}
30323032

30333033
obj->mapbase = __DECONST(caddr_t, addr);
3034-
obj->mapsize = segn->p_vaddr + segn->p_memsz - (Elf_Addr)addr;
3034+
obj->mapsize = segn->p_vaddr + segn->p_memsz;
30353035
obj->vaddrbase = 0;
30363036
obj->relocbase = obj->mapbase;
30373037

@@ -3060,7 +3060,8 @@ load_kpreload(const void *addr)
30603060
linkmap_add(obj); /* for GDB & dlinfo() */
30613061
max_stack_flags |= obj->stack_flags;
30623062

3063-
LD_UTRACE(UTRACE_LOAD_OBJECT, obj, obj->mapbase, 0, 0, obj->path);
3063+
LD_UTRACE(UTRACE_LOAD_OBJECT, obj, obj->mapbase, obj->mapsize, 0,
3064+
obj->path);
30643065
return (0);
30653066
}
30663067

0 commit comments

Comments
 (0)