mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
mcheck Fix malloc_usable_size [BZ #22057]
Interpose malloc_usable_size to return the correct mcheck value for malloc_usable_size. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
@@ -83,7 +83,7 @@ ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes)
|
|||||||
# the tests expect specific internal behavior that is changed due to linking to
|
# the tests expect specific internal behavior that is changed due to linking to
|
||||||
# libmcheck.a.
|
# libmcheck.a.
|
||||||
tests-exclude-mcheck = tst-mallocstate \
|
tests-exclude-mcheck = tst-mallocstate \
|
||||||
tst-safe-linking tst-malloc-usable \
|
tst-safe-linking \
|
||||||
tst-malloc-backtrace \
|
tst-malloc-backtrace \
|
||||||
tst-malloc-fork-deadlock \
|
tst-malloc-fork-deadlock \
|
||||||
tst-malloc-stats-cancellation \
|
tst-malloc-stats-cancellation \
|
||||||
@@ -92,8 +92,6 @@ tests-exclude-mcheck = tst-mallocstate \
|
|||||||
tst-malloc-thread-fail \
|
tst-malloc-thread-fail \
|
||||||
tst-malloc-usable-tunables \
|
tst-malloc-usable-tunables \
|
||||||
tst-malloc_info \
|
tst-malloc_info \
|
||||||
tst-pvalloc-fortify \
|
|
||||||
tst-reallocarray \
|
|
||||||
tst-compathooks-off tst-compathooks-on
|
tst-compathooks-off tst-compathooks-on
|
||||||
|
|
||||||
tests-mcheck = $(filter-out $(tests-exclude-mcheck), $(tests))
|
tests-mcheck = $(filter-out $(tests-exclude-mcheck), $(tests))
|
||||||
|
@@ -399,6 +399,8 @@ strong_alias (__debug_calloc, calloc)
|
|||||||
size_t
|
size_t
|
||||||
malloc_usable_size (void *mem)
|
malloc_usable_size (void *mem)
|
||||||
{
|
{
|
||||||
|
if (__is_malloc_debug_enabled (MALLOC_MCHECK_HOOK))
|
||||||
|
return mcheck_usable_size (mem);
|
||||||
if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
|
if (__is_malloc_debug_enabled (MALLOC_CHECK_HOOK))
|
||||||
return malloc_check_get_size (mem);
|
return malloc_check_get_size (mem);
|
||||||
|
|
||||||
|
@@ -404,3 +404,9 @@ __mcheck_initialize (void (*func) (enum mcheck_status), bool in_pedantic)
|
|||||||
pedantic = in_pedantic;
|
pedantic = in_pedantic;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
mcheck_usable_size (struct hdr *h)
|
||||||
|
{
|
||||||
|
return (h - 1)->size;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user