git: 7d6b5a918a5b - main - rtld: Add UTRACE_LOAD_OBJECT traces for rtld and the main binary
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 22 Aug 2025 14:35:29 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=7d6b5a918a5b09ae62a87c331092ffae0fd0fa7b
commit 7d6b5a918a5b09ae62a87c331092ffae0fd0fa7b
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-08-22 13:59:22 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-08-22 13:59:22 +0000
rtld: Add UTRACE_LOAD_OBJECT traces for rtld and the main binary
These two objects are loaded by the kernel not rtld, but adding these
two traces means that UTRACE_LOAD_OBJECT traces now describe the
mappings for all executables and DSOs in a process' address space.
Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: AFRL, DARPA
Differential Revision: https://reviews.freebsd.org/D52034
---
libexec/rtld-elf/rtld.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index a8a2a0fa5a07..d27af520c21d 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -859,6 +859,10 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
linkmap_add(obj_main);
linkmap_add(&obj_rtld);
+ LD_UTRACE(UTRACE_LOAD_OBJECT, obj_main, obj_main->mapbase,
+ obj_main->mapsize, 0, obj_main->path);
+ LD_UTRACE(UTRACE_LOAD_OBJECT, &obj_rtld, obj_rtld.mapbase,
+ obj_rtld.mapsize, 0, obj_rtld.path);
/* Link the main program into the list of objects. */
TAILQ_INSERT_HEAD(&obj_list, obj_main, next);