* [to-be-updated] stackdepot-ignore-junk-last-entry-in-case-of-switch-from-user-mode.patch removed from -mm tree
@ 2017-10-13 21:21 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2017-10-13 21:21 UTC (permalink / raw)
To: maninder1.s, a.sahrawat, chris, dvyukov, mark.rutland, v.narang,
mm-commits
The patch titled
Subject: lib/stackdepot.c: ignore junk last entry in case of switch from user mode.
has been removed from the -mm tree. Its filename was
stackdepot-ignore-junk-last-entry-in-case-of-switch-from-user-mode.patch
This patch was dropped because an updated version will be merged
------------------------------------------------------
From: Maninder Singh <maninder1.s@samsung.com>
Subject: lib/stackdepot.c: ignore junk last entry in case of switch from user mode.
Issue observed on ARM.
Whenever there is switch from user mode, we end up with invalid last entry
with some user space address as below:-
save_stack+0x40/0xec
__set_page_owner+0x2c/0x64
....
....
__handle_domain_irq+0x9c/0x130
gic_handle_irq+0x40/0x80
__irq_usr+0x4c/0x60
0xb6507818
So in this case last entry is not valid, which leads to allocated one more
new frame for stackdepot although having all above frames exactly same.
(It increases depot_index drastically)
So its better to ignore that last frame in case of switch.
save_stack+0x40/0xec
__set_page_owner+0x2c/0x64
....
....
__handle_domain_irq+0x9c/0x130
gic_handle_irq+0x40/0x80
__irq_usr+0x4c/0x60
Link: http://lkml.kernel.org/r/1507725802-44574-1-git-send-email-maninder1.s@samsung.com
Signed-off-by: Vaneet Narang <v.narang@samsung.com>
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
lib/stackdepot.c | 7 +++++++
1 file changed, 7 insertions(+)
diff -puN lib/stackdepot.c~stackdepot-ignore-junk-last-entry-in-case-of-switch-from-user-mode lib/stackdepot.c
--- a/lib/stackdepot.c~stackdepot-ignore-junk-last-entry-in-case-of-switch-from-user-mode
+++ a/lib/stackdepot.c
@@ -214,6 +214,13 @@ depot_stack_handle_t depot_save_stack(st
if (unlikely(trace->nr_entries == 0))
goto fast_exit;
+ /*
+ * Ignore last entry if it belongs to user space
+ * in case of switch from user mode.
+ */
+ if (!kernel_text_address(trace->entries[trace->nr_entries - 1]))
+ trace->nr_entries--;
+
hash = hash_stack(trace->entries, trace->nr_entries);
bucket = &stack_table[hash & STACK_HASH_MASK];
_
Patches currently in -mm which might be from maninder1.s@samsung.com are
bloat-o-meter-provide-3-different-arguments-for-data-function-and-all.patch
bloat-o-meter-provide-3-different-arguments-for-data-function-and-all-v2.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-10-13 21:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 21:21 [to-be-updated] stackdepot-ignore-junk-last-entry-in-case-of-switch-from-user-mode.patch removed from -mm tree akpm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).