Merge "Fix debug malloc."
This commit is contained in:
commit
db794197cc
3 changed files with 21 additions and 50 deletions
|
@ -736,7 +736,7 @@ WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
|
|||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp bionic/__stack_chk_guard.cpp
|
||||
LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
|
||||
LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector -Werror
|
||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||
LOCAL_MODULE := libbionic_ssp
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "bionic_ssp.h"
|
||||
|
||||
#include <sys/auxv.h>
|
||||
|
||||
uintptr_t __stack_chk_guard = 0;
|
||||
|
||||
static void __attribute__((constructor)) __init_stack_check_guard() {
|
||||
// AT_RANDOM is a pointer to 16 bytes of randomness on the stack.
|
||||
__stack_chk_guard = *reinterpret_cast<uintptr_t*>(getauxval(AT_RANDOM));
|
||||
}
|
|
@ -26,21 +26,24 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <elf.h>
|
||||
#include <asm/page.h>
|
||||
#include "pthread_internal.h"
|
||||
#include "atexit.h"
|
||||
#include "KernelArgumentBlock.h"
|
||||
#include "libc_init_common.h"
|
||||
|
||||
#include <asm/page.h>
|
||||
#include <bionic_tls.h>
|
||||
#include <elf.h>
|
||||
#include <errno.h>
|
||||
#include <private/bionic_auxv.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/auxv.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "atexit.h"
|
||||
#include "private/bionic_auxv.h"
|
||||
#include "private/bionic_ssp.h"
|
||||
#include "private/KernelArgumentBlock.h"
|
||||
#include "pthread_internal.h"
|
||||
|
||||
extern "C" unsigned __get_sp(void);
|
||||
extern "C" int __system_properties_init(void);
|
||||
|
@ -51,6 +54,9 @@ const char* __progname;
|
|||
// Declared in <unistd.h>.
|
||||
char** environ;
|
||||
|
||||
// Declared in <private/bionic_ssp.h>.
|
||||
uintptr_t __stack_chk_guard = 0;
|
||||
|
||||
// Declared in <asm/page.h>.
|
||||
unsigned int __page_size = PAGE_SIZE;
|
||||
unsigned int __page_shift = PAGE_SHIFT;
|
||||
|
@ -91,6 +97,9 @@ void __libc_init_common(KernelArgumentBlock& args) {
|
|||
__libc_auxv = args.auxv;
|
||||
__progname = args.argv[0] ? args.argv[0] : "<unknown>";
|
||||
|
||||
// AT_RANDOM is a pointer to 16 bytes of randomness on the stack.
|
||||
__stack_chk_guard = *reinterpret_cast<uintptr_t*>(getauxval(AT_RANDOM));
|
||||
|
||||
// Get the main thread from TLS and add it to the thread list.
|
||||
pthread_internal_t* main_thread = __get_thread();
|
||||
main_thread->allocated_on_heap = false;
|
||||
|
|
Loading…
Reference in a new issue