1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

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>
This commit is contained in:
Wilco Dijkstra
2022-06-10 17:13:29 +01:00
committed by Wilco Dijkstra
parent f107b7b30d
commit fdaf78656f
9 changed files with 20 additions and 50 deletions

View File

@@ -30,7 +30,7 @@ size_t
__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
size_t max)
{
size_t i = 0;
size_t i = max;
int hwcap;
hwcap = GLRO(dl_hwcap);
@@ -75,5 +75,5 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
__memmove_niagara7)
IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_ultra1));
return i;
return 0;
}