diff mbox series

scs: Report SCS usage in bytes rather than number of entries

Message ID 20200603151218.11659-1-will@kernel.org (mailing list archive)
State Mainlined
Commit 333ed74689b8fca097574124fef7fa0e3d7f79d4
Headers show
Series scs: Report SCS usage in bytes rather than number of entries | expand

Commit Message

Will Deacon June 3, 2020, 3:12 p.m. UTC
Fix the SCS debug usage check so that we report the number of bytes
usedm, rather than the number of entries.

Fixes: 5bbaf9d1fcb9 ("scs: Add support for stack usage debugging")
Reported-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
---
 kernel/scs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kees Cook June 3, 2020, 5:06 p.m. UTC | #1
On Wed, Jun 03, 2020 at 04:12:17PM +0100, Will Deacon wrote:
> Fix the SCS debug usage check so that we report the number of bytes
> usedm, rather than the number of entries.

typo: used

> 
> Fixes: 5bbaf9d1fcb9 ("scs: Add support for stack usage debugging")
> Reported-by: Sami Tolvanen <samitolvanen@google.com>
> Signed-off-by: Will Deacon <will@kernel.org>

Reviewed-by: Kees Cook <keescook@chromium.org>
Will Deacon June 4, 2020, 3:15 p.m. UTC | #2
On Wed, Jun 03, 2020 at 10:06:13AM -0700, Kees Cook wrote:
> On Wed, Jun 03, 2020 at 04:12:17PM +0100, Will Deacon wrote:
> > Fix the SCS debug usage check so that we report the number of bytes
> > usedm, rather than the number of entries.
> 
> typo: used
> 
> > 
> > Fixes: 5bbaf9d1fcb9 ("scs: Add support for stack usage debugging")
> > Reported-by: Sami Tolvanen <samitolvanen@google.com>
> > Signed-off-by: Will Deacon <will@kernel.org>
> 
> Reviewed-by: Kees Cook <keescook@chromium.org>

Cheers, Kees!

Will
diff mbox series

Patch

diff --git a/kernel/scs.c b/kernel/scs.c
index 222a7a9ad543..5d4d9bbdec36 100644
--- a/kernel/scs.c
+++ b/kernel/scs.c
@@ -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) {