tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fixing $ORGIN RPATHs - at least some of them



In article <6e444ce7-ed29-4ce6-bd90-ac308c3d68ed%gmx.com@localhost>,
Kamil Rytarowski  <n54%gmx.com@localhost> wrote:
>-=-=-=-=-=-
>-=-=-=-=-=-
>
>On 05.11.2017 15:04, Martin Husemann wrote:
>> The patch below makes ld.elf_so try to fall back to /proc/current/exe
>> if the kernel did not pass an execname in AUX and $ORIGIN needs to
>> be expanded.
>> 
>
>I propose to use sysctl(2) with KERN_PROC_PATHNAME.
>
>There are few problems with this interface that should be fixed:
> - hardlinks can give wrong results,
> - no support for null mounts,
> - max returned size is restricted to PATH_MAX/2,
> - if a file name is longer than 31 characters we return failure.
>
>Reading /proc/current/exe uses the same algorithm under the neath.

So does KERN_PROC_PATHNAME.

Which means that if vnode_to_path() failed for the text vnode of the
program during exec, it will also fail later sysctl or procfs :-)

Instead of doing trying userland kludges to find the pathname (that don't
really work -- after all if the kernel does not know, userland can only
guess), we should fix the kernel so that it is recorded properly.

christos



Home | Main Index | Thread Index | Old Index