Page MenuHomeFreeBSD

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

Authored by kib on Jan 10 2020, 2:13 PM.

Details

Summary

The path is already absolute.

Noted by: rstone

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

libexec/rtld-elf/rtld.c
5571 ↗(On Diff #66589)

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 ↗(On Diff #66589)

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

libexec/rtld-elf/rtld.c
5571 ↗(On Diff #66589)

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.