Hi Ben, maks,

please find attached the debdiff fixing this release-critical bug.
I’ve uploaded to DELAYED/0 per devref.

Please integrate this into the next maintainer upload.

I’ve only added the patch for the wrong registers being saved,
not the one fixing sig{set,long}jmp because, apparently, klibc
documents its standard violation for these two functions, so
that’s best dealt with upstream. I’ll upload mksh using the
regular {set,long}jmp functions instead where signals are to
not be saved once klibc is built on all architectures.

bye,
//mirabilos
-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
        -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2
diff -Nru klibc-2.0.8/debian/changelog klibc-2.0.8/debian/changelog
--- klibc-2.0.8/debian/changelog        2021-04-30 03:05:23.000000000 +0200
+++ klibc-2.0.8/debian/changelog        2021-05-27 00:12:10.000000000 +0200
@@ -1,3 +1,11 @@
+klibc (2.0.8-6.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * {set,long}jmp [s390x]: save/restore the correct FPU registers
+    (f8‥f15 not f1/f3/f5/f7) (Closes: #943425)
+
+ -- Thorsten Glaser <t...@mirbsd.de>  Thu, 27 May 2021 00:12:10 +0200
+
 klibc (2.0.8-6) unstable; urgency=medium
 
   * Upload to unstable
diff -Nru 
klibc-2.0.8/debian/patches/0041-klibc-set-long-jmp-s390x-save-restore-the-correct-re.patch
 
klibc-2.0.8/debian/patches/0041-klibc-set-long-jmp-s390x-save-restore-the-correct-re.patch
--- 
klibc-2.0.8/debian/patches/0041-klibc-set-long-jmp-s390x-save-restore-the-correct-re.patch
  1970-01-01 01:00:00.000000000 +0100
+++ 
klibc-2.0.8/debian/patches/0041-klibc-set-long-jmp-s390x-save-restore-the-correct-re.patch
  2021-05-27 00:11:57.000000000 +0200
@@ -0,0 +1,57 @@
+Description: {set,long}jmp [s390x]: save/restore the correct registers
+ The s390x ABI actually has FPU registers f8‥f15, not f1/f3/f5/f7,
+ to be saved. (Closes: Debian #943425)
+Author: mirabilos <t...@debian.org>
+Forwarded: https://lists.zytor.com/archives/klibc/2021-May/004620.html
+
+--- a/usr/include/arch/s390/klibc/archsetjmp.h
++++ b/usr/include/arch/s390/klibc/archsetjmp.h
+@@ -16,7 +16,7 @@ struct __jmp_buf {
+ 
+ struct __jmp_buf {
+       uint64_t __gregs[10]; /* general registers r6-r15 */
+-      uint64_t __fpregs[4]; /* fp registers f1, f3, f5, f7 */
++      uint64_t __fpregs[8]; /* fp registers f8-f15 */
+ };
+ 
+ #endif /* __s390x__ */
+--- a/usr/klibc/arch/s390/setjmp.S
++++ b/usr/klibc/arch/s390/setjmp.S
+@@ -38,10 +38,14 @@ longjmp:
+ 
+ setjmp:
+       stmg    %r6,%r15,0(%r2)         # save all general registers
+-      std     %f1,80(%r2)             # save fp registers f4 and f6
+-      std     %f3,88(%r2)
+-      std     %f5,96(%r2)
+-      std     %f7,104(%r2)
++      std     %f8,80(%r2)             # save fp registers f8 to f15
++      std     %f9,88(%r2)
++      std     %f10,96(%r2)
++      std     %f11,104(%r2)
++      std     %f12,112(%r2)
++      std     %f13,120(%r2)
++      std     %f14,128(%r2)
++      std     %f15,136(%r2)
+       lghi    %r2,0                   # return 0
+       br      %r14
+ 
+@@ -54,10 +58,14 @@ setjmp:
+ longjmp:
+       lgr     %r1,%r2                 # jmp_buf
+       lgr     %r2,%r3                 # return value
+-      ld      %f7,104(%r1)            # restore all saved registers
+-      ld      %f5,96(%r1)
+-      ld      %f3,88(%r1)
+-      ld      %f1,80(%r1)
++      ld      %f15,136(%r1)           # restore all saved registers
++      ld      %f14,128(%r1)
++      ld      %f13,120(%r1)
++      ld      %f12,112(%r1)
++      ld      %f11,104(%r1)
++      ld      %f10,96(%r1)
++      ld      %f9,88(%r1)
++      ld      %f8,80(%r1)
+       lmg     %r6,%r15,0(%r1)
+       br      %r14                    # return to restored address
+ 
diff -Nru klibc-2.0.8/debian/patches/series klibc-2.0.8/debian/patches/series
--- klibc-2.0.8/debian/patches/series   2021-04-30 02:38:31.000000000 +0200
+++ klibc-2.0.8/debian/patches/series   2021-05-27 00:09:21.000000000 +0200
@@ -10,3 +10,4 @@
 0037-klibc-calloc-Fail-if-multiplication-overflows.patch
 0039-klibc-cpio-Fix-possible-integer-overflow-on-32-bit-s.patch
 0040-klibc-cpio-Fix-possible-crash-on-64-bit-systems.patch
+0041-klibc-set-long-jmp-s390x-save-restore-the-correct-re.patch

Reply via email to