lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 27 Apr 2020 15:46:23 +0530
From:   Maninder Singh <maninder1.s@...sung.com>
To:     mingo@...nel.org
Cc:     linux-kernel@...r.kernel.org, v.narang@...sung.com,
        a.sahrawat@...sung.com, Maninder Singh <maninder1.s@...sung.com>
Subject: [PATCH 1/1] sched/headers: don't count canary as free space on
 stack.

currently if all stack is used except canary and thread_info space,
stack usage prints about free space.

[11.7426] X (1260) used greatest stack depth: 4 bytes left

It is because canary is accounted as usable stack, so removing
that from accounting.

[12.8717] X (1270) used greatest stack depth: 0 bytes left

Signed-off-by: vaneet Narang <v.narang@...sung.com>
Signed-off-by: Maninder Singh <maninder1.s@...sung.com>
---
 include/linux/sched/task_stack.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h
index 2413427..3174938 100644
--- a/include/linux/sched/task_stack.h
+++ b/include/linux/sched/task_stack.h
@@ -100,10 +100,11 @@ static inline unsigned long stack_not_used(struct task_struct *p)
 # endif
 	} while (!*n);
 
+	/* Don't count canary as usable stack */
 # ifdef CONFIG_STACK_GROWSUP
-	return (unsigned long)end_of_stack(p) - (unsigned long)n;
+	return (unsigned long)end_of_stack(p) - (unsigned long)(n + 1);
 # else
-	return (unsigned long)n - (unsigned long)end_of_stack(p);
+	return (unsigned long)(n - 1) - (unsigned long)end_of_stack(p);
 # endif
 }
 #endif
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ