[Bug dynamic-link/34360] Harden dynamic-loader resolution of $ORIGIN DST for setuid/setgid binaries

carlos at redhat dot com via Glibc-bugs <[email protected]> Mon, 06 Jul 2026 15:33:18 +0000
Newsgroups gmane.comp.lib.glibc.bugs
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34360

--- Comment #2 from Carlos O'Donell <carlos at redhat dot com> ---
Discussed with the reporter that the comment in elf/dl-load.c:

 330   /* In SUID/SGID programs, after $ORIGIN expansion the normalized
 331      path must be rooted in one of the trusted directories.  The $LIB
 332      and $PLATFORM DST cannot in any way be manipulated by the caller
 333      because they are fixed values that are set by the dynamic loader
 334      and therefore any paths using just $LIB or $PLATFORM need not be
 335      checked for trust, the authors of the binaries themselves are
 336      trusted to have designed this correctly.  Only $ORIGIN is tested in
 337      this way because it may be manipulated in some ways with hard
 338      links.  */
 339   if (__glibc_unlikely (check_for_trusted)
 340       && !is_trusted_path_normalize (result, wp - result))
 341     {
 342       *result = '\0';
 343       return result;
 344     }

could be improved to mention fs.protected_hardlinks and the exceptional case.

-- 
You are receiving this mail because:
You are on the CC list for the bug.