lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191114135948.GB1356@dhcp22.suse.cz>
Date:   Thu, 14 Nov 2019 14:59:48 +0100
From:   Michal Hocko <mhocko@...nel.org>
To:     Ralph Campbell <rcampbell@...dia.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/debug: PageAnon() is true for PageKsm() pages

On Tue 12-11-19 16:06:51, Ralph Campbell wrote:
> PageAnon() and PageKsm() use the low two bits of the page->mapping pointer
> to indicate the page type. PageAnon() only checks the LSB while PageKsm()
> checks the least significant 2 bits are equal to 3. Therefore, PageAnon()
> is true for KSM pages.
> __dump_page() incorrectly will never print "ksm" because it checks
> PageAnon() first. Fix this by checking PageKsm() first.

Thanks for spotting this

Fixes: 1c6fb1d89e73 ("mm: print more information about mapping in __dump_page")

> Signed-off-by: Ralph Campbell <rcampbell@...dia.com>

Acked-by: Michal Hocko <mhocko@...e.com>

> ---
>  mm/debug.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/debug.c b/mm/debug.c
> index 772d4cf0691f..0461df1207cb 100644
> --- a/mm/debug.c
> +++ b/mm/debug.c
> @@ -77,10 +77,10 @@ void __dump_page(struct page *page, const char *reason)
>  		pr_warn("page:%px refcount:%d mapcount:%d mapping:%px index:%#lx\n",
>  			page, page_ref_count(page), mapcount,
>  			page->mapping, page_to_pgoff(page));
> -	if (PageAnon(page))
> -		pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags);
> -	else if (PageKsm(page))
> +	if (PageKsm(page))
>  		pr_warn("ksm flags: %#lx(%pGp)\n", page->flags, &page->flags);
> +	else if (PageAnon(page))
> +		pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags);
>  	else if (mapping) {
>  		if (mapping->host && mapping->host->i_dentry.first) {
>  			struct dentry *dentry;
> -- 
> 2.20.1

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ