use SLAB_CANARY for conditional checks
parent
7d6663ed80
commit
3696f071a4
4
Makefile
4
Makefile
|
@ -30,10 +30,6 @@ SHARED_FLAGS := -O3 -flto -fPIC -fvisibility=hidden -fno-plt \
|
||||||
$(call safe_flag,-fstack-clash-protection) -fstack-protector-strong -pipe -Wall -Wextra \
|
$(call safe_flag,-fstack-clash-protection) -fstack-protector-strong -pipe -Wall -Wextra \
|
||||||
$(call safe_flag,-Wcast-align=strict,-Wcast-align) -Wcast-qual -Wwrite-strings
|
$(call safe_flag,-Wcast-align=strict,-Wcast-align) -Wcast-qual -Wwrite-strings
|
||||||
|
|
||||||
ifeq ($(CC),clang)
|
|
||||||
SHARED_FLAGS += -Wno-constant-logical-operand
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_WERROR),true)
|
ifeq ($(CONFIG_WERROR),true)
|
||||||
SHARED_FLAGS += -Werror
|
SHARED_FLAGS += -Werror
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -673,7 +673,7 @@ static inline void deallocate_small(void *p, const size_t *expected_size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_zero_size) {
|
if (!is_zero_size) {
|
||||||
if (canary_size) {
|
if (SLAB_CANARY) {
|
||||||
u64 canary_value;
|
u64 canary_value;
|
||||||
memcpy(&canary_value, (char *)p + size - canary_size, canary_size);
|
memcpy(&canary_value, (char *)p + size - canary_size, canary_size);
|
||||||
if (unlikely(canary_value != metadata->canary_value)) {
|
if (unlikely(canary_value != metadata->canary_value)) {
|
||||||
|
@ -1589,7 +1589,7 @@ static inline void memory_corruption_check_small(const void *p) {
|
||||||
fatal_error("invalid malloc_usable_size");
|
fatal_error("invalid malloc_usable_size");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_zero_size && canary_size) {
|
if (!is_zero_size && SLAB_CANARY) {
|
||||||
u64 canary_value;
|
u64 canary_value;
|
||||||
memcpy(&canary_value, (const char *)p + size - canary_size, canary_size);
|
memcpy(&canary_value, (const char *)p + size - canary_size, canary_size);
|
||||||
if (unlikely(canary_value != metadata->canary_value)) {
|
if (unlikely(canary_value != metadata->canary_value)) {
|
||||||
|
|
Loading…
Reference in New Issue