containerize nptl/tst-pthread-getaddr

Message ID xnwo9bnvk8.fsf@greed.delorie.com
State Committed
Commit 279c68ce1336d84d82ce491a4b77086e574ba380
Headers

Commit Message

DJ Delorie Jan. 28, 2020, 9:02 p.m. UTC
  As found and discussed in a Fedora bug...
https://bugzilla.redhat.com/show_bug.cgi?id=1653942

This test depends on the kernel's assignment of memory regions, but
running under ld.so explicitly changes those assignments, sometimes
sufficiently to cause the test to fail (esp with address space
randomization).

The easiest way to "fix" the test, is to run it the way the user would
- without ld.so.  Running it in a container does that.

There are other ways to make this test not fail (see bz) but I'm not
sure if any of those ways retain the vailidity of the test.
  

Comments

Carlos O'Donell Jan. 29, 2020, 5:40 p.m. UTC | #1
On 1/28/20 4:02 PM, DJ Delorie wrote:
> 
> As found and discussed in a Fedora bug...
> https://bugzilla.redhat.com/show_bug.cgi?id=1653942
> 
> This test depends on the kernel's assignment of memory regions, but
> running under ld.so explicitly changes those assignments, sometimes
> sufficiently to cause the test to fail (esp with address space
> randomization).
> 
> The easiest way to "fix" the test, is to run it the way the user would
> - without ld.so.  Running it in a container does that.
> 
> There are other ways to make this test not fail (see bz) but I'm not
> sure if any of those ways retain the vailidity of the test.

I like this idea way better.

OK for when master reopens.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> diff --git a/nptl/Makefile b/nptl/Makefile
> index 584e0ffd96..ae530a5bae 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -296,7 +296,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
>  	tst-exec1 tst-exec2 tst-exec3 tst-exec4 tst-exec5 \
>  	tst-exit1 tst-exit2 tst-exit3 \
>  	tst-stdio1 tst-stdio2 \
> -	tst-stack1 tst-stack2 tst-stack3 tst-stack4 tst-pthread-getattr \
> +	tst-stack1 tst-stack2 tst-stack3 tst-stack4 \

OK. Remove test.

>  	tst-pthread-attr-affinity tst-pthread-mutexattr \
>  	tst-unload \
>  	tst-dlsym1 \
> @@ -326,6 +326,8 @@ tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
>  	tst-rwlock-tryrdlock-stall tst-rwlock-trywrlock-stall \
>  	tst-unwind-thread
>  
> +tests-container =  tst-pthread-getattr
> +

OK. Add tests-container test.

>  tests-internal := tst-rwlock19 tst-rwlock20 \
>  		  tst-sem11 tst-sem12 tst-sem13 \
>  		  tst-barrier5 tst-signal7 tst-mutex8 tst-mutex8-static \
> @@ -642,7 +644,7 @@ ifeq ($(build-shared),yes)
>  $(addprefix $(objpfx), \
>    $(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \
>      $(tests-nolibpthread), \
> -    $(tests) $(tests-internal) $(xtests) $(test-srcs))): \
> +    $(tests) $(tests-internal) $(xtests) $(test-srcs) $(tests-container))): \

OK. Ajdust the nptl/Makefile deps to make sure libpthread.so is built and linked.

>  	$(objpfx)libpthread.so
>  $(objpfx)tst-unload: $(libdl)
>  # $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
>
  

Patch

diff --git a/nptl/Makefile b/nptl/Makefile
index 584e0ffd96..ae530a5bae 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -296,7 +296,7 @@  tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
 	tst-exec1 tst-exec2 tst-exec3 tst-exec4 tst-exec5 \
 	tst-exit1 tst-exit2 tst-exit3 \
 	tst-stdio1 tst-stdio2 \
-	tst-stack1 tst-stack2 tst-stack3 tst-stack4 tst-pthread-getattr \
+	tst-stack1 tst-stack2 tst-stack3 tst-stack4 \
 	tst-pthread-attr-affinity tst-pthread-mutexattr \
 	tst-unload \
 	tst-dlsym1 \
@@ -326,6 +326,8 @@  tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
 	tst-rwlock-tryrdlock-stall tst-rwlock-trywrlock-stall \
 	tst-unwind-thread
 
+tests-container =  tst-pthread-getattr
+
 tests-internal := tst-rwlock19 tst-rwlock20 \
 		  tst-sem11 tst-sem12 tst-sem13 \
 		  tst-barrier5 tst-signal7 tst-mutex8 tst-mutex8-static \
@@ -642,7 +644,7 @@  ifeq ($(build-shared),yes)
 $(addprefix $(objpfx), \
   $(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \
     $(tests-nolibpthread), \
-    $(tests) $(tests-internal) $(xtests) $(test-srcs))): \
+    $(tests) $(tests-internal) $(xtests) $(test-srcs) $(tests-container))): \
 	$(objpfx)libpthread.so
 $(objpfx)tst-unload: $(libdl)
 # $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,