Register window saving loop in __sigsetjmp incorrectly calculates offset in the jmp_buf in case it was called with call12. The bug was introduced in commit f4b1b7ade7971141 "xtensa: fix setjmp that didn't save all registers correctly".
Signed-off-by: Max Filippov jcmvbkbc@gmail.com --- libc/sysdeps/linux/xtensa/setjmp.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/sysdeps/linux/xtensa/setjmp.S b/libc/sysdeps/linux/xtensa/setjmp.S index 862bf67..b8152fd 100644 --- a/libc/sysdeps/linux/xtensa/setjmp.S +++ b/libc/sysdeps/linux/xtensa/setjmp.S @@ -122,7 +122,7 @@ ENTRY (__sigsetjmp) l32i a4, a6, 12 s32i a7, a5, 8 s32i a4, a5, 12 - addi a5, a6, 16 + addi a5, a5, 16 addi a6, a6, 16 blt a6, a8, .Lsjloop .Lendsj:
Hi Max, Max Filippov wrote,
Register window saving loop in __sigsetjmp incorrectly calculates offset in the jmp_buf in case it was called with call12. The bug was introduced in commit f4b1b7ade7971141 "xtensa: fix setjmp that didn't save all registers correctly".
Thanks, applied and pushed. How did you found it? No included testcase catched it, right?
best regards Waldemar
Hi Waldemar,
On Thu, Mar 31, 2016 at 8:44 PM, Waldemar Brodkorb wbx@uclibc-ng.org wrote:
Register window saving loop in __sigsetjmp incorrectly calculates offset in the jmp_buf in case it was called with call12. The bug was introduced in commit f4b1b7ade7971141 "xtensa: fix setjmp that didn't save all registers correctly".
Thanks, applied and pushed. How did you found it? No included testcase catched it, right?
Right. I was doing musl port https://github.com/jcmvbkbc/musl-xtensa/commits/xtensa-1.1.14 and looked very closely at the code I used as a reference. I'm pretty sure that nobody ever called or will ever call __sigsetjmp with call12 though.