From cc5775c62f1f50c485181c16dc5e51677a7ba10e Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 6 Aug 2019 02:50:13 +0000 Subject: system/musl: [CVE] x87 FPU state fix https://www.openwall.com/lists/oss-security/2019/08/06/1 --- system/musl/APKBUILD | 4 +- system/musl/x87-math.patch | 157 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 system/musl/x87-math.patch (limited to 'system') diff --git a/system/musl/APKBUILD b/system/musl/APKBUILD index 336d81458..3c11dd197 100644 --- a/system/musl/APKBUILD +++ b/system/musl/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: A. Wilcox pkgname=musl pkgver=1.1.23 -pkgrel=1 +pkgrel=2 pkgdesc="System library (libc) implementation" url="https://www.musl-libc.org/" arch="all" @@ -28,6 +28,7 @@ source="https://www.musl-libc.org/releases/musl-$pkgver.tar.gz fgetspent_r.patch powerpc-wchar_t.patch strftime-add-l-support.patch + x87-math.patch ldconfig getent.c @@ -123,6 +124,7 @@ ef532aebeaa89b3274f7f75f1adaa4d1eea60f4e2822a6711c748768cc3a65a77ebd218d7a8ab411 ded41235148930f8cf781538f7d63ecb0c65ea4e8ce792565f3649ee2523592a76b2a166785f0b145fc79f5852fd1fb1729a7a09110b3b8f85cba3912e790807 fgetspent_r.patch fda015fad0d0a65efb192c08d201b2f5b2bfff18c43b551855b119a1d63213bd417a93a6b2965e68243884c5b17b34a585795cc4cace603788d37149e933cfb1 powerpc-wchar_t.patch 7ed6c620a5ea5585c323936b1ff01eb7f01a1192240706a0d0470b661a7a03ea10ed17507c59678aaedce51b7a5ea839c2f528f19f12de02119bf4e47f7c3998 strftime-add-l-support.patch +e3c98f64e901ac08a4a7dfbb7c46fb6ecc1cc7e825a8f4834b5a9dd1cafaa2e8ee1ccf6c55c7f07cc4ede9c54cd039e61dec41df6b973fac1ad42e7d3faa1932 x87-math.patch cb71d29a87f334c75ecbc911becde7be825ab30d8f39fa6d64cb53812a7c9abaf91d9804c72540e5be3ddd3c84cfe7fd9632274309005cb8bcdf9a9b09b4b923 ldconfig 378d70e65bcc65bb4e1415354cecfa54b0c1146dfb24474b69e418cdbf7ad730472cd09f6f103e1c99ba6c324c9560bccdf287f5889bbc3ef0bdf0e08da47413 getent.c 9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf iconv.c" diff --git a/system/musl/x87-math.patch b/system/musl/x87-math.patch new file mode 100644 index 000000000..d21be43b3 --- /dev/null +++ b/system/musl/x87-math.patch @@ -0,0 +1,157 @@ +diff --git a/src/math/i386/asin.s b/src/math/i386/asin.s +index a9f691bf..920d967a 100644 +--- a/src/math/i386/asin.s ++++ b/src/math/i386/asin.s +@@ -7,13 +7,10 @@ asinf: + cmp $0x01000000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 2f + fld %st(0) + fmul %st(1) + fstps 4(%esp) +-2: ret ++ ret + + .global asinl + .type asinl,@function +@@ -30,11 +27,8 @@ asin: + cmp $0x00200000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 2f + fsts 4(%esp) +-2: ret ++ ret + 1: fld %st(0) + fld1 + fsub %st(0),%st(1) +diff --git a/src/math/i386/atan.s b/src/math/i386/atan.s +index d73137b2..a26feae1 100644 +--- a/src/math/i386/atan.s ++++ b/src/math/i386/atan.s +@@ -10,8 +10,5 @@ atan: + fpatan + ret + # subnormal x, return x with underflow +-1: fnstsw %ax +- and $16,%ax +- jnz 2f +- fsts 4(%esp) +-2: ret ++1: fsts 4(%esp) ++ ret +diff --git a/src/math/i386/atan2.s b/src/math/i386/atan2.s +index a7d2979b..76b95f31 100644 +--- a/src/math/i386/atan2.s ++++ b/src/math/i386/atan2.s +@@ -10,8 +10,5 @@ atan2: + cmp $0x00200000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 1f + fsts 4(%esp) + 1: ret +diff --git a/src/math/i386/atan2f.s b/src/math/i386/atan2f.s +index 14b88ce5..c9408a90 100644 +--- a/src/math/i386/atan2f.s ++++ b/src/math/i386/atan2f.s +@@ -10,9 +10,6 @@ atan2f: + cmp $0x01000000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 1f + fld %st(0) + fmul %st(1) + fstps 4(%esp) +diff --git a/src/math/i386/atanf.s b/src/math/i386/atanf.s +index 8caddefa..893beac5 100644 +--- a/src/math/i386/atanf.s ++++ b/src/math/i386/atanf.s +@@ -10,10 +10,7 @@ atanf: + fpatan + ret + # subnormal x, return x with underflow +-1: fnstsw %ax +- and $16,%ax +- jnz 2f +- fld %st(0) ++1: fld %st(0) + fmul %st(1) + fstps 4(%esp) +-2: ret ++ ret +diff --git a/src/math/i386/exp.s b/src/math/i386/exp.s +index c7aa5b6e..df87c497 100644 +--- a/src/math/i386/exp.s ++++ b/src/math/i386/exp.s +@@ -7,13 +7,10 @@ expm1f: + cmp $0x01000000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 2f + fld %st(0) + fmul %st(1) + fstps 4(%esp) +-2: ret ++ ret + + .global expm1l + .type expm1l,@function +@@ -30,11 +27,8 @@ expm1: + cmp $0x00200000,%eax + jae 1f + # subnormal x, return x with underflow +- fnstsw %ax +- and $16,%ax +- jnz 2f + fsts 4(%esp) +-2: ret ++ ret + 1: fldl2e + fmulp + mov $0xc2820000,%eax +diff --git a/src/math/i386/log1p.s b/src/math/i386/log1p.s +index 6b6929c7..354f391a 100644 +--- a/src/math/i386/log1p.s ++++ b/src/math/i386/log1p.s +@@ -16,9 +16,6 @@ log1p: + fyl2x + ret + # subnormal x, return x with underflow +-2: fnstsw %ax +- and $16,%ax +- jnz 1f +- fsts 4(%esp) ++2: fsts 4(%esp) + fstp %st(1) +-1: ret ++ ret +diff --git a/src/math/i386/log1pf.s b/src/math/i386/log1pf.s +index c0bcd30f..4d3484cd 100644 +--- a/src/math/i386/log1pf.s ++++ b/src/math/i386/log1pf.s +@@ -16,10 +16,7 @@ log1pf: + fyl2x + ret + # subnormal x, return x with underflow +-2: fnstsw %ax +- and $16,%ax +- jnz 1f +- fxch ++2: fxch + fmul %st(1) + fstps 4(%esp) +-1: ret ++ ret + -- cgit v1.2.3-60-g2f50