From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DC5CC47084 for ; Tue, 25 May 2021 08:09:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C91EA613F9 for ; Tue, 25 May 2021 08:09:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C91EA613F9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6D38E6B006E; Tue, 25 May 2021 04:09:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 683806B0070; Tue, 25 May 2021 04:09:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5002B6B0071; Tue, 25 May 2021 04:09:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 151EB6B006E for ; Tue, 25 May 2021 04:09:34 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AD2E48249980 for ; Tue, 25 May 2021 08:09:33 +0000 (UTC) X-FDA: 78179029026.10.C5331D0 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf30.hostedemail.com (Postfix) with ESMTP id A5C8BE0001B4 for ; Tue, 25 May 2021 08:09:28 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1621930172; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=X4K/eFCPs5ZyC3dq4RSvLq5Boc7xvE8slnEIPMBZGpw=; b=c1s1plU6q0xrLR+wXrLfQf62Fs8wZWwnwCoO9eX9RbnlSx1ytXiGg2P44Npq03wQ028FsM Pgv6/QpacFC/f/qRjUIhAlTYPlbJPDo7MUvqlxT5zDg/PV6Gcp2Al6e1IaSae4vwoLAj9n ora26UMWYB1ymnK3BrlQj4iK8b3K/3s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1621930172; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=X4K/eFCPs5ZyC3dq4RSvLq5Boc7xvE8slnEIPMBZGpw=; b=ADAQcDeXbTkMZE5JillIUtK1huQAY3rN8g/TrXwlUJb8X94NEHSD8dKdcBd+3MMfXW6E6n Y++137sQrMpl4cBw== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CBAC5AEBD; Tue, 25 May 2021 08:09:31 +0000 (UTC) Date: Tue, 25 May 2021 10:09:27 +0200 From: Oscar Salvador To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, Andrew Morton , "Michael S. Tsirkin" , Jason Wang , Alexey Dobriyan , Mike Rapoport , "Matthew Wilcox (Oracle)" , Michal Hocko , Roman Gushchin , Alex Shi , Steven Price , Mike Kravetz , Aili Yao , Jiri Bohac , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Naoya Horiguchi , linux-hyperv@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport Subject: Re: [PATCH v2 3/6] fs/proc/kcore: don't read offline sections, logically offline pages and hwpoisoned pages Message-ID: <20210525080922.GA3300@linux> References: <20210514172247.176750-1-david@redhat.com> <20210514172247.176750-4-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210514172247.176750-4-david@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=c1s1plU6; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ADAQcDeX; spf=pass (imf30.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.15 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: A5C8BE0001B4 X-Stat-Signature: ri9xzc1e5t9ug7cq4px6fbicm8baqt1d X-HE-Tag: 1621930168-64910 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, May 14, 2021 at 07:22:44PM +0200, David Hildenbrand wrote: > Let's avoid reading: > > 1) Offline memory sections: the content of offline memory sections is stale > as the memory is effectively unused by the kernel. On s390x with standby > memory, offline memory sections (belonging to offline storage > increments) are not accessible. With virtio-mem and the hyper-v balloon, > we can have unavailable memory chunks that should not be accessed inside > offline memory sections. Last but not least, offline memory sections > might contain hwpoisoned pages which we can no longer identify > because the memmap is stale. > > 2) PG_offline pages: logically offline pages that are documented as > "The content of these pages is effectively stale. Such pages should not > be touched (read/write/dump/save) except by their owner.". > Examples include pages inflated in a balloon or unavailble memory > ranges inside hotplugged memory sections with virtio-mem or the hyper-v > balloon. > > 3) PG_hwpoison pages: Reading pages marked as hwpoisoned can be fatal. > As documented: "Accessing is not safe since it may cause another machine > check. Don't touch!" > > Introduce is_page_hwpoison(), adding a comment that it is inherently > racy but best we can really do. > > Reading /proc/kcore now performs similar checks as when reading > /proc/vmcore for kdump via makedumpfile: problematic pages are exclude. > It's also similar to hibernation code, however, we don't skip hwpoisoned > pages when processing pages in kernel/power/snapshot.c:saveable_page() yet. > > Note 1: we can race against memory offlining code, especially > memory going offline and getting unplugged: however, we will properly tear > down the identity mapping and handle faults gracefully when accessing > this memory from kcore code. > > Note 2: we can race against drivers setting PageOffline() and turning > memory inaccessible in the hypervisor. We'll handle this in a follow-up > patch. > > Reviewed-by: Mike Rapoport > Signed-off-by: David Hildenbrand Reviewed-by: Oscar Salvador -- Oscar Salvador SUSE L3