[PATCH] Check return from htab_find_slot()
Jeff Law
law@redhat.com
Tue Nov 12 16:18:00 GMT 2013
On 11/12/13 08:34, Marcus Shawcroft wrote:
> This patch addresses another issue highlighted by the recent "isolate
> erroneous path" patch applied to gcc trunk.
>
> The failure mechanism is similar to:
> https://sourceware.org/ml/libc-alpha/2013-11/msg00291.html
>
> In this case htab_find_slot() may result in a call to calloc() and
> hence may return NULL. The code in _dl_make_tlsdesc_dynamic does not
> check the return value from htab_find_slot before dereferencing it.
> The "isolate erroneous path" code in trunk gcc spots the ill defined
> behaviour and inserts an abort(), this leads to a link error for at
> least ARM and AArch64 builds of glibc.
>
> This patch adds a check on the return value, I think the fix is
> obvious, if I'll commit tomorrow if I don't get any objections.
Note that if you define a trap instruction in the arm/aarch64 backends,
that will be used instead of a call to abort. Can you use the undefined
instruction to generate a suitable trap?
jeff
More information about the Libc-alpha
mailing list