Add bounds check to __libc_ifunc_impl_list
commitfdaf78656fb6cc7caeb7b4e37068e8a8bf4dc639
authorWilco Dijkstra <wilco.dijkstra@arm.com>
Fri, 10 Jun 2022 16:13:29 +0000 (10 17:13 +0100)
committerWilco Dijkstra <wdijkstr@arm.com>
Fri, 10 Jun 2022 16:13:29 +0000 (10 17:13 +0100)
tree05302f7351e2b505af1d50d165bbbe371123d15d
parentf107b7b30d815f191181617e2c14f21e6af4ddcf
Add bounds check to __libc_ifunc_impl_list

Add a proper bounds check to __libc_ifunc_impl_list. This makes MAX_IFUNC
redundant and fixes several targets that will write outside the array.
To avoid unnecessary large diffs, pass the maximum in the argument 'i' to
IFUNC_IMPL_ADD - 'max' can be used in new ifunc definitions and existing
ones can be updated if desired.

Passes buildmanyglibc.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
include/ifunc-impl-list.h
sysdeps/aarch64/multiarch/ifunc-impl-list.c
sysdeps/arm/armv7/multiarch/ifunc-impl-list.c
sysdeps/i386/i686/multiarch/ifunc-impl-list.c
sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
sysdeps/s390/multiarch/ifunc-impl-list.c
sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c
sysdeps/x86_64/multiarch/ifunc-impl-list.c