This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Tests that use clone directly race against SSE register save/restore.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, Arjun Shankar <arjun at redhat dot com>, Roland McGrath <roland at hack dot frob dot com>
- Date: Tue, 21 Jul 2015 09:47:00 -0400
- Subject: Re: Tests that use clone directly race against SSE register save/restore.
- Authentication-results: sourceware.org; auth=none
- References: <55AD37CA dot 9040508 at redhat dot com> <CAMe9rOpbz32ZzezKxHFtm5J=JRRk6aQTiirWKpmcv5T3p4Rnvw at mail dot gmail dot com> <55AD4E86 dot 8060705 at redhat dot com>
On 07/20/2015 03:39 PM, Carlos O'Donell wrote:
> On 07/20/2015 02:27 PM, H.J. Lu wrote:
>>> And reproducible, but only in this CLONE_VM case.
>>
>> See:
>>
>> https://sourceware.org/bugzilla/show_bug.cgi?id=11214
>>
>
> Excellent. Glad to see we've fixed it for one test case.
> Do you recommend we do the same thing for all test cases
> that use CLONE_VM like this?
Given that tst-getpid1 can accept arbitrary TEST_CLONE_FLAGS
is there any reason not to just build the two of them with
-Wl,-z,now? This makes them safer no matter what kind of
experimenting your're doing with clone flags.
Any objection?
Cheers,
Carlos.
2015-07-21 Carlos O'Donell <carlos@redhat.com>
* sysdeps/unix/sysv/linux/Makefile: Define tst-getpid1-ENV.
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index bfbabd4..27515d2 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -197,5 +197,8 @@ tests += tst-setgetname tst-align-clone tst-getpid1 tst-getpid2
# In this test, we create a CLONE_VM "thread" that shares TLS storage
# with the original thread. Both threads then race in ld.so with lazy PLT
# resolution. Avoid this race by disabling lazy binding. BZ #11214.
-tst-getpid2-ENV = LD_BIND_NOW=1
+LDFLAGS-tst-getpid2 += -Wl,-z,now
+# Similarly we may be run with arbitrary TEST_CLONE_FLAGS set by the machine
+# and thus we should protect against CLONE_VM being set by avoiding lazy PLT.
+LDFLAGS-tst-getpid1 += -Wl,-z,now
endif
---