This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][v2] Add dynamic linker support for $EXEC_ORIGIN.
- From: Brooks Moses <bmoses at google dot com>
- To: Paul Pluzhnikov <ppluzhnikov at google dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>, "Carlos O'Donnell" <carlos at redhat dot com>
- Date: Thu, 12 Dec 2013 14:33:19 -0800
- Subject: Re: [PATCH][v2] Add dynamic linker support for $EXEC_ORIGIN.
- Authentication-results: sourceware.org; auth=none
- References: <1386634331-21691-1-git-send-email-bmoses at google dot com> <1386886419-18491-1-git-send-email-bmoses at google dot com> <CALoOobNNGXUihptjMPGQdVi8mxwz6WpZZ7S8tz+GGW-pZrBRgA at mail dot gmail dot com>
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