Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp751240ybe; Wed, 4 Sep 2019 07:15:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPCGYEO8rnr/WH6V5EaalvsI/GvPwTDmzJ2DuPgwhNkn2Eg4Zsp6X2VRkwBGolIoD4QF79 X-Received: by 2002:a17:902:9001:: with SMTP id a1mr4484435plp.28.1567606516158; Wed, 04 Sep 2019 07:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567606516; cv=none; d=google.com; s=arc-20160816; b=mYbvtF36C0rxB40dSThZAoWIL4V6jJXe9OmKSse89EouYIZrZzzSseyDnX8iw5L6ff zvzCu6IBDl6kC9Ozf16cuqJd487uTz6onXe6OFqD7nXOYJp7r2eT2J3IewXgL5e8zwyh OYtKJE0WJcBFIcXG5chSSYChWivvoKxe6I2u+VrDPL5IlIEPsP8/kuSFHiwHIOrKB9yK 8iQrz9y2WwzuHoT2rTCN5tl6ijMJQStyEPEnCqkiimPZLKeRpxT7n5e1d4TQLTxrvhtj pzdw+ZPiazDsQbrgTcf/9aHqWFBCJcmTF73m9ukA8KRShfy+UWYJh+yNa54lBIOyf18q nJfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=GoXykA/lVU4T5iNkVo59Bw1Rmk7YYxqAlGL+xi7EDrE=; b=lmPtnsxr77aOM3tLV3HCr/xJMiqOx2tM/G4FXaH+OB/69d9Qo82mW5eqWitzpbihnR dzOdgTDPEuN+TgiLFRi4YqU+caDwdQqyMVBZ4WIv/ol8xunwvti7frjDHgd+QUOwj1Sn lC52G3MQhcyMwb4V4VbTpzN7stVout9Gcx+aaIGyJr7FhibyfvUcAY8NdLTJpxqoRFbK wd7jAza/65p91nnbP5LsR3/qDSVLdKNNjKsM0eYi/JhZLJohnosyaJqEQlJPCRunfBKf OznfLBmqd7DfuaZfc/I0nULRNUL607t4QCMHLMjkGPIluOMlqjNo1XMSjesM3ViA5dp3 Kk6Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si20879565pfe.163.2019.09.04.07.14.59; Wed, 04 Sep 2019 07:15:16 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730755AbfIDONw (ORCPT + 99 others); Wed, 4 Sep 2019 10:13:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:35620 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730670AbfIDONu (ORCPT ); Wed, 4 Sep 2019 10:13:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8F3D1B048; Wed, 4 Sep 2019 14:13:49 +0000 (UTC) Subject: Re: [PATCH 1/2] mm/kasan: dump alloc/free stack for page allocator To: Walter Wu Cc: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , Andrew Morton , Martin Schwidefsky , Arnd Bergmann , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, wsd_upstream@mediatek.com References: <20190904065133.20268-1-walter-zh.wu@mediatek.com> <401064ae-279d-bef3-a8d5-0fe155d0886d@suse.cz> <1567605965.32522.14.camel@mtksdccf07> From: Vlastimil Babka Message-ID: <7998e8f1-e5e2-da84-ea1f-33e696015dce@suse.cz> Date: Wed, 4 Sep 2019 16:13:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1567605965.32522.14.camel@mtksdccf07> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > I will try to enable debug_pagealloc(with your patch) and KASAN, then we > see the result. Thanks. > Thanks. > Walter >