summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-09-12 07:53:05 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-09-12 07:53:05 +0200
commit45a7dc7f8dfa5acc8789203800f2234ad71dedf4 (patch)
tree2793330e1c48ff4eabbf9b99031eac05d0c6f00b /arch
parentaa63596f6189852e2b61f8dc0f6dc2b103e5ef16 (diff)
parent22f38edf93da46f5149849666df64beeb5d973fe (diff)
downloadbarebox-45a7dc7f8dfa5acc8789203800f2234ad71dedf4.tar.gz
barebox-45a7dc7f8dfa5acc8789203800f2234ad71dedf4.tar.xz
Merge branch 'for-next/fsanitize'
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/cpu/Kconfig1
-rw-r--r--arch/arm/include/asm/barebox.h16
-rw-r--r--arch/blackfin/include/asm/barebox.h43
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/include/asm/barebox.h8
-rw-r--r--arch/nios2/include/asm/barebox.h4
-rw-r--r--arch/openrisc/include/asm/barebox.h4
-rw-r--r--arch/ppc/include/asm/barebox.h27
-rw-r--r--arch/ppc/include/asm/common.h2
-rw-r--r--arch/riscv/include/asm/barebox.h1
-rw-r--r--arch/sandbox/Kconfig8
-rw-r--r--arch/sandbox/Makefile14
-rw-r--r--arch/sandbox/include/asm/barebox.h1
-rw-r--r--arch/sandbox/lib/Makefile1
-rw-r--r--arch/sandbox/lib/unwind.c11
-rw-r--r--arch/x86/include/asm/barebox.h17
17 files changed, 36 insertions, 125 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index de45bcf82a..8adaed5286 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -399,12 +399,14 @@ config ARM_OPTIMZED_STRING_FUNCTIONS
increase your binary size.
config ARM_EXCEPTIONS
+ select ARCH_HAS_DATA_ABORT_MASK
bool "enable arm exception handling support"
default y
config ARM_UNWIND
bool "enable stack unwinding support"
depends on AEABI
+ select ARCH_HAS_STACK_DUMP
help
This option enables stack unwinding support in barebox
using the information automatically generated by the
diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
index f8abbccfca..6b4fed5269 100644
--- a/arch/arm/cpu/Kconfig
+++ b/arch/arm/cpu/Kconfig
@@ -87,6 +87,7 @@ config CPU_V8
select CPU_SUPPORTS_64BIT_KERNEL
select ARM_EXCEPTIONS
select GENERIC_FIND_NEXT_BIT
+ select ARCH_HAS_STACK_DUMP
config CPU_XSC3
bool
diff --git a/arch/arm/include/asm/barebox.h b/arch/arm/include/asm/barebox.h
deleted file mode 100644
index 4e89466593..0000000000
--- a/arch/arm/include/asm/barebox.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef _BAREBOX_H_
-#define _BAREBOX_H_ 1
-
-#ifdef CONFIG_ARM_UNWIND
-#define ARCH_HAS_STACK_DUMP
-#endif
-
-#ifdef CONFIG_CPU_V8
-#define ARCH_HAS_STACK_DUMP
-#endif
-
-#ifdef CONFIG_ARM_EXCEPTIONS
-#define ARCH_HAS_DATA_ABORT_MASK
-#endif
-
-#endif /* _BAREBOX_H_ */
diff --git a/arch/blackfin/include/asm/barebox.h b/arch/blackfin/include/asm/barebox.h
deleted file mode 100644
index 2684f60a5f..0000000000
--- a/arch/blackfin/include/asm/barebox.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * barebox - barebox.h Structure declarations for board specific data
- *
- * Copyright (c) 2005 blackfin.uclinux.org
- *
- * (C) Copyright 2000-2004
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef _BAREBOX_H_
-#define _BAREBOX_H_ 1
-
-typedef struct bd_info {
- int bi_baudrate; /* serial console baudrate */
- unsigned long bi_ip_addr; /* IP Address */
- unsigned char bi_enetaddr[6]; /* Ethernet adress */
- unsigned long bi_arch_number; /* unique id for this board */
- unsigned long bi_boot_params; /* where this board expects params */
- unsigned long bi_memstart; /* start of DRAM memory */
- unsigned long bi_memsize; /* size of DRAM memory in bytes */
- unsigned long bi_flashstart; /* start of FLASH memory */
- unsigned long bi_flashsize; /* size of FLASH memory */
- unsigned long bi_flashoffset; /* reserved area for startup monitor */
-} bd_t;
-
-#define bi_env_data bi_env->data
-#define bi_env_crc bi_env->crc
-
-#endif /* _BAREBOX_H_ */
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 728295d486..1395ad4c6f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -10,6 +10,7 @@ config MIPS
select HAVE_CONFIGURABLE_TEXT_BASE
select HAVE_PBL_MULTI_IMAGES
select HAS_DMA
+ select ARCH_HAS_DATA_ABORT_MASK
select ELF
default y
diff --git a/arch/mips/include/asm/barebox.h b/arch/mips/include/asm/barebox.h
deleted file mode 100644
index 2d13ee932f..0000000000
--- a/arch/mips/include/asm/barebox.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#ifndef _ASM_MIPS_BAREBOX_H_
-#define _ASM_MIPS_BAREBOX_H_
-
-#define ARCH_HAS_DATA_ABORT_MASK
-
-#endif /* _ASM_MIPS_BAREBOX_H_ */
diff --git a/arch/nios2/include/asm/barebox.h b/arch/nios2/include/asm/barebox.h
deleted file mode 100644
index 9dd1df8e32..0000000000
--- a/arch/nios2/include/asm/barebox.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _ASM_BAREBOX_H_
-#define _ASM_BAREBOX_H_
-
-#endif /* _ASM_BAREBOX_H_ */
diff --git a/arch/openrisc/include/asm/barebox.h b/arch/openrisc/include/asm/barebox.h
deleted file mode 100644
index 9dd1df8e32..0000000000
--- a/arch/openrisc/include/asm/barebox.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _ASM_BAREBOX_H_
-#define _ASM_BAREBOX_H_
-
-#endif /* _ASM_BAREBOX_H_ */
diff --git a/arch/ppc/include/asm/barebox.h b/arch/ppc/include/asm/barebox.h
deleted file mode 100644
index 0c608b3079..0000000000
--- a/arch/ppc/include/asm/barebox.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * (C) Copyright 2000 - 2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- *
- ********************************************************************
- * NOTE: This header file defines an interface to barebox. Including
- * this (unmodified) header file in another file is considered normal
- * use of barebox, and does *not* fall under the heading of "derived
- * work".
- ********************************************************************
- */
-
-#ifndef __BAREBOX_H__
-#define __BAREBOX_H__
-
-#endif /* __BAREBOX_H__ */
diff --git a/arch/ppc/include/asm/common.h b/arch/ppc/include/asm/common.h
index 045817bed2..b91f51e462 100644
--- a/arch/ppc/include/asm/common.h
+++ b/arch/ppc/include/asm/common.h
@@ -1,8 +1,6 @@
#ifndef __ASM_COMMON_H
#define __ASM_COMMON_H
-#include <asm/barebox.h>
-
extern unsigned long _text_base;
unsigned long long get_ticks(void);
diff --git a/arch/riscv/include/asm/barebox.h b/arch/riscv/include/asm/barebox.h
deleted file mode 100644
index 2997587d82..0000000000
--- a/arch/riscv/include/asm/barebox.h
+++ /dev/null
@@ -1 +0,0 @@
-/* dummy */
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index 5227cb624f..c20a9171a7 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -2,6 +2,8 @@ config SANDBOX
bool
select OFTREE
select GPIOLIB
+ select ARCH_HAS_UBSAN_SANITIZE_ALL
+ select HAVE_ARCH_KASAN
default y
config ARCH_TEXT_BASE
@@ -15,3 +17,9 @@ config LINUX
config ARCH_LINUX
bool
+
+config SANDBOX_UNWIND
+ bool
+ default y
+ select ARCH_HAS_STACK_DUMP
+ depends on UBSAN || KASAN
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index 85c70b5e80..52ad4850cb 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -45,11 +45,21 @@ ifeq ($(CONFIG_GPIO_LIBFTDI1),y)
FTDI1_LIBS := $(shell pkg-config libftdi1 --libs)
endif
+ifeq ($(CONFIG_KASAN),y)
+CPPFLAGS += -fsanitize=address
+SANITIZER_LIBS += -fsanitize=address
+endif
+
+ifeq ($(CONFIG_UBSAN),y)
+SANITIZER_LIBS += -fsanitize=undefined
+endif
+
cmd_barebox__ = $(CC) -o $@ -Wl,-T,$(barebox-lds) \
-Wl,--start-group $(barebox-common) -Wl,--end-group \
- -lrt -lpthread $(SDL_LIBS) $(FTDI1_LIBS)
+ -lrt -lpthread $(SDL_LIBS) $(FTDI1_LIBS) \
+ $(SANITIZER_LIBS)
-common-y += $(BOARD) arch/sandbox/os/
+common-y += $(BOARD) arch/sandbox/os/ arch/sandbox/lib/
common-$(CONFIG_OFTREE) += arch/sandbox/dts/
diff --git a/arch/sandbox/include/asm/barebox.h b/arch/sandbox/include/asm/barebox.h
deleted file mode 100644
index 2997587d82..0000000000
--- a/arch/sandbox/include/asm/barebox.h
+++ /dev/null
@@ -1 +0,0 @@
-/* dummy */
diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile
new file mode 100644
index 0000000000..b32ca6aaf8
--- /dev/null
+++ b/arch/sandbox/lib/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_ARCH_HAS_STACK_DUMP) += unwind.o
diff --git a/arch/sandbox/lib/unwind.c b/arch/sandbox/lib/unwind.c
new file mode 100644
index 0000000000..15a2798cc4
--- /dev/null
+++ b/arch/sandbox/lib/unwind.c
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only
+// Copyright 2019 Ahmad Fatoum
+
+#include <common.h>
+
+void __sanitizer_print_stack_trace(void);
+
+void dump_stack(void)
+{
+ __sanitizer_print_stack_trace();
+}
diff --git a/arch/x86/include/asm/barebox.h b/arch/x86/include/asm/barebox.h
deleted file mode 100644
index 473edb555c..0000000000
--- a/arch/x86/include/asm/barebox.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (C) 2009 Juergen Beisert, Pengutronix
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- *
- */
-
-/* nothing special yet */