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]

_dl_random: Typo in generic code, and definition for Hurd


Hello!

Ulrich, you introduced a typo with your recent commits.  The first patch
below fixes this.

2009-01-11  Thomas Schwinge  <tschwinge@gnu.org>

	* sysdeps/generic/dl-osinfo.h (_dl_setup_stack_chk_guard)
	(_dl_setup_pointer_guard): Use memcpy instead of memcmp.

diff --git a/sysdeps/generic/dl-osinfo.h b/sysdeps/generic/dl-osinfo.h
index 02ec28d..ee16a99 100644
--- a/sysdeps/generic/dl-osinfo.h
+++ b/sysdeps/generic/dl-osinfo.h
@@ -13,7 +13,7 @@ _dl_setup_stack_chk_guard (void *dl_random)
       p[0] = 0;
     }
   else
-    memcmp (&ret, dl_random, sizeof (ret));
+    memcpy (&ret, dl_random, sizeof (ret));
   return ret;
 }
 
@@ -24,6 +24,6 @@ _dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard)
   if (dl_random == NULL)
     ret = stack_chk_guard;
   else
-    memcmp (&ret, (char *) dl_random + sizeof (ret), sizeof (ret));
+    memcpy (&ret, (char *) dl_random + sizeof (ret), sizeof (ret));
   return ret;
 }


And here is the snippet for the Hurd.

Again, when submitting such patches, should they include copyright year
updates, or rather not, as these may fall out of date?

2009-01-11  Thomas Schwinge  <tschwinge@gnu.org>

	* sysdeps/mach/hurd/dl-sysdep.c (_dl_random): Define.

diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 2440682..c189c0a 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -59,6 +62,9 @@ void *__libc_stack_end;
 hp_timing_t _dl_cpuclock_offset;
 #endif
 
+/* This is never properly initialized in here.  */
+void *_dl_random attribute_relro = NULL;
+
 
 struct hurd_startup_data *_dl_hurd_data;
 


Regards,
 Thomas

Attachment: signature.asc
Description: Digital signature


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