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)
Fri, Mar 29, 5:21 AM
Unknown Object (File)
Mar 11 2024, 8:49 AM
Unknown Object (File)
Feb 24 2024, 1:21 AM
Unknown Object (File)
Feb 5 2024, 1:16 AM
Unknown Object (File)
Jan 24 2024, 7:09 AM
Unknown Object (File)
Jan 16 2024, 6:14 PM
Unknown Object (File)
Dec 23 2023, 3:59 AM
Unknown Object (File)
Dec 13 2023, 5:20 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.