elf: Account for glibc-hwcaps/ prefix in _dl_important_hwcaps
Commit Message
I tested this on aarch64-linux-gnu, i686-linux-gnu,
powerp64le-linux-gnu, s390x-linux-gnu, x86_64-linux-gnu. I cannot
reproduce the original crash, though. I'm quite confident that I have
found the actual problem though, and this change is not just papering
over the buffer size computation by computing a larger (but still wrong)
value.
---
elf/dl-hwcaps.c | 1 +
1 file changed, 1 insertion(+)
Comments
The 12/23/2020 12:57, Florian Weimer wrote:
> I tested this on aarch64-linux-gnu, i686-linux-gnu,
> powerp64le-linux-gnu, s390x-linux-gnu, x86_64-linux-gnu. I cannot
> reproduce the original crash, though. I'm quite confident that I have
> found the actual problem though, and this change is not just papering
> over the buffer size computation by computing a larger (but still wrong)
> value.
it fixes the crash i was seeing. thanks
it looks good to me.
>
> ---
> elf/dl-hwcaps.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/elf/dl-hwcaps.c b/elf/dl-hwcaps.c
> index 000e3c0eb9..6c394714d8 100644
> --- a/elf/dl-hwcaps.c
> +++ b/elf/dl-hwcaps.c
> @@ -192,6 +192,7 @@ _dl_important_hwcaps (const char *glibc_hwcaps_prepend,
>
> /* Each hwcaps subdirectory has a GLIBC_HWCAPS_PREFIX string prefix
> and a "/" suffix once stored in the result. */
> + hwcaps_counts.maximum_length += strlen (GLIBC_HWCAPS_PREFIX) + 1;
> size_t total = (hwcaps_counts.count * (strlen (GLIBC_HWCAPS_PREFIX) + 1)
> + hwcaps_counts.total_length);
>
>
> --
> Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
> Commercial register: Amtsgericht Muenchen, HRB 153243,
> Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
>
@@ -192,6 +192,7 @@ _dl_important_hwcaps (const char *glibc_hwcaps_prepend,
/* Each hwcaps subdirectory has a GLIBC_HWCAPS_PREFIX string prefix
and a "/" suffix once stored in the result. */
+ hwcaps_counts.maximum_length += strlen (GLIBC_HWCAPS_PREFIX) + 1;
size_t total = (hwcaps_counts.count * (strlen (GLIBC_HWCAPS_PREFIX) + 1)
+ hwcaps_counts.total_length);