-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Description
The auxiliary vector (AUXV) is an important source of system information and is used in multiple places across libc. Unfortunately, since it was implemented before the latest paradigm shift, its functionality is exposed solely through the public interface—something that is not recommended for internal APIs. We should consider moving it to OSUtils or another suitable internal module.
The current implementation uses three strategies to obtain AUXV:
-
Startup routine path – If the library is using libc’s own startup routine, the AUXV pointer is passed via the platform ABI to the startup function. This pointer is cached directly by
crt0
, andgetauxval
accesses the vector through this cached pointer. -
prctl(PR_GET_AUXV)
– If the system supports theprctl
PR_GET_AUXV
operation, the vector is retrieved via a syscall from cachedmmap
-ed pages. -
/proc/self/auxv
– If/proc
is mounted, the vector is read from/proc/self/auxv
.
The fallback routines (2) and (3) introduce most of the complexity.
During the rework, we might want to simplify this behavior, possibly consolidating or streamlining the retrieval logic.
Looking forward to your thoughts.