mbox series

[0/8] Fix UB in math implementations

Message ID 20250425205618.360232-1-adhemerval.zanella@linaro.org
Headers show
Series Fix UB in math implementations | expand

Message

Adhemerval Zanella April 25, 2025, 8:54 p.m. UTC
From a recent experiment to build glibc with -fsanitize=undefined [1],
I found that some float implementation triggers UB. The issues from
this patchset were already fixed in the upstream projects.

[1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/ubsan-undef

Adhemerval Zanella (8):
  math: Fix UB on atanhf
  math: Fix UB on coshf
  math: Fix UB on logf
  math: Fix UB on sinhf
  math: Fix UB on cbrtf
  math: Fix UB on cospif
  math: Fix UB on erfcf
  math: Fix UB on sinpif

 sysdeps/ieee754/flt-32/e_atanhf.c | 4 ++--
 sysdeps/ieee754/flt-32/e_coshf.c  | 6 +++---
 sysdeps/ieee754/flt-32/e_logf.c   | 2 +-
 sysdeps/ieee754/flt-32/e_sinhf.c  | 6 +++---
 sysdeps/ieee754/flt-32/s_cbrtf.c  | 6 +++---
 sysdeps/ieee754/flt-32/s_cospif.c | 6 +++---
 sysdeps/ieee754/flt-32/s_erfcf.c  | 4 ++--
 sysdeps/ieee754/flt-32/s_sinpif.c | 8 ++++----
 8 files changed, 21 insertions(+), 21 deletions(-)

Comments

Carlos O'Donell April 29, 2025, 12:50 p.m. UTC | #1
On 4/25/25 4:54 PM, Adhemerval Zanella wrote:
>  From a recent experiment to build glibc with -fsanitize=undefined [1],
> I found that some float implementation triggers UB. The issues from
> this patchset were already fixed in the upstream projects.

Looks good! Thanks for fixing the UB issues.

I went through them all just to have a look at the state of the implementation
versus CORE-MATH and the fixes that Paul was making upstream.

Thanks for doing this kind of technical debt reduction, eventually it bites
us, as would lagging too much behind CORE-MATH.

> [1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/ubsan-undef
> 
> Adhemerval Zanella (8):
>    math: Fix UB on atanhf
>    math: Fix UB on coshf
>    math: Fix UB on logf
>    math: Fix UB on sinhf
>    math: Fix UB on cbrtf
>    math: Fix UB on cospif
>    math: Fix UB on erfcf
>    math: Fix UB on sinpif
> 
>   sysdeps/ieee754/flt-32/e_atanhf.c | 4 ++--
>   sysdeps/ieee754/flt-32/e_coshf.c  | 6 +++---
>   sysdeps/ieee754/flt-32/e_logf.c   | 2 +-
>   sysdeps/ieee754/flt-32/e_sinhf.c  | 6 +++---
>   sysdeps/ieee754/flt-32/s_cbrtf.c  | 6 +++---
>   sysdeps/ieee754/flt-32/s_cospif.c | 6 +++---
>   sysdeps/ieee754/flt-32/s_erfcf.c  | 4 ++--
>   sysdeps/ieee754/flt-32/s_sinpif.c | 8 ++++----
>   8 files changed, 21 insertions(+), 21 deletions(-)
>