Re: [PATCH v2 2/3] mm, page_owner: decouple freeing stack trace from debug_pagealloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> Suggested-by: Walter Wu <walter-zh.wu@xxxxxxxxxxxx>
> Suggested-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
> Suggested-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
>  .../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.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux