Don't use -fstack-protector on ssp.c
libc's stack protector initialization routine (__guard_setup) is in bionic/ssp.c. This code deliberately modifies the stack canary. This code should never be compiled with -fstack-protector-all otherwise it will crash (mismatched canary value). Force bionic/ssp.c to be compiled with -fno-stack-protector Change-Id: Ib95a5736e4bafe1a460d6b4e522ca660b417d8d6
This commit is contained in:
parent
8f08e1c902
commit
6334c662ca
@ -292,7 +292,6 @@ libc_common_src_files := \
|
||||
bionic/sched_cpucount.c \
|
||||
bionic/semaphore.c \
|
||||
bionic/sha1.c \
|
||||
bionic/ssp.c \
|
||||
bionic/stubs.c \
|
||||
bionic/system_properties.c \
|
||||
bionic/tdelete.c \
|
||||
@ -618,6 +617,25 @@ ALL_GENERATED_SOURCES += $(GEN)
|
||||
# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
|
||||
WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
|
||||
|
||||
# ========================================================
|
||||
# libbionic_ssp.a - stack protector code
|
||||
# ========================================================
|
||||
#
|
||||
# The stack protector code needs to be compiled
|
||||
# with -fno-stack-protector, since it modifies the
|
||||
# stack canary.
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := bionic/ssp.c
|
||||
LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
|
||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||
LOCAL_MODULE := libbionic_ssp
|
||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# ========================================================
|
||||
# libc_common.a
|
||||
# ========================================================
|
||||
@ -630,6 +648,7 @@ LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
|
||||
endif
|
||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||
LOCAL_MODULE := libc_common
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp
|
||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
Loading…
x
Reference in New Issue
Block a user