Author: bdragon
Date: Sat Sep 14 21:18:10 2019
New Revision: 352340
URL: https://svnweb.freebsd.org/changeset/base/352340

Log:
  Fix aux_info corruption in rtld direct execution mode.
  
  After the aux vector is moved, it is necessary to re-digest aux_info so the
  pointers are updated to the new locations.
  
  This was causing thread creation to fail on powerpc64 when using direct
  execution due to a nonsense value being read for aux_info[AT_STACKPROT].
  
  Approved by: jhibbits (mentor)
  Differential Revision: https://reviews.freebsd.org/D21656

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c        Sat Sep 14 20:26:50 2019        
(r352339)
+++ head/libexec/rtld-elf/rtld.c        Sat Sep 14 21:18:10 2019        
(r352340)
@@ -499,6 +499,13 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr
                    if (auxp->a_type == AT_NULL)
                            break;
                }
+               /* Since the auxiliary vector has moved, redigest it. */
+               for (i = 0;  i < AT_COUNT;  i++)
+                   aux_info[i] = NULL;
+               for (auxp = aux;  auxp->a_type != AT_NULL;  auxp++) {
+                   if (auxp->a_type < AT_COUNT)
+                       aux_info[auxp->a_type] = auxp;
+               }
            } else {
                _rtld_error("No binary");
                rtld_die();
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to