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] Adjust AT_EXECFN on explicit loader invocation


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"


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