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
This commit is contained in:
John Baldwin
2025-08-22 09:59:22 -04:00
parent e679319b84
commit 7d6b5a918a
+4
View File
@@ -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);