public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Szabolcs Nagy <szabolcs.nagy@arm.com>,
	Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v2 5/5] Linux: Consolidate auxiliary vector parsing
Date: Fri, 11 Feb 2022 09:47:37 -0300	[thread overview]
Message-ID: <0dea5e89-25fb-3e17-8142-878482f171dd@linaro.org> (raw)
In-Reply-To: <20220211123110.GB2692478@arm.com>



On 11/02/2022 09:31, Szabolcs Nagy via Libc-alpha wrote:
> this broke aarch64 static binaries:
> 
> The 02/03/2022 12:08, Florian Weimer via Libc-alpha wrote
>>  void
>>  _dl_aux_init (ElfW(auxv_t) *av)
>>  {
>> -  int seen = 0;
>> -  uid_t uid = 0;
>> -  gid_t gid = 0;
>> -
>>  #ifdef NEED_DL_SYSINFO
>>    /* NB: Avoid RELATIVE relocation in static PIE.  */
>>    GL(dl_sysinfo) = DL_SYSINFO_DEFAULT;
>>  #endif
>>  
>>    _dl_auxv = av;
>> -  for (; av->a_type != AT_NULL; ++av)
>> -    switch (av->a_type)
>> -      {
>> -      case AT_PAGESZ:
>> -	if (av->a_un.a_val != 0)
>> -	  GLRO(dl_pagesize) = av->a_un.a_val;
>> -	break;
>> -      case AT_CLKTCK:
>> -	GLRO(dl_clktck) = av->a_un.a_val;
>> -	break;
>> -      case AT_PHDR:
>> -	GL(dl_phdr) = (const void *) av->a_un.a_val;
>> -	break;
>> -      case AT_PHNUM:
>> -	GL(dl_phnum) = av->a_un.a_val;
>> -	break;
>> -      case AT_PLATFORM:
>> -	GLRO(dl_platform) = (void *) av->a_un.a_val;
>> -	break;
>> -      case AT_HWCAP:
>> -	GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
>> -	break;
>> -      case AT_HWCAP2:
>> -	GLRO(dl_hwcap2) = (unsigned long int) av->a_un.a_val;
>> -	break;
>> -      case AT_FPUCW:
>> -	GLRO(dl_fpu_control) = av->a_un.a_val;
>> -	break;
>> -#ifdef NEED_DL_SYSINFO
>> -      case AT_SYSINFO:
>> -	GL(dl_sysinfo) = av->a_un.a_val;
>> -	break;
>> -#endif
>> -#ifdef NEED_DL_SYSINFO_DSO
>> -      case AT_SYSINFO_EHDR:
>> -	GL(dl_sysinfo_dso) = (void *) av->a_un.a_val;
>> -	break;
>> -#endif
>> -      case AT_UID:
>> -	uid ^= av->a_un.a_val;
>> -	seen |= 1;
>> -	break;
>> -      case AT_EUID:
>> -	uid ^= av->a_un.a_val;
>> -	seen |= 2;
>> -	break;
>> -      case AT_GID:
>> -	gid ^= av->a_un.a_val;
>> -	seen |= 4;
>> -	break;
>> -      case AT_EGID:
>> -	gid ^= av->a_un.a_val;
>> -	seen |= 8;
>> -	break;
>> -      case AT_SECURE:
>> -	seen = -1;
>> -	__libc_enable_secure = av->a_un.a_val;
>> -	__libc_enable_secure_decided = 1;
>> -	break;
>> -      case AT_RANDOM:
>> -	_dl_random = (void *) av->a_un.a_val;
>> -	break;
>> -      case AT_MINSIGSTKSZ:
>> -	_dl_minsigstacksize = av->a_un.a_val;
>> -	break;
>> -      DL_PLATFORM_AUXV
>> -      }
>> -  if (seen == 0xf)
>> -    {
>> -      __libc_enable_secure = uid != 0 || gid != 0;
>> -      __libc_enable_secure_decided = 1;
>> -    }
>> +  dl_parse_auxv_t auxv_values = { 0, };
>> +  _dl_parse_auxv (av, auxv_values);
> 
> this seems to use memset now on aarch64 before irelative
> relocs are resolved in static binaries.
> 
> which causes infinite loops in the iplt (i've also seen
> segfaults in the build log).
> 
> i wonder what is a clean fix...
> 

Maybe add inhibit_loop_to_libcall to avoid the memset call.

  reply	other threads:[~2022-02-11 12:47 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 11:08 [PATCH v2 0/5] Linux: Auxiliary vector parsing cleanups Florian Weimer
2022-02-03 11:08 ` [PATCH v2 1/5] elf: Merge dl-sysdep.c into the Linux version Florian Weimer
2022-02-08 20:09   ` Adhemerval Zanella
2022-02-03 11:08 ` [PATCH v2 2/5] Linux: Remove HAVE_AUX_SECURE, HAVE_AUX_XID, HAVE_AUX_PAGESIZE Florian Weimer
2022-02-08 20:11   ` Adhemerval Zanella
2022-02-03 11:08 ` [PATCH v2 3/5] Linux: Remove DL_FIND_ARG_COMPONENTS Florian Weimer
2022-02-08 20:12   ` Adhemerval Zanella
2022-02-03 11:08 ` [PATCH v2 4/5] Linux: Assume that NEED_DL_SYSINFO_DSO is always defined Florian Weimer
2022-02-08 20:13   ` Adhemerval Zanella
2022-02-03 11:08 ` [PATCH v2 5/5] Linux: Consolidate auxiliary vector parsing Florian Weimer
2022-02-08 20:19   ` Adhemerval Zanella
2022-02-08 20:34     ` Florian Weimer
2022-02-08 22:57       ` Adhemerval Zanella
2022-02-10 10:54         ` Florian Weimer
2022-02-10 11:29           ` Adhemerval Zanella
2022-02-10 11:31             ` Florian Weimer
2022-02-10 11:40               ` Adhemerval Zanella
2022-02-10 11:46                 ` Adhemerval Zanella
2022-02-11 12:31   ` Szabolcs Nagy
2022-02-11 12:47     ` Adhemerval Zanella [this message]
2022-02-11 13:24       ` Szabolcs Nagy
2022-02-11 13:48         ` Adhemerval Zanella
2022-02-11 14:42           ` H.J. Lu
2022-02-11 14:56             ` Florian Weimer
2022-02-11 13:49         ` Florian Weimer
2022-02-11 14:17           ` Adhemerval Zanella
2022-02-11 14:29             ` Szabolcs Nagy
2022-02-11 18:15               ` Adhemerval Zanella
2022-02-11 17:32     ` Florian Weimer
2022-02-11 17:49       ` Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0dea5e89-25fb-3e17-8142-878482f171dd@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=szabolcs.nagy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).