glibc/sysdeps/ieee754/ldbl-96
Joseph Myers 9333498794 Avoid ldbl-96 stack corruption from range reduction of pseudo-zero (bug 25487).
Bug 25487 reports stack corruption in ldbl-96 sinl on a pseudo-zero
argument (an representation where all the significand bits, including
the explicit high bit, are zero, but the exponent is not zero, which
is not a valid representation for the long double type).

Although this is not a valid long double representation, existing
practice in this area (see bug 4586, originally marked invalid but
subsequently fixed) is that we still seek to avoid invalid memory
accesses as a result, in case of programs that treat arbitrary binary
data as long double representations, although the invalid
representations of the ldbl-96 format do not need to be consistently
handled the same as any particular valid representation.

This patch makes the range reduction detect pseudo-zero and unnormal
representations that would otherwise go to __kernel_rem_pio2, and
returns a NaN for them instead of continuing with the range reduction
process.  (Pseudo-zero and unnormal representations whose unbiased
exponent is less than -1 have already been safely returned from the
function before this point without going through the rest of range
reduction.)  Pseudo-zero representations would previously result in
the value passed to __kernel_rem_pio2 being all-zero, which is
definitely unsafe; unnormal representations would previously result in
a value passed whose high bit is zero, which might well be unsafe
since that is not a form of input expected by __kernel_rem_pio2.

Tested for x86_64.
2020-02-12 23:31:56 +00:00
..
bits Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
include/bits Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
e_acoshl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_asinl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_atanhl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_coshl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_gammal_r.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_hypotl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_j0l.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_j1l.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_jnl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_lgammal_r.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
e_rem_pio2l.c Avoid ldbl-96 stack corruption from range reduction of pseudo-zero (bug 25487). 2020-02-12 23:31:56 +00:00
e_sinhl.c Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
gamma_product.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
gamma_productl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
k_cosl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
k_sinl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
k_tanl.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
ldbl2mpn.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
lgamma_negl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
lgamma_product.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
lgamma_productl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
Makefile Avoid ldbl-96 stack corruption from range reduction of pseudo-zero (bug 25487). 2020-02-12 23:31:56 +00:00
math_ldbl.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-nan-payload-ldouble.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
mpn2ldbl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
printf_fphex.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_asinhl.c Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
s_cbrtl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_copysignl.c Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
s_cosl.c Use libm_alias_ldouble for ldbl-96 functions. 2017-10-05 21:13:40 +00:00
s_daddl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_ddivl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_dmull.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_dsubl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_erfl.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
s_faddl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_fdivl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_fma.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_fmal.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_fmull.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_frexpl.c Use libm_alias_ldouble for ldbl-96 functions. 2017-10-05 21:13:40 +00:00
s_fromfpl_main.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_fromfpl.c Use libm_alias_ldouble for ldbl-96 functions. 2017-10-05 21:13:40 +00:00
s_fromfpxl.c Use libm_alias_ldouble for ldbl-96 functions. 2017-10-05 21:13:40 +00:00
s_fsubl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_getpayloadl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_iscanonicall.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_issignalingl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_llrintl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_llroundl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_lrintl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_lroundl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_modfl.c Use libm_alias_ldouble for ldbl-96 functions. 2017-10-05 21:13:40 +00:00
s_nexttoward.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
s_nexttowardf.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
s_nextupl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_remquol.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_roundevenl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_roundl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_scalblnl.c Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
s_setpayloadl_main.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_setpayloadl.c Use libm_alias_ldouble for ldbl-96 functions. 2017-10-05 21:13:40 +00:00
s_setpayloadsigl.c Use libm_alias_ldouble for ldbl-96 functions. 2017-10-05 21:13:40 +00:00
s_signbitl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_sincosl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_sinl.c Use libm_alias_ldouble for ldbl-96 functions. 2017-10-05 21:13:40 +00:00
s_tanhl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
s_tanl.c Use libm_alias_ldouble for ldbl-96 functions. 2017-10-05 21:13:40 +00:00
s_totalorderl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_totalordermagl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
s_ufromfpl.c Use libm_alias_ldouble for ldbl-96 functions. 2017-10-05 21:13:40 +00:00
s_ufromfpxl.c Use libm_alias_ldouble for ldbl-96 functions. 2017-10-05 21:13:40 +00:00
strtold_l.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
t_sincosl.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
test-canonical-ldbl-96.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
test-sinl-pseudo.c Avoid ldbl-96 stack corruption from range reduction of pseudo-zero (bug 25487). 2020-02-12 23:31:56 +00:00
test-totalorderl-ldbl-96.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
x2y2m1.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
x2y2m1l.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00