[PATCH 4.1 081/102] xtensa: fix threadptr reload on return to userspace

Greg Kroah-Hartman
2015-09-19T18:22:33Z

From: Max Filippov <jcmvbkbc@gmail.com>

commit 4229fb12a03e5da5882b420b0aa4a02e77447b86 upstream.

Userspace return code may skip restoring THREADPTR register if there are
no registers that need to be zeroed. This leads to spurious failures in
libc NPTL tests.

Always restore THREADPTR on return to userspace.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
arch/xtensa/kernel/entry.S | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -568,12 +568,13 @@ user_exception_exit:
* (if we have restored WSBITS-1 frames).
*/

+2:
#if XCHAL_HAVE_THREADPTR
l32i a3, a1, PT_THREADPTR
wur a3, threadptr
#endif

-2: j common_exception_exit
+ j common_exception_exit

/* This is the kernel exception exit.
* We avoided to do a MOVSP when we entered the exception, but we