public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] x32: Verify that NPTL structures are correct [BZ #22298]
@ 2017-10-15 15:12 H.J. Lu
  2017-10-16 19:18 ` Adhemerval Zanella
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2017-10-15 15:12 UTC (permalink / raw)
  To: GNU C Library

Add a build-time check to verify that NPTL structures are correct.

OK for master and 2.25/2.26 branches after fix for [BZ #22298] is
applied?

H.J.
	[BZ #22298]
	* sysdeps/x86_64/x32/nptl/Makefile: New file.
	* sysdeps/x86_64/x32/nptl/nptl-check.sym: Likewise.
---
 sysdeps/x86_64/x32/nptl/Makefile       | 4 ++++
 sysdeps/x86_64/x32/nptl/nptl-check.sym | 9 +++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 sysdeps/x86_64/x32/nptl/Makefile
 create mode 100644 sysdeps/x86_64/x32/nptl/nptl-check.sym

diff --git a/sysdeps/x86_64/x32/nptl/Makefile b/sysdeps/x86_64/x32/nptl/Makefile
new file mode 100644
index 0000000000..e780beaf11
--- /dev/null
+++ b/sysdeps/x86_64/x32/nptl/Makefile
@@ -0,0 +1,4 @@
+ifeq ($(subdir),csu)
+# Verify that NPTL structures are correct.
+gen-as-const-headers += nptl-check.sym
+endif
diff --git a/sysdeps/x86_64/x32/nptl/nptl-check.sym b/sysdeps/x86_64/x32/nptl/nptl-check.sym
new file mode 100644
index 0000000000..c4b07b83bf
--- /dev/null
+++ b/sysdeps/x86_64/x32/nptl/nptl-check.sym
@@ -0,0 +1,9 @@
+#include <sysdep.h>
+#include <pthread.h>
+
+PREV			offsetof (struct __pthread_internal_list, __prev)
+NEXT			offsetof (struct __pthread_internal_list, __next)
+
+#if __PTHREAD_MUTEX_HAVE_PREV != 1
+# error __PTHREAD_MUTEX_HAVE_PREV must be 1
+#endif
-- 
2.13.5

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

* Re: [PATCH] x32: Verify that NPTL structures are correct [BZ #22298]
  2017-10-15 15:12 [PATCH] x32: Verify that NPTL structures are correct [BZ #22298] H.J. Lu
@ 2017-10-16 19:18 ` Adhemerval Zanella
  0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2017-10-16 19:18 UTC (permalink / raw)
  To: libc-alpha



On 15/10/2017 13:12, H.J. Lu wrote:
> Add a build-time check to verify that NPTL structures are correct.
> 
> OK for master and 2.25/2.26 branches after fix for [BZ #22298] is
> applied?
> 
> H.J.
> 	[BZ #22298]
> 	* sysdeps/x86_64/x32/nptl/Makefile: New file.
> 	* sysdeps/x86_64/x32/nptl/nptl-check.sym: Likewise.
> ---
>  sysdeps/x86_64/x32/nptl/Makefile       | 4 ++++
>  sysdeps/x86_64/x32/nptl/nptl-check.sym | 9 +++++++++
>  2 files changed, 13 insertions(+)
>  create mode 100644 sysdeps/x86_64/x32/nptl/Makefile
>  create mode 100644 sysdeps/x86_64/x32/nptl/nptl-check.sym
> 
> diff --git a/sysdeps/x86_64/x32/nptl/Makefile b/sysdeps/x86_64/x32/nptl/Makefile
> new file mode 100644
> index 0000000000..e780beaf11
> --- /dev/null
> +++ b/sysdeps/x86_64/x32/nptl/Makefile
> @@ -0,0 +1,4 @@
> +ifeq ($(subdir),csu)
> +# Verify that NPTL structures are correct.
> +gen-as-const-headers += nptl-check.sym
> +endif
> diff --git a/sysdeps/x86_64/x32/nptl/nptl-check.sym b/sysdeps/x86_64/x32/nptl/nptl-check.sym
> new file mode 100644
> index 0000000000..c4b07b83bf
> --- /dev/null
> +++ b/sysdeps/x86_64/x32/nptl/nptl-check.sym
> @@ -0,0 +1,9 @@
> +#include <sysdep.h>
> +#include <pthread.h>
> +
> +PREV			offsetof (struct __pthread_internal_list, __prev)
> +NEXT			offsetof (struct __pthread_internal_list, __next)
> +
> +#if __PTHREAD_MUTEX_HAVE_PREV != 1
> +# error __PTHREAD_MUTEX_HAVE_PREV must be 1
> +#endif

I am working on a similar test to check for the internal offset required
to static pthread mutex initializers and the idea is to check against hard
coded values (similar to the stack guard offset) and against all platforms.
I will send it along with the update BZ#22298 fix.

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

end of thread, other threads:[~2017-10-16 19:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-15 15:12 [PATCH] x32: Verify that NPTL structures are correct [BZ #22298] H.J. Lu
2017-10-16 19:18 ` Adhemerval Zanella

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