Page MenuHomeFreeBSD

Stop prepending prefix to the result of realpath(3).
ClosedPublic

Authored by kib on Jan 10 2020, 2:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 24, 3:21 AM
Unknown Object (File)
Thu, Nov 7, 1:30 PM
Unknown Object (File)
Mon, Nov 4, 1:10 PM
Unknown Object (File)
Oct 25 2024, 11:30 PM
Unknown Object (File)
Sep 28 2024, 7:43 AM
Unknown Object (File)
Sep 27 2024, 2:57 AM
Unknown Object (File)
Sep 26 2024, 5:19 AM
Unknown Object (File)
Sep 9 2024, 3:01 AM
Subscribers

Details

Summary

The path is already absolute.

Noted by: rstone

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 28590

Event Timeline

libexec/rtld-elf/rtld.c
5571

This will change /foo/symlink to /bar/target where we didn't before. That's not an enormous deal, but realpath will fail within a capsicum sandbox as it needs to be able to stat every component of the path, including "/". I'd prefer to only use realpath on relative paths for this reason.

libexec/rtld-elf/rtld.c
5571

So do you want realpath(3) at all there ?

libexec/rtld-elf/rtld.c
5571

I can test with cap_getmode(2) and only call realpath if not in cap mode.

This is also a valid question for $ORIGIN resolution, where we use realpath(3) as well. See some minimal discussion with completely wrong patch at D23043.

Do not use realpath() on abs path.

This revision is now accepted and ready to land.Jan 10 2020, 4:35 PM
This revision was automatically updated to reflect the committed changes.