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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171012111051epcms5p3117f59d0ec83cd2d62e36a0a2f73369f@epcms5p3>
Date:   Thu, 12 Oct 2017 11:10:51 +0000
From:   Vaneet Narang <v.narang@...sung.com>
To:     Maninder Singh <maninder1.s@...sung.com>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "dvyukov@...gle.com" <dvyukov@...gle.com>,
        "chris@...is-wilson.co.uk" <chris@...is-wilson.co.uk>,
        "kasan-dev@...glegroups.com" <kasan-dev@...glegroups.com>,
        "mark.rutland@....com" <mark.rutland@....com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        PANKAJ MISHRA <pankaj.m@...sung.com>,
        AMIT SAHRAWAT <a.sahrawat@...sung.com>
Subject: RE: [PATCH v2] stackdepot: ignore junk last entry in case of switch
 from user mode.

Hi Dmitry,

>diff --git a/lib/stackdepot.c b/lib/stackdepot.c
>index f87d138..a045748 100644
>--- a/lib/stackdepot.c
>+++ b/lib/stackdepot.c
>@@ -214,6 +214,13 @@ depot_stack_handle_t depot_save_stack(struct stack_trace *trace,
> 	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]))

can we also add this check here:-
if (!kernel_text_address(trace->entries[trace->nr_entries - 1]) || in_interrupt())

Because on further checking , last frame in case of svc to interrupt mode is some random core kernel / Kernel Module address
like below:-

irq_exit+0xe4/0x140
__handle_domain_irq+0x9c/0x130
gic_handle_irq+0x40/0x80
__irq_svc+0x44/0x7c
hdmi_ocm_rx_get_scdc_sts+0x160/0x170 [sdp_hdmi]   >> we need this frme??

This generates mismatch with existing entires and new entries get created and depot_index
value keep on increasing slowly and reaches max value (STACK_ALLOC_SLABS_CAP) but after this change 
depot_index gets a stable value after some time. (Tested on ARM)

>+		trace->nr_entries--;
>+
> 	hash = hash_stack(trace->entries, trace->nr_entries);
> 	bucket = &stack_table[hash & STACK_HASH_MASK];
> 
>-- 
>1.9.1

Regards,
Vaneet Narang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ