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 e5438c0fea.
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I99a5b3555caf473553222657aa53045be3767b0c
This commit is contained in:
39
kernel/scs.c
39
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);
|
||||
|
||||
Reference in New Issue
Block a user