public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/arm/morello/main] TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guard
@ 2022-08-05 19:33 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2022-08-05 19:33 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=887a33c6bbeb52fc71cf486759ec22ecbd47a946

commit 887a33c6bbeb52fc71cf486759ec22ecbd47a946
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Fri Jul 15 19:33:23 2022 +0100

    TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guard
    
    morello purecap gcc in some cases inlines 16byte memcpy as a capability
    load, which is wrong if the source or dest may be unaligned.
    
    stack guard only needs random for the address portion since only that
    part is compared, so 8 byte is enough with 64 bit addresses, but the
    current code is only right on little endian systems.
    
    TODO: drop when gcc is fixed

Diff:
---
 sysdeps/unix/sysv/linux/dl-osinfo.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index b4104e0539..c5d864f5ba 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -34,7 +34,11 @@ _dl_setup_stack_chk_guard (void *dl_random)
   /* We need in the moment only 8 bytes on 32-bit platforms and 16
      bytes on 64-bit platforms.  Therefore we can use the data
      directly and not use the kernel-provided data to seed a PRNG.  */
+#ifdef __CHERI_PURE_CAPABILITY__
+  memcpy (ret.bytes, dl_random, 8);
+#else
   memcpy (ret.bytes, dl_random, sizeof (ret));
+#endif
 #if BYTE_ORDER == LITTLE_ENDIAN
   ret.num &= ~(uintptr_t) 0xff;
 #elif BYTE_ORDER == BIG_ENDIAN


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [glibc/arm/morello/main] TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guard
@ 2022-11-23 14:41 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2022-11-23 14:41 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c75b4885df122eb0ad63802f7ca9e3604a0d10f3

commit c75b4885df122eb0ad63802f7ca9e3604a0d10f3
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Fri Jul 15 19:33:23 2022 +0100

    TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guard
    
    morello purecap gcc in some cases inlines 16byte memcpy as a capability
    load, which is wrong if the source or dest may be unaligned.
    
    stack guard only needs random for the address portion since only that
    part is compared, so 8 byte is enough with 64 bit addresses, but the
    current code is only right on little endian systems.
    
    TODO: drop when gcc is fixed

Diff:
---
 sysdeps/unix/sysv/linux/dl-osinfo.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index 7888915f12..49d8f973c8 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -34,7 +34,11 @@ _dl_setup_stack_chk_guard (void *dl_random)
   /* We need in the moment only 8 bytes on 32-bit platforms and 16
      bytes on 64-bit platforms.  Therefore we can use the data
      directly and not use the kernel-provided data to seed a PRNG.  */
+#ifdef __CHERI_PURE_CAPABILITY__
+  memcpy (ret.bytes, dl_random, 8);
+#else
   memcpy (ret.bytes, dl_random, sizeof (ret));
+#endif
 #if BYTE_ORDER == LITTLE_ENDIAN
   ret.num &= ~(uintptr_t) 0xff;
 #elif BYTE_ORDER == BIG_ENDIAN

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [glibc/arm/morello/main] TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guard
@ 2022-10-27 13:51 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2022-10-27 13:51 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=465880458a62761b9e976e49403485929634ebe9

commit 465880458a62761b9e976e49403485929634ebe9
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Fri Jul 15 19:33:23 2022 +0100

    TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guard
    
    morello purecap gcc in some cases inlines 16byte memcpy as a capability
    load, which is wrong if the source or dest may be unaligned.
    
    stack guard only needs random for the address portion since only that
    part is compared, so 8 byte is enough with 64 bit addresses, but the
    current code is only right on little endian systems.
    
    TODO: drop when gcc is fixed

Diff:
---
 sysdeps/unix/sysv/linux/dl-osinfo.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index 7888915f12..49d8f973c8 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -34,7 +34,11 @@ _dl_setup_stack_chk_guard (void *dl_random)
   /* We need in the moment only 8 bytes on 32-bit platforms and 16
      bytes on 64-bit platforms.  Therefore we can use the data
      directly and not use the kernel-provided data to seed a PRNG.  */
+#ifdef __CHERI_PURE_CAPABILITY__
+  memcpy (ret.bytes, dl_random, 8);
+#else
   memcpy (ret.bytes, dl_random, sizeof (ret));
+#endif
 #if BYTE_ORDER == LITTLE_ENDIAN
   ret.num &= ~(uintptr_t) 0xff;
 #elif BYTE_ORDER == BIG_ENDIAN

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [glibc/arm/morello/main] TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guard
@ 2022-10-26 15:12 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2022-10-26 15:12 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f64bf6dfe6c3852bb80fae6b69ca2c867e874ab0

commit f64bf6dfe6c3852bb80fae6b69ca2c867e874ab0
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Fri Jul 15 19:33:23 2022 +0100

    TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guard
    
    morello purecap gcc in some cases inlines 16byte memcpy as a capability
    load, which is wrong if the source or dest may be unaligned.
    
    stack guard only needs random for the address portion since only that
    part is compared, so 8 byte is enough with 64 bit addresses, but the
    current code is only right on little endian systems.
    
    TODO: drop when gcc is fixed

Diff:
---
 sysdeps/unix/sysv/linux/dl-osinfo.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index 7888915f12..49d8f973c8 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -34,7 +34,11 @@ _dl_setup_stack_chk_guard (void *dl_random)
   /* We need in the moment only 8 bytes on 32-bit platforms and 16
      bytes on 64-bit platforms.  Therefore we can use the data
      directly and not use the kernel-provided data to seed a PRNG.  */
+#ifdef __CHERI_PURE_CAPABILITY__
+  memcpy (ret.bytes, dl_random, 8);
+#else
   memcpy (ret.bytes, dl_random, sizeof (ret));
+#endif
 #if BYTE_ORDER == LITTLE_ENDIAN
   ret.num &= ~(uintptr_t) 0xff;
 #elif BYTE_ORDER == BIG_ENDIAN

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-23 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 19:33 [glibc/arm/morello/main] TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guard Szabolcs Nagy
2022-10-26 15:12 Szabolcs Nagy
2022-10-27 13:51 Szabolcs Nagy
2022-11-23 14:41 Szabolcs Nagy

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).