This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][v2] Add dynamic linker support for $EXEC_ORIGIN.


On Thu, Dec 12, 2013 at 2:21 PM, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:
> On Thu, Dec 12, 2013 at 2:13 PM, Brooks Moses <bmoses@google.com> wrote:
>> +static char *
>> +get_directory (const char *file_path)
>> +{
>> +  assert (file_path != NULL);
>
> This can definitely be called with NULL file_path (if e.g. the kernel
> doesn't supply AT_EXECFN), so assert() doesn't seem appropriate here.

Not quite true.  Although the overall code can be called with a NULL
file path, get_directory() is a subsidiary function that is only
called when it's non-null.  All of the calls to it should go through
set_exec_origin_path(), and the line there that calls it is guarded by
a non-NULL check:

  else if (exe_path != NULL)
    GLRO(dl_exec_origin_path) = get_directory (exe_path);

- Brooks


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]