From 725878020cd6d01dc79a4992683ba24dc0f0cac0 Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Tue, 9 Jun 2020 12:56:33 +0100 Subject: [PATCH] Revert "FROMLIST: scs: add support for stack usage debugging" Shadow call stack is now merged upstream for 5.9, so revert the patches cherry-picked into android-mainline in preparation for pulling the upstream version instead. This reverts commit e5438c0fea17582385c8d25182fd022aa3a5d38e. Signed-off-by: Will Deacon Change-Id: I99a5b3555caf473553222657aa53045be3767b0c --- kernel/scs.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/kernel/scs.c b/kernel/scs.c index ad74d13f2c0f..5245e992c692 100644 --- a/kernel/scs.c +++ b/kernel/scs.c @@ -184,44 +184,6 @@ int scs_prepare(struct task_struct *tsk, int node) return 0; } -#ifdef CONFIG_DEBUG_STACK_USAGE -static inline unsigned long scs_used(struct task_struct *tsk) -{ - unsigned long *p = __scs_base(tsk); - unsigned long *end = scs_magic(p); - unsigned long s = (unsigned long)p; - - while (p < end && READ_ONCE_NOCHECK(*p)) - p++; - - return (unsigned long)p - s; -} - -static void scs_check_usage(struct task_struct *tsk) -{ - static DEFINE_SPINLOCK(lock); - static unsigned long highest; - unsigned long used = scs_used(tsk); - - if (used <= highest) - return; - - spin_lock(&lock); - - if (used > highest) { - pr_info("%s (%d): highest shadow stack usage: %lu bytes\n", - tsk->comm, task_pid_nr(tsk), used); - highest = used; - } - - spin_unlock(&lock); -} -#else -static inline void scs_check_usage(struct task_struct *tsk) -{ -} -#endif - bool scs_corrupted(struct task_struct *tsk) { unsigned long *magic = scs_magic(__scs_base(tsk)); @@ -238,7 +200,6 @@ void scs_release(struct task_struct *tsk) return; WARN_ON(scs_corrupted(tsk)); - scs_check_usage(tsk); scs_account(tsk, -1); task_set_scs(tsk, NULL);