Skip to content

Commit

Permalink
scs: Report SCS usage in bytes rather than number of entries
Browse files Browse the repository at this point in the history
Fix the SCS debug usage check so that we report the number of bytes
used, rather than the number of entries.

Fixes: 5bbaf9d ("scs: Add support for stack usage debugging")
Reported-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Will Deacon <will@kernel.org>
  • Loading branch information
Will Deacon committed Jun 4, 2020
1 parent 082af5e commit 333ed74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/scs.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void scs_check_usage(struct task_struct *tsk)
for (p = task_scs(tsk); p < __scs_magic(tsk); ++p) {
if (!READ_ONCE_NOCHECK(*p))
break;
used++;
used += sizeof(*p);
}

while (used > curr) {
Expand Down

0 comments on commit 333ed74

Please sign in to comment.