Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp764055ybe; Wed, 4 Sep 2019 07:25:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQTv0HheeugPrU5ZdPy2evLgG5rEqQwrH1S1w7XX/+wJBi26NSx/fsy7mErmuV9LwkOZeH X-Received: by 2002:a65:4243:: with SMTP id d3mr36382059pgq.119.1567607158556; Wed, 04 Sep 2019 07:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567607158; cv=none; d=google.com; s=arc-20160816; b=gsnMxtA9/tH1CeB39SOz9jIWtS99CrKwWo2JVuWI0kIMGa6Yt6XpKT+mRSXNow2p4N 5NDXYmKYrhENXpnyZjXit053YkNwXbY8L/wGz4TG1FUAvfhQ+PK/ps7v932lEuR/FvYW PlZkh3NVh53hZ7EJul/iDzRshd1A8Vu/60Wb3RBZp4SCS+qv0UljzLm8tDJqQ6XSPjFp CIlAZ+INTjPKBFoc4rukJftcUGfzAZyeAb6nzidwmD8ZmdpySz1A3ZDt0nsAIrDRq/aC /GrlKb5nBSrv5jK6MzQ51e9PNzrNkkwzfjV5YpoCc426AZc78lm9t1OO8cNdQCO7ni1T yP8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=3YK9g5CDB3lN/lNJ8sZoWbSZo72m0pwq+e0rl38A3Xo=; b=a/pKsA2b2sjUA+EEDnp/j5fU9RdSCtuLVaWzlunt7xOGbTsg8B/YL3Ck8qLZ4WWGmH 6/nMoBHvnS0pQCKMy6bQmZlqwnTniR/05DGb4gvApXEOzL266l7ijK8AEsaQiQIRFDLM Hi1RuxGwAGSjrxDhqki2fc0C3JHR2RCY9MpBlRUSIy/CyA3XlrvFnKDsFxZn/FgpbNfW tUgSpI/V7f3PMBXd7HBxi5TnPw5KqUeGdRGMVaweBHlDZWJgZKjM0B5eu5evkXr9w+rr kMGfL3ToFxdEKBqmximLs+iVabG+KAVUEOO+jZV90JMeQMW9cWX5l3HOC0GHOAYYlX5e dfuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14si17293157plo.47.2019.09.04.07.25.41; Wed, 04 Sep 2019 07:25:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730701AbfIDOYc (ORCPT + 99 others); Wed, 4 Sep 2019 10:24:32 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:42220 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729809AbfIDOYc (ORCPT ); Wed, 4 Sep 2019 10:24:32 -0400 X-UUID: fe267de637764d1c8c1e2ed01f75eca6-20190904 X-UUID: fe267de637764d1c8c1e2ed01f75eca6-20190904 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1751036984; Wed, 04 Sep 2019 22:24:26 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 4 Sep 2019 22:24:23 +0800 Received: from [172.21.84.99] (172.21.84.99) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 4 Sep 2019 22:24:22 +0800 Message-ID: <1567607063.32522.24.camel@mtksdccf07> Subject: Re: [PATCH 1/2] mm/kasan: dump alloc/free stack for page allocator From: Walter Wu To: Vlastimil Babka CC: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , Andrew Morton , "Martin Schwidefsky" , Arnd Bergmann , , , , , , Date: Wed, 4 Sep 2019 22:24:23 +0800 In-Reply-To: <7998e8f1-e5e2-da84-ea1f-33e696015dce@suse.cz> References: <20190904065133.20268-1-walter-zh.wu@mediatek.com> <401064ae-279d-bef3-a8d5-0fe155d0886d@suse.cz> <1567605965.32522.14.camel@mtksdccf07> <7998e8f1-e5e2-da84-ea1f-33e696015dce@suse.cz> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-09-04 at 16:13 +0200, Vlastimil Babka wrote: > On 9/4/19 4:06 PM, Walter Wu wrote: > > On Wed, 2019-09-04 at 14:49 +0200, Vlastimil Babka wrote: > >> On 9/4/19 8:51 AM, Walter Wu wrote: > >> > This patch is KASAN report adds the alloc/free stacks for page allocator > >> > in order to help programmer to see memory corruption caused by page. > >> > > >> > By default, KASAN doesn't record alloc/free stack for page allocator. > >> > It is difficult to fix up page use-after-free issue. > >> > > >> > This feature depends on page owner to record the last stack of pages. > >> > It is very helpful for solving the page use-after-free or out-of-bound. > >> > > >> > KASAN report will show the last stack of page, it may be: > >> > a) If page is in-use state, then it prints alloc stack. > >> > It is useful to fix up page out-of-bound issue. > >> > >> I expect this will conflict both in syntax and semantics with my series [1] that > >> adds the freeing stack to page_owner when used together with debug_pagealloc, > >> and it's now in mmotm. Glad others see the need as well :) Perhaps you could > >> review the series, see if it fulfils your usecase (AFAICS the series should be a > >> superset, by storing both stacks at once), and perhaps either make KASAN enable > >> debug_pagealloc, or turn KASAN into an alternative enabler of the functionality > >> there? > >> > >> Thanks, Vlastimil > >> > >> [1] https://lore.kernel.org/linux-mm/20190820131828.22684-1-vbabka@suse.cz/t/#u > >> > > Thanks your information. > > We focus on the smartphone, so it doesn't enable > > CONFIG_TRANSPARENT_HUGEPAGE, Is it invalid for our usecase? > > The THP fix is not required for the rest of the series, it was even merged to > mainline separately. > > > And It looks like something is different, because we only need last > > stack of page, so it can decrease memory overhead. > > That would save you depot_stack_handle_t (which is u32) per page. I guess that's > nothing compared to KASAN overhead? > If we can use less memory, we can achieve what we want. Why not? Thanks. Walter