From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F229CC4727F for ; Fri, 25 Sep 2020 08:55:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F3BC20878 for ; Fri, 25 Sep 2020 08:55:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Byg4yL3t"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="UBbd3YTV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F3BC20878 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4D0B16B006C; Fri, 25 Sep 2020 04:55:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A8086B006E; Fri, 25 Sep 2020 04:55:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BB7C6B0070; Fri, 25 Sep 2020 04:55:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id 27E846B006C for ; Fri, 25 Sep 2020 04:55:43 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E2C826D9D for ; Fri, 25 Sep 2020 08:55:42 +0000 (UTC) X-FDA: 77300975724.02.door88_370421227166 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id A1950101AF4CF for ; Fri, 25 Sep 2020 08:55:42 +0000 (UTC) X-HE-Tag: door88_370421227166 X-Filterd-Recvd-Size: 5015 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Fri, 25 Sep 2020 08:55:42 +0000 (UTC) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1601024139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=27rpXJWZJemqCR5/J+kJk/Ytwunk5JlcbUzkum+S4N4=; b=Byg4yL3te8ivcMS4F2H8gOSQgqsZFJMj7/3QGL1zpD+Uh7rAUCaut5ynvf9S5fDMomckOp U5NB52hUfA2U6b3+cKPcx4a4SV0DKzu47kDUHuaXyQB3h6c/zTi8HkZRbpHchKrjOmVKvR WzM0VPP/baGMhhiSoGWCH7oiH6uphutlfMaExg5R4H/NBJYE84qYc+05sJbCMCS2sXrWk6 NXtbO2rgbxrUFvRLlnR3+pdP0qO+xTGpIX12bTcavQl+D3AQI1oN0JuV/sUI9EqoYPq6eT ZniwmFxZjcNhCpZY1YxANngzOLk9EIUxSeG+WYk4sDTAGTYDDj4qVSROVGOvWw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1601024139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=27rpXJWZJemqCR5/J+kJk/Ytwunk5JlcbUzkum+S4N4=; b=UBbd3YTV3lBvSjOcMTIlxl7PlmxXWJcM7BthmUp44vKv9Dy511FWWrHXVYtIyr0/6UCITS jzGULCttqvgHCcDQ== To: Walter Wu Cc: Andrew Morton , John Stultz , Stephen Boyd , Marco Elver , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Andrey Konovalov , Matthias Brugger , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, wsd_upstream , linux-mediatek@lists.infradead.org Subject: Re: [PATCH v4 1/6] timer: kasan: record timer stack In-Reply-To: <1601018323.28162.4.camel@mtksdccf07> References: <20200924040335.30934-1-walter-zh.wu@mediatek.com> <87h7rm97js.fsf@nanos.tec.linutronix.de> <1601018323.28162.4.camel@mtksdccf07> Date: Fri, 25 Sep 2020 10:55:39 +0200 Message-ID: <87lfgyutf8.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Walter, On Fri, Sep 25 2020 at 15:18, Walter Wu wrote: > On Thu, 2020-09-24 at 23:41 +0200, Thomas Gleixner wrote: >> > For timers it has turned out to be useful to record the stack trace >> > of the timer init call. >> >> In which way? And what kind of bug does it catch which cannot be catched >> by existing debug mechanisms already? >> > We only provide another debug mechanisms to debug use-after-free or > double-free, it can be displayed together in KASAN report and have a > chance to debug, and it doesn't need to enable existing debug mechanisms > at the same time. then it has a chance to resolve issue. Again. KASAN can only cover UAF, but there are a dozen other ways to wreck the system with wrong usage of timers which can't be caught by KASAN. >> > Because if the UAF root cause is in timer init, then user can see >> > KASAN report to get where it is registered and find out the root >> > cause. >> >> What? If the UAF root cause is in timer init, then registering it after >> using it in that very same function is pretty pointless. >> > See [1], the call stack shows UAF happen at dummy_timer(), it is the > callback function and set by timer_setup(), if KASAN report shows the > timer call stack, it should be useful for programmer. The report you linked to has absolutely nothing to do with a timer related UAF. The timer callback calls kfree_skb() on something which is already freed. So the root cause of this is NOT in timer init as you claimed above. The timer callback is just exposing a problem in the URB management of this driver. IOW the recording of the timer init stack is completely useless for decoding this problem. >> There is a lot of handwaving how useful this is, but TBH I don't see the >> value at all. >> >> DEBUG_OBJECTS_TIMERS does a lot more than crashing on UAF. If KASAN >> provides additional value over DEBUG_OBJECTS_TIMERS then spell it out, >> but just saying that you don't need to enable DEBUG_OBJECTS_TIMERS is >> not making an argument for that change. >> > We don't want to replace DEBUG_OBJECTS_TIMERS with this patches, only > hope to use low overhead(compare with DEBUG_OBJECTS_TIMERS) to debug KASAN has lower overhead than DEBUG_OBJECTS_TIMERS? Maybe in a different universe. That said, I'm not opposed to the change per se, but without a sensible justification this is just pointless. Sprinkling kasan_foo() all over the place and claiming it's useful without a valid example does not provide any value. Quite the contrary it gives the completely wrong sense what KASAN can do and what not. Thanks, tglx