This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [patch] Adjust AT_EXECFN on explicit loader invocation
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Paul Pluzhnikov <ppluzhnikov at google dot com>
- Cc: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>, libc-alpha at sourceware dot org
- Date: Mon, 18 Nov 2013 17:19:25 +0100
- Subject: Re: [patch] Adjust AT_EXECFN on explicit loader invocation
- Authentication-results: sourceware.org; auth=none
- References: <ye6qeh8lrcsk dot fsf at elbrus2 dot mtv dot corp dot google dot com> <CALoOobMreT4Ukk44cDRnwt=mDJfqtuamEMm9QHndOh-MuZJoRA at mail dot gmail dot com> <5277EA1D dot 9080305 at linux dot vnet dot ibm dot com> <CALoOobNcSjUKMs4GBsYm7sr5D++JZrAv6ZpehHC=5QYWrPXSdw at mail dot gmail dot com>
On Wed, Nov 13, 2013 at 11:00:28AM -0800, Paul Pluzhnikov wrote:
> On Mon, Nov 4, 2013 at 10:40 AM, Adhemerval Zanella
> <azanella@linux.vnet.ibm.com> wrote:
> > I think it would be good if you integrate the attached testcase as a real one.
>
> Done.
>
> Thanks,
> --
> Paul Pluzhnikov
>
>
> +#ifdef HAVE_AUX_VECTOR
> +
> +static int
> +do_test (int argc, char *argv[])
> +{
> +# if _STACK_GROWS_DOWN
> + const int incr = 1;
> +# else
> + const int incr = -1;
> +# endif
> +
> + char **e = __environ;
> + ElfW (auxv_t) *aux;
> +
> + for (; *e != NULL; e += incr)
> + ;
> +
This is quite confusing when stack grows up, a this part will skip a
AT_NULL auxval and what happens if there is no AT_EXECFN?
> + for (aux = (ElfW (auxv_t) *) (e + incr); aux->a_type != AT_NULL; aux += incr)
> + if (aux->a_type == AT_EXECFN)
> + {
> + return strcmp (argv[0], (char *) aux->a_un.a_val) ? 1 : 0;
> + }
> +
> + fprintf (stderr, "did not find AT_EXECFN in auxv[]\n");
> + return 1;
> +}
> +
> +#else /* HAVE_AUX_VECTOR */
> +
> +static int
> +do_test(int argc, char *argv[])
> +{
> + return 0;
> +}
> +
> +#endif /* HAVE_AUX_VECTOR */
> +
> +#include "../test-skeleton.c"