[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3a37361d-1f3b-c283-3fb0-ab3614e3d38c@redhat.com>
Date: Tue, 12 Sep 2023 09:13:04 +0200
From: David Hildenbrand <david@...hat.com>
To: Adrian Hunter <adrian.hunter@...el.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Borislav Petkov <bp@...en8.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Ard Biesheuvel <ardb@...nel.org>
Cc: Dave Hansen <dave.hansen@...el.com>,
Vlastimil Babka <vbabka@...e.cz>,
Mike Rapoport <rppt@...ux.ibm.com>,
Lorenzo Stoakes <lstoakes@...il.com>,
Tom Lendacky <thomas.lendacky@....com>,
Baoquan He <bhe@...hat.com>, Vivek Goyal <vgoyal@...hat.com>,
Dave Young <dyoung@...hat.com>, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-coco@...ts.linux.dev, linux-efi@...r.kernel.org,
kexec@...ts.infradead.org
Subject: Re: [PATCH V2 2/2] proc/kcore: Do not try to access unaccepted memory
On 11.09.23 13:21, Adrian Hunter wrote:
> Support for unaccepted memory was added recently, refer commit
> dcdfdd40fa82 ("mm: Add support for unaccepted memory"), whereby a virtual
> machine may need to accept memory before it can be used.
>
> Do not try to access unaccepted memory because it can cause the guest to
> fail.
>
> For /proc/kcore, which is read-only and does not support mmap, this means a
> read of unaccepted memory will return zeros.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
> fs/proc/kcore.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>
> Changes in V2:
>
> Change patch subject and commit message
> Do not open code pfn_is_unaccepted_memory()
>
>
> diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
> index 23fc24d16b31..6422e569b080 100644
> --- a/fs/proc/kcore.c
> +++ b/fs/proc/kcore.c
> @@ -546,7 +546,8 @@ static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter)
> * and explicitly excluded physical ranges.
> */
> if (!page || PageOffline(page) ||
> - is_page_hwpoison(page) || !pfn_is_ram(pfn)) {
> + is_page_hwpoison(page) || !pfn_is_ram(pfn) ||
> + pfn_is_unaccepted_memory(pfn)) {
> if (iov_iter_zero(tsz, iter) != tsz) {
> ret = -EFAULT;
> goto out;
Reviewed-by: David Hildenbrand <david@...hat.com>
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists