From e27c6490bae0495104a52d7539e1b0a79d8f480a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=A4nnich?= Date: Thu, 29 Jun 2023 12:33:45 +0000 Subject: [PATCH] Revert "ANDROID: android: Create debug_symbols driver" This reverts commit bb732365f7ad44aab1eaed253cd130f9b49679da. Reason for revert: breaks when enabled via config when building the target `//common-modules/virtual-device:virtual_device_arm_dist` ``` In file included from common/drivers/android/android_debug_symbols.c:12: common/arch/arm/include/asm/stacktrace.h:41:21: error: call to undeclared function 'in_entry_text'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] frame->ex_frame = in_entry_text(frame->pc); ^ In file included from common/drivers/android/android_debug_symbols.c:13: common/arch/arm/include/asm/sections.h:14:20: error: static declaration of 'in_entry_text' follows non-static declaration static inline bool in_entry_text(unsigned long addr) ^ common/arch/arm/include/asm/stacktrace.h:41:21: note: previous implicit declaration is here frame->ex_frame = in_entry_text(frame->pc); ^ ``` Change-Id: Id31003d4c9c60758f6038a63d40ffd7f8044cc9f Signed-off-by: Matthias Maennich --- drivers/android/Kconfig | 11 --- drivers/android/Makefile | 1 - drivers/android/android_debug_symbols.c | 96 ------------------------- include/linux/android_debug_symbols.h | 47 ------------ 4 files changed, 155 deletions(-) delete mode 100644 drivers/android/android_debug_symbols.c delete mode 100644 include/linux/android_debug_symbols.h diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig index c3a49e538988..c5e063b723dd 100644 --- a/drivers/android/Kconfig +++ b/drivers/android/Kconfig @@ -47,17 +47,6 @@ config ANDROID_BINDER_IPC_SELFTEST exhaustively with combinations of various buffer sizes and alignments. -config ANDROID_DEBUG_SYMBOLS - bool "Android Debug Symbols" - help - Enables export of debug symbols that are useful for offline debugging - of a kernel. These symbols would be used in vendor modules to find - addresses of the core kernel symbols for vendor extensions. - - This driver is statically compiled into kernel and maintains all the - required symbol addresses for vendor modules and provides necessary - interface vendor modules. - config ANDROID_VENDOR_HOOKS bool "Android Vendor Hooks" depends on TRACEPOINTS diff --git a/drivers/android/Makefile b/drivers/android/Makefile index 97cddb531ee0..9b89e4ba00a1 100644 --- a/drivers/android/Makefile +++ b/drivers/android/Makefile @@ -4,6 +4,5 @@ ccflags-y += -I$(src) # needed for trace events obj-$(CONFIG_ANDROID_BINDERFS) += binderfs.o obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o binder_alloc.o obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o -obj-$(CONFIG_ANDROID_DEBUG_SYMBOLS) += android_debug_symbols.o obj-$(CONFIG_ANDROID_VENDOR_HOOKS) += vendor_hooks.o obj-$(CONFIG_ANDROID_DEBUG_KINFO) += debug_kinfo.o diff --git a/drivers/android/android_debug_symbols.c b/drivers/android/android_debug_symbols.c deleted file mode 100644 index 189fa0d8c141..000000000000 --- a/drivers/android/android_debug_symbols.c +++ /dev/null @@ -1,96 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only - -/* - * Copyright (c) 2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2023, Unisoc (Shanghai) Technologies Co., Ltd - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include "../../mm/slab.h" -#include - -struct ads_entry { - char *name; - void *addr; -}; - -#define _ADS_ENTRY(index, symbol) \ - [index] = { .name = #symbol, .addr = (void *)symbol } -#define ADS_ENTRY(index, symbol) _ADS_ENTRY(index, symbol) - -#define _ADS_PER_CPU_ENTRY(index, symbol) \ - [index] = { .name = #symbol, .addr = (void *)&symbol } -#define ADS_PER_CPU_ENTRY(index, symbol) _ADS_PER_CPU_ENTRY(index, symbol) - -/* - * This module maintains static array of symbol and address information. - * Add all required core kernel symbols and their addresses into ads_entries[] array, - * so that vendor modules can query and to find address of non-exported symbol. - */ -static const struct ads_entry ads_entries[ADS_END] = { - ADS_ENTRY(ADS_SDATA, _sdata), - ADS_ENTRY(ADS_BSS_END, __bss_stop), - ADS_ENTRY(ADS_PER_CPU_START, __per_cpu_start), - ADS_ENTRY(ADS_PER_CPU_END, __per_cpu_end), - ADS_ENTRY(ADS_TEXT, _text), - ADS_ENTRY(ADS_SEND, _end), - ADS_ENTRY(ADS_LINUX_BANNER, linux_banner), - ADS_ENTRY(ADS_TOTAL_CMA, &totalcma_pages), - ADS_ENTRY(ADS_SLAB_CACHES, &slab_caches), - ADS_ENTRY(ADS_SLAB_MUTEX, &slab_mutex), -}; - -/* - * ads_per_cpu_entries array contains all the per_cpu variable address information. - */ -static const struct ads_entry ads_per_cpu_entries[ADS_DEBUG_PER_CPU_END] = { -#ifdef CONFIG_ARM64 - ADS_PER_CPU_ENTRY(ADS_IRQ_STACK_PTR, irq_stack_ptr), -#endif -#ifdef CONFIG_X86 - ADS_PER_CPU_ENTRY(ADS_IRQ_STACK_PTR, hardirq_stack_ptr), -#endif -}; - -/* - * android_debug_symbol - Provide address inforamtion of debug symbol. - * @symbol: Index of debug symbol array. - * - * Return address of core kernel symbol on success and a negative errno will be - * returned in error cases. - * - */ -void *android_debug_symbol(enum android_debug_symbol symbol) -{ - if (symbol >= ADS_END) - return ERR_PTR(-EINVAL); - - return ads_entries[symbol].addr; -} -EXPORT_SYMBOL_NS_GPL(android_debug_symbol, MINIDUMP); - -/* - * android_debug_per_cpu_symbol - Provide address inforamtion of per cpu debug symbol. - * @symbol: Index of per cpu debug symbol array. - * - * Return address of core kernel symbol on success and a negative errno will be - * returned in error cases. - * - */ -void *android_debug_per_cpu_symbol(enum android_debug_per_cpu_symbol symbol) -{ - if (symbol >= ADS_DEBUG_PER_CPU_END) - return ERR_PTR(-EINVAL); - - return ads_per_cpu_entries[symbol].addr; -} -EXPORT_SYMBOL_NS_GPL(android_debug_per_cpu_symbol, MINIDUMP); - diff --git a/include/linux/android_debug_symbols.h b/include/linux/android_debug_symbols.h deleted file mode 100644 index 92c0259e6f89..000000000000 --- a/include/linux/android_debug_symbols.h +++ /dev/null @@ -1,47 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2023, Unisoc (Shanghai) Technologies Co., Ltd - */ - -#ifndef _ANDROID_DEBUG_SYMBOLS_H -#define _ANDROID_DEBUG_SYMBOLS_H - -enum android_debug_symbol { - ADS_SDATA = 0, - ADS_BSS_END, - ADS_PER_CPU_START, - ADS_PER_CPU_END, - ADS_TEXT, - ADS_SEND, - ADS_LINUX_BANNER, - ADS_TOTAL_CMA, - ADS_SLAB_CACHES, - ADS_SLAB_MUTEX, - ADS_END -}; - -enum android_debug_per_cpu_symbol { - ADS_IRQ_STACK_PTR = 0, - ADS_DEBUG_PER_CPU_END -}; - -#ifdef CONFIG_ANDROID_DEBUG_SYMBOLS - -void *android_debug_symbol(enum android_debug_symbol symbol); -void *android_debug_per_cpu_symbol(enum android_debug_per_cpu_symbol symbol); - -#else /* !CONFIG_ANDROID_DEBUG_SYMBOLS */ - -static inline void *android_debug_symbol(enum android_debug_symbol symbol) -{ - return NULL; -} -static inline void *android_debug_per_cpu_symbol(enum android_debug_per_cpu_symbol symbol) -{ - return NULL; -} - -#endif /* CONFIG_ANDROID_DEBUG_SYMBOLS */ - -#endif /* _ANDROID_DEBUG_SYMBOLS_H */