This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Add __private_ss to s390 struct tcbhead.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Marcin KoÅcielnicki <koriakin at 0x04 dot net>, libc-alpha at sourceware dot org, Stefan Liebler <stli at linux dot vnet dot ibm dot com>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Date: Tue, 12 Jan 2016 21:41:23 -0500
- Subject: Re: [PATCH] Add __private_ss to s390 struct tcbhead.
- Authentication-results: sourceware.org; auth=none
- References: <1451752466-9429-1-git-send-email-koriakin at 0x04 dot net>
On 01/02/2016 11:34 AM, Marcin KoÅcielnicki wrote:
> Preparation for gcc -fsplit-stack support (gcc bug #68191). The new
> field is basically identical to the one on x86. Its TCB offset needs
> to be constant, as it'll be hardcoded in gcc.
>
> * sysdeps/s390/nptl/tls.h: Add __private_ss to struct tcbhead.
What happens if you run newly compiled code with split-stack support on
a glibc that doesn't include this space allocated in tcbhead_t? You get
a write beyond the tcbhead_t into some other data? Depending on the thread
memory layout that could be a guard page or static TLS data?
This is the same problem we saw in POWER when adding a field in tcbhead_t
for fast-architecture access.
The only way to do this compatibly is to add a versioned symbol that
the compiler references to in order to prevent new binaries from
running on old glibc and crashing or worse silently corrupting data.
To reiterate: How do you plan to handle compatibility for this new feature?
If you did an analysis of nptl/allocatestack.c and showed that there were
still alignment bytes left, that might be one way to work around this without
needing a versioned reference.
Cheers,
Carlos.
> ---
> ChangeLog | 4 ++++
> sysdeps/s390/nptl/tls.h | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/ChangeLog b/ChangeLog
> index 8c339d2..e39e2ce 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,7 @@
> +2015-01-02 Marcin KoÅcielnicki <koriakin@0x04.net>
> +
> + * sysdeps/s390/nptl/tls.h: Add __private_ss to struct tcbhead.
> +
> 2016-01-01 Mike Frysinger <vapier@gentoo.org>
>
> [BZ #15421]
> diff --git a/sysdeps/s390/nptl/tls.h b/sysdeps/s390/nptl/tls.h
> index 28a2119..0e61154 100644
> --- a/sysdeps/s390/nptl/tls.h
> +++ b/sysdeps/s390/nptl/tls.h
> @@ -53,7 +53,11 @@ typedef struct
> int gscope_flag;
> #ifndef __ASSUME_PRIVATE_FUTEX
> int private_futex;
> +#else
> + int __glibc_reserved1;
> #endif
> + /* GCC split stack support. */
> + void *__private_ss;
> } tcbhead_t;
>
> # ifndef __s390x__
>