This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] nptl: Add test for callee-saved register restore in pthread_exit


On 2017-12-31 20:24, Florian Weimer wrote:
> GCC PR 83641 results in a miscompilation of libpthread, which
> causes pthread_exit not to restore callee-saved registers before
> running destructors for objects on the stack.  This test detects
> this situation:
> 
> info: unsigned int, direct pthread_exit call
> tst-thread-exit-clobber.cc:80: numeric comparison failure
>    left: 4148288912 (0xf741dd90); from: value
>   right: 1600833940 (0x5f6ac994); from: magic_values.v2
> info: double, direct pthread_exit call
> info: unsigned int, indirect pthread_exit call
> info: double, indirect pthread_exit call
> error: 1 test failures
> 
> 2017-12-31  Florian Weimer  <fweimer@redhat.com>
> 
> 	* nptl/tst-thread-exit-clobber.cc: New file.
> 	* nptl/Makefile (CFLAGS-tst-thread-exit-clobber.o): Compile in
> 	C++11 mode.
> 	(LDLIBS-tst-thread-exit-clobber): Link with libstdc++.
> 	(tests): Add tst-thread-exit-clobber.
> 	[!CXX] (tests-unsupported): Add tst-thread-exit-clobber.
> 

Note that this test fails on mipsel-linux-gnu and mips-linux-gnu with:

| info: unsigned int, direct pthread_exit call
| info: double, direct pthread_exit call
| info: unsigned int, indirect pthread_exit call
| info: double, indirect pthread_exit call
| error: tst-thread-exit-clobber.cc:125: not true: value == magic_values_double.v4
| error: tst-thread-exit-clobber.cc:122: not true: value == magic_values_double.v3
| error: tst-thread-exit-clobber.cc:119: not true: value == magic_values_double.v2
| error: tst-thread-exit-clobber.cc:116: not true: value == magic_values_double.v1
| error: tst-thread-exit-clobber.cc:113: not true: value == magic_values_double.v0
| error: 5 test failures

The test looks correct as a first glance, and I confirm that the values
are corrupted by the ones passed in argument of call_pthread_exit_1.
Therefore it looks like a real issue affecting MIPS.

Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]