From: "Huang\, Ying" <ying.huang@intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, Matthew Wilcox <mawilcox@microsoft.com>
Subject: Re: [PATCH] mm: Report bad PTEs in lookup_swap_cache()
Date: Sat, 24 Feb 2018 08:49:26 +0800 [thread overview]
Message-ID: <87zi3z2ovd.fsf@yhuang-dev.intel.com> (raw)
In-Reply-To: <20180223200341.17627-1-willy@infradead.org> (Matthew Wilcox's message of "Fri, 23 Feb 2018 12:03:41 -0800")
Matthew Wilcox <willy@infradead.org> writes:
> From: Matthew Wilcox <mawilcox@microsoft.com>
>
> If we have garbage in the PTE, we can call the radix tree code with a
> NULL radix tree head which leads to an OOPS. Detect the case where
> we've found a PTE that refers to a non-existent swap device and report
> the error correctly.
There is a patch in -mm tree which addresses this problem at least
partially as follow. Please take a look at it.
https://www.spinics.net/lists/linux-mm/msg145242.html
[snip]
> diff --git a/mm/swap_state.c b/mm/swap_state.c
> index 39ae7cfad90f..5a7755ecbb03 100644
> --- a/mm/swap_state.c
> +++ b/mm/swap_state.c
> @@ -328,14 +328,22 @@ void free_pages_and_swap_cache(struct page **pages, int nr)
> * lock getting page table operations atomic even if we drop the page
> * lock before returning.
> */
> -struct page *lookup_swap_cache(swp_entry_t entry, struct vm_area_struct *vma,
> - unsigned long addr)
> +struct page *lookup_swap_cache(swp_entry_t entry, bool vma_ra,
> + struct vm_fault *vmf)
> {
> struct page *page;
> - unsigned long ra_info;
> - int win, hits, readahead;
> + int readahead;
> + struct address_space *swapper_space = swap_address_space(entry);
>
> - page = find_get_page(swap_address_space(entry), swp_offset(entry));
> + if (!swapper_space) {
> + if (vmf)
> + pte_ERROR(vmf->orig_pte);
> + else
> + pr_err("Bad swp_entry: %lx\n", entry.val);
>From we get swap_entry from PTE to lookup_swap_cache(), nothing prevent
the swap device to be swapoff. So, I think sometimes it is hard to
distinguish between garbage PTEs and PTEs which become deprecated
because of swapoff.
Best Regards,
Huang, Ying
> + return NULL;
> + }
> +
> + page = find_get_page(swapper_space, swp_offset(entry));
>
> INC_CACHE_INFO(find_total);
> if (page) {
[snip]
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2018-02-24 0:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-23 20:03 [PATCH] mm: Report bad PTEs in lookup_swap_cache() Matthew Wilcox
2018-02-24 0:49 ` Huang, Ying [this message]
2018-02-25 4:43 ` kbuild test robot
2018-02-25 6:27 ` kbuild test robot
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=87zi3z2ovd.fsf@yhuang-dev.intel.com \
--to=ying.huang@intel.com \
--cc=linux-mm@kvack.org \
--cc=mawilcox@microsoft.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;
as well as URLs for NNTP newsgroup(s).