mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-14 16:05:48 +03:00
Remove safety check abort mallctl
This commit is contained in:
parent
820065072b
commit
cc7be7fbe2
12 changed files with 33 additions and 64 deletions
23
src/ctl.c
23
src/ctl.c
|
|
@ -372,7 +372,6 @@ CTL_PROTO(experimental_hooks_prof_dump)
|
|||
CTL_PROTO(experimental_hooks_prof_sample)
|
||||
CTL_PROTO(experimental_hooks_prof_sample_free)
|
||||
CTL_PROTO(experimental_hooks_thread_event)
|
||||
CTL_PROTO(experimental_hooks_safety_check_abort)
|
||||
CTL_PROTO(experimental_utilization_query)
|
||||
CTL_PROTO(experimental_utilization_batch_query)
|
||||
CTL_PROTO(experimental_arenas_i_pactivep)
|
||||
|
|
@ -910,7 +909,6 @@ static const ctl_named_node_t experimental_hooks_node[] = {
|
|||
{NAME("prof_dump"), CTL(experimental_hooks_prof_dump)},
|
||||
{NAME("prof_sample"), CTL(experimental_hooks_prof_sample)},
|
||||
{NAME("prof_sample_free"), CTL(experimental_hooks_prof_sample_free)},
|
||||
{NAME("safety_check_abort"), CTL(experimental_hooks_safety_check_abort)},
|
||||
{NAME("thread_event"), CTL(experimental_hooks_thread_event)},
|
||||
};
|
||||
|
||||
|
|
@ -3729,27 +3727,6 @@ label_return:
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* For integration test purpose only. No plan to move out of experimental. */
|
||||
static int
|
||||
experimental_hooks_safety_check_abort_ctl(tsd_t *tsd, const size_t *mib,
|
||||
size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) {
|
||||
int ret;
|
||||
|
||||
WRITEONLY();
|
||||
if (newp != NULL) {
|
||||
if (newlen != sizeof(safety_check_abort_hook_t)) {
|
||||
ret = EINVAL;
|
||||
goto label_return;
|
||||
}
|
||||
safety_check_abort_hook_t hook JEMALLOC_CC_SILENCE_INIT(NULL);
|
||||
WRITE(hook, safety_check_abort_hook_t);
|
||||
safety_check_set_abort(hook);
|
||||
}
|
||||
ret = 0;
|
||||
label_return:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
CTL_RO_CGEN(config_stats, stats_allocated, ctl_stats->allocated, size_t)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#include "jemalloc/internal/jemalloc_preamble.h"
|
||||
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
||||
|
||||
static safety_check_abort_hook_t safety_check_abort;
|
||||
|
||||
void
|
||||
safety_check_fail_sized_dealloc(bool current_dealloc, const void *ptr,
|
||||
size_t true_size, size_t input_size) {
|
||||
|
|
@ -19,23 +17,18 @@ safety_check_fail_sized_dealloc(bool current_dealloc, const void *ptr,
|
|||
true_size, input_size, ptr, src, suggest_debug_build);
|
||||
}
|
||||
|
||||
void
|
||||
safety_check_set_abort(safety_check_abort_hook_t abort_fn) {
|
||||
safety_check_abort = abort_fn;
|
||||
}
|
||||
|
||||
/*
|
||||
* In addition to malloc_write, also embed hint msg in the abort function name
|
||||
* because there are cases only logging crash stack traces.
|
||||
*/
|
||||
static void
|
||||
safety_check_detected_heap_corruption___run_address_sanitizer_build_to_debug(
|
||||
const char *buf) {
|
||||
if (safety_check_abort == NULL) {
|
||||
const char *buf) {
|
||||
if (test_hooks_safety_check_abort == NULL) {
|
||||
malloc_write(buf);
|
||||
abort();
|
||||
} else {
|
||||
safety_check_abort(buf);
|
||||
test_hooks_safety_check_abort(buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,3 +10,6 @@ void (*test_hooks_arena_new_hook)(void) = NULL;
|
|||
|
||||
JEMALLOC_EXPORT
|
||||
void (*test_hooks_libc_hook)(void) = NULL;
|
||||
|
||||
JEMALLOC_EXPORT
|
||||
void (*test_hooks_safety_check_abort)(const char *) = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue