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] [day] [month] [year] [list]
Message-ID: <1c693242-9d64-a730-6590-b7b8180ccfc6@redhat.com>
Date:   Mon, 16 Sep 2019 09:41:57 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Oscar Salvador <osalvador@...e.de>, n-horiguchi@...jp.nec.com
Cc:     mhocko@...nel.org, mike.kravetz@...cle.com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 03/10] mm,hwpoison-inject: don't pin for hwpoison_filter

On 10.09.19 12:30, Oscar Salvador wrote:
> From: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
> 
> Another memory error injection interface debugfs:hwpoison/corrupt-pfn
> also takes bogus refcount for hwpoison_filter(). It's justified
> because this does a coarse filter, expecting that memory_failure()
> redoes the check for sure.
> 
> Signed-off-by: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
> Signed-off-by: Oscar Salvador <osalvador@...e.de>
> ---
>  mm/hwpoison-inject.c | 18 +++++-------------
>  1 file changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c
> index 5b7430bd83a6..0c8cdb80fd7d 100644
> --- a/mm/hwpoison-inject.c
> +++ b/mm/hwpoison-inject.c
> @@ -26,11 +26,6 @@ static int hwpoison_inject(void *data, u64 val)
>  
>  	p = pfn_to_page(pfn);
>  	hpage = compound_head(p);
> -	/*
> -	 * This implies unable to support free buddy pages.
> -	 */
> -	if (!get_hwpoison_page(p))
> -		return 0;
>  
>  	if (!hwpoison_filter_enable)
>  		goto inject;
> @@ -40,23 +35,20 @@ static int hwpoison_inject(void *data, u64 val)
>  	 * This implies unable to support non-LRU pages.
>  	 */
>  	if (!PageLRU(hpage) && !PageHuge(p))
> -		goto put_out;
> +		return 0;
>  
>  	/*
> -	 * do a racy check with elevated page count, to make sure PG_hwpoison
> -	 * will only be set for the targeted owner (or on a free page).
> +	 * do a racy check to make sure PG_hwpoison will only be set for
> +	 * the targeted owner (or on a free page).
>  	 * memory_failure() will redo the check reliably inside page lock.
>  	 */
>  	err = hwpoison_filter(hpage);
>  	if (err)
> -		goto put_out;
> +		return 0;
>  
>  inject:
>  	pr_info("Injecting memory failure at pfn %#lx\n", pfn);
> -	return memory_failure(pfn, MF_COUNT_INCREASED);
> -put_out:
> -	put_hwpoison_page(p);
> -	return 0;
> +	return memory_failure(pfn, 0);
>  }
>  
>  static int hwpoison_unpoison(void *data, u64 val)
> 

After this change, get_hwpoison_page() is only used in
mm/memory-failure.c - you might be able to un-export it and make it static.

-- 

Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ