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]
Date:   Wed, 25 May 2022 04:53:49 +0000
From:   HORIGUCHI NAOYA(堀口 直也) 
        <naoya.horiguchi@....com>
To:     Miaohe Lin <linmiaohe@...wei.com>
CC:     "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "hughd@...gle.com" <hughd@...gle.com>,
        "willy@...radead.org" <willy@...radead.org>,
        "vbabka@...e.cz" <vbabka@...e.cz>,
        "dhowells@...hat.com" <dhowells@...hat.com>,
        "neilb@...e.de" <neilb@...e.de>,
        "apopple@...dia.com" <apopple@...dia.com>,
        "david@...hat.com" <david@...hat.com>,
        "surenb@...gle.com" <surenb@...gle.com>,
        "peterx@...hat.com" <peterx@...hat.com>,
        "rcampbell@...dia.com" <rcampbell@...dia.com>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 5/5] mm: filter out swapin error entry in shmem mapping

On Thu, May 19, 2022 at 08:50:30PM +0800, Miaohe Lin wrote:
> There might be swapin error entries in shmem mapping. Filter them out to
> avoid "Bad swap file entry" complaint.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> ---
>  mm/madvise.c    | 5 ++++-
>  mm/swap_state.c | 3 +++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/madvise.c b/mm/madvise.c
> index a42165bc4735..31582b6ff551 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -248,10 +248,13 @@ static void force_shm_swapin_readahead(struct vm_area_struct *vma,
>  
>  		if (!xa_is_value(page))
>  			continue;
> +		swap = radix_to_swp_entry(page);
> +		/* There might be swapin error entries in shmem mapping. */
> +		if (non_swap_entry(swap))
> +			continue;

The inline comment mentions swapin error entries but other types of
non-swap entries should be skipped by this check, which is helpful too.
So I'm fine with the change, thank you.

Reviewed-by: Naoya Horiguchi <naoya.horiguchi@....com>

>  		xas_pause(&xas);
>  		rcu_read_unlock();
>  
> -		swap = radix_to_swp_entry(page);
>  		page = read_swap_cache_async(swap, GFP_HIGHUSER_MOVABLE,
>  					     NULL, 0, false, &splug);
>  		if (page)
> diff --git a/mm/swap_state.c b/mm/swap_state.c
> index b9e4ed2e90bf..778d57d2d92d 100644
> --- a/mm/swap_state.c
> +++ b/mm/swap_state.c
> @@ -410,6 +410,9 @@ struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index)
>  		return NULL;
>  
>  	swp = radix_to_swp_entry(page);
> +	/* There might be swapin error entries in shmem mapping. */
> +	if (non_swap_entry(swp))
> +		return NULL;
>  	/* Prevent swapoff from happening to us */
>  	si = get_swap_device(swp);
>  	if (!si)
> -- 
> 2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ