From: Qian Cai <cai@lca.pw>
To: Vlastimil Babka <vbabka@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kasan-dev@googlegroups.com,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Matthew Wilcox <willy@infradead.org>,
Mel Gorman <mgorman@techsingularity.net>,
Michal Hocko <mhocko@kernel.org>,
Dmitry Vyukov <dvyukov@google.com>,
Walter Wu <walter-zh.wu@mediatek.com>,
Andrey Ryabinin <aryabinin@virtuozzo.com>
Subject: Re: [PATCH v2 2/3] mm, page_owner: decouple freeing stack trace from debug_pagealloc
Date: Mon, 30 Sep 2019 08:49:47 -0400 [thread overview]
Message-ID: <1569847787.5576.244.camel@lca.pw> (raw)
In-Reply-To: <20190930122916.14969-3-vbabka@suse.cz>
On Mon, 2019-09-30 at 14:29 +0200, Vlastimil Babka wrote:
> The commit 8974558f49a6 ("mm, page_owner, debug_pagealloc: save and dump
> freeing stack trace") enhanced page_owner to also store freeing stack trace,
> when debug_pagealloc is also enabled. KASAN would also like to do this [1] to
> improve error reports to debug e.g. UAF issues. Kirill has suggested that the
> freeing stack trace saving should be also possible to be enabled separately.
>
> This patch therefore introduces a new kernel parameter page_owner_free to
> enable the functionality in addition to the existing page_owner parameter.
> The free stack saving is thus enabled in these cases:
> 1) booting with page_owner=on and debug_pagealloc=on
> 2) booting a KASAN kernel with page_owner=on
> 3) booting with page_owner=on and page_owner_free=on
>
> To minimize runtime CPU and memory overhead when not boot-time enabled, the
> patch introduces a new static key and struct page_ext_operations.
>
> [1] https://bugzilla.kernel.org/show_bug.cgi?id=203967
>
> Suggested-by: Dmitry Vyukov <dvyukov@google.com>
> Suggested-by: Walter Wu <walter-zh.wu@mediatek.com>
> Suggested-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Suggested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> .../admin-guide/kernel-parameters.txt | 8 ++
> Documentation/dev-tools/kasan.rst | 3 +
> include/linux/page_owner.h | 1 +
> mm/page_ext.c | 1 +
> mm/page_owner.c | 90 +++++++++++++------
> 5 files changed, 78 insertions(+), 25 deletions(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 944e03e29f65..14dcb66e3457 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -3237,6 +3237,14 @@
> we can turn it on.
> on: enable the feature
>
> + page_owner_free=
> + [KNL] When enabled together with page_owner, store also
> + the stack of who frees a page, for error page dump
> + purposes. This is also implicitly enabled by
> + debug_pagealloc=on or KASAN, so only page_owner=on is
> + sufficient in those cases.
> + on: enable the feature
> +
If users are willing to set page_owner=on, what prevent them from enabling KASAN
as well? That way, we don't need this additional parameter. I read that KASAN
supposes to be semi-production use ready, so the overhead is relatively low.
There is even a choice to have KASAN_SW_TAGS on arm64 to work better with small
devices.
next prev parent reply other threads:[~2019-09-30 12:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-30 12:29 [PATCH v2 0/3] followups to debug_pagealloc improvements through page_owner Vlastimil Babka
2019-09-30 12:29 ` [PATCH v2 1/3] mm, page_owner: fix off-by-one error in __set_page_owner_handle() Vlastimil Babka
2019-09-30 12:29 ` [PATCH v2 2/3] mm, page_owner: decouple freeing stack trace from debug_pagealloc Vlastimil Babka
2019-09-30 12:49 ` Qian Cai [this message]
2019-09-30 21:39 ` Vlastimil Babka
2019-09-30 23:49 ` Qian Cai
2019-10-01 8:07 ` Vlastimil Babka
2019-10-01 11:51 ` Kirill A. Shutemov
2019-10-01 12:26 ` Qian Cai
2019-10-01 12:31 ` Kirill A. Shutemov
2019-10-01 12:32 ` Vlastimil Babka
2019-10-01 12:35 ` Vlastimil Babka
2019-10-01 13:18 ` Qian Cai
2019-10-01 14:15 ` Vlastimil Babka
2019-10-01 11:35 ` Kirill A. Shutemov
2019-09-30 12:29 ` [PATCH v2 3/3] mm, page_owner: rename flag indicating that page is allocated Vlastimil Babka
2019-09-30 12:49 ` Vlastimil Babka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1569847787.5576.244.camel@lca.pw \
--to=cai@lca.pw \
--cc=akpm@linux-foundation.org \
--cc=aryabinin@virtuozzo.com \
--cc=dvyukov@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@kernel.org \
--cc=vbabka@suse.cz \
--cc=walter-zh.wu@mediatek.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox