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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D000C433EF for ; Mon, 2 May 2022 17:33:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C4B76B0071; Mon, 2 May 2022 13:33:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 973386B0073; Mon, 2 May 2022 13:33:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 815166B0074; Mon, 2 May 2022 13:33:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 737EB6B0071 for ; Mon, 2 May 2022 13:33:23 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9704221334 for ; Mon, 2 May 2022 17:33:22 +0000 (UTC) X-FDA: 79421499444.14.D4715DA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf24.hostedemail.com (Postfix) with ESMTP id AE654180091 for ; Mon, 2 May 2022 17:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651512801; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u436EdTpCFoX6i5ZzJ27e67HB5OPbaZ9XCIwWewLzJ8=; b=AsOIa+VM4pLC2fn0gL4dgddHq/kRXbmDsWhGK5j5tQy+6Du/jh2LefFzNsvx3TvMg3dnzt t7rX0OpUtd3TeNJh4kHrWvSo+BMkUxGn+YSl50tFfloGRy+Yxw9Qo7u7ZOat1AQ3zDCnp+ 84mGtrp3YO5QCA/n5O6PwRa13HXwCdo= Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-374-YUGzSIAhMOiKmpgtU8BjJQ-1; Mon, 02 May 2022 13:33:20 -0400 X-MC-Unique: YUGzSIAhMOiKmpgtU8BjJQ-1 Received: by mail-oo1-f70.google.com with SMTP id r25-20020a4abf19000000b0035e9d44514dso8185796oop.0 for ; Mon, 02 May 2022 10:33:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=u436EdTpCFoX6i5ZzJ27e67HB5OPbaZ9XCIwWewLzJ8=; b=Ecmtk9pWg/nD0Ls9iRNi4szK7AVuYcfZqGyuwKuXW96iOik6nOoff3iss+oinBqExF 9jKkYzgF/TcSJj3/Ow2DvHuyz6b/Zz2h1raLXhyaPHkXT+KSiI42LDi1yhWtvzzhaGQh MQd1n1v/PE5yL+uxZK+aBbT0LN8HuRA+FYRiyzwZoR6Lqtmp/U5TNJswVu4guksPGCdP rbZYwr8aN1unHUUytSC0bdHfShXf5j0AfAJUdTNVcY5LDta+kKWPYo0UGAW7PF4o1WmM p9iO7UZygdzK2GnHM2R8RUOnGVzT/wgMdS7C6pUvvtqlS3jshyre3lREiiQAa8AqS60r FmTA== X-Gm-Message-State: AOAM5301wRiwZCDAfRRkPZH7KJoDCCJ4yF6NfGxhF4tFq1c9zIMD/AvL I6VmqBf9ZoAVuXMbhABdGt8ON9woRWnE/BaJgrCmFDWUVd9yf/o7wC7GPCNLoBga1tBJff5Xlct FtLRx/7cgsEw= X-Received: by 2002:a05:6830:34a9:b0:606:2f33:2375 with SMTP id c41-20020a05683034a900b006062f332375mr509307otu.363.1651512799890; Mon, 02 May 2022 10:33:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhAdWNYNK+xOU6gLN/1IuRZVJquzWH5yx22yYOND9TW+4OPPV08/KBtBBHnCD7NFWyB/39Ew== X-Received: by 2002:a05:6830:34a9:b0:606:2f33:2375 with SMTP id c41-20020a05683034a900b006062f332375mr509293otu.363.1651512799597; Mon, 02 May 2022 10:33:19 -0700 (PDT) Received: from [10.10.69.234] ([8.34.116.185]) by smtp.gmail.com with ESMTPSA id q8-20020a0568080ec800b00325cda1ffa3sm2589571oiv.34.2022.05.02.10.33.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 May 2022 10:33:18 -0700 (PDT) Message-ID: <2b1d3a10-4a23-3787-dcfa-44f05554688c@redhat.com> Date: Mon, 2 May 2022 19:33:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [RFC] Expose a memory poison detector ioctl to user space. To: Jue Wang Cc: Dave Hansen , Naoya Horiguchi , Tony Luck , Dave Hansen , Jiaqi Yan , Greg Thelen , Mina Almasry , linux-mm@kvack.org, Sean Christopherson References: <20220425163451.3818838-1-juew@google.com> <5a7f00e3-311d-b5ca-4249-7f50f8712559@intel.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: ugu4b1z8andzxg44ba4qhkoxgke7yhdn X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: AE654180091 X-Rspam-User: Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=AsOIa+VM; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf24.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1651512796-548900 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 02.05.22 19:30, Jue Wang wrote: > On Mon, May 2, 2022 at 10:19 AM David Hildenbrand wrote: >> >> On 26.04.22 21:39, Dave Hansen wrote: >>> On 4/26/22 12:23, Jue Wang wrote: >>>> On Tue, Apr 26, 2022 at 11:18 AM Dave Hansen wrote: >>>>> What if you're in a normal (non-TDX) guest and some of the physical >>>>> address space has been ballooned away? >>>> >>>> Accessing to memory that gets ballooned away will cause extra EPT >>>> violations and have the memory faulted in on the host side, which is >>>> transparent to the guest. >>> >>> Yeah, but it completely subverts the whole purpose of ballooning. In >>> other words, this is for all intents and purposes also mutually >>> exclusive with ballooning. >> >> Some balloon (or balloon-like) implementations don't support reading >> memory that's mapped into the direct map. For example, with never >> virtio-mem devices in the hypervisor, reading unplugged memory can >> result in undefined behavior (in the worst case, you'll get your VM zapped). >> >> Reading random physical memory ranges without further checks is a very >> bad idea. There are more corner cases, that we e.g., exclude when >> reading /proc/kcore. >> >> Take a look at read_kcore() KCORE_RAM case, where we e.g., exclude >> reading PageOffline(), is_page_hwpoison() and !pfn_is_ram(). Unaccepted >> memory might be another case we want to exclude there in the future. >> >> >> I assume something as you imagine could be implemented in user space >> just by relying on /proc/iomem and /proc/kcore right now in an unsafe >> way. So you might want something similar, however, obviously without >> exporting page content to user space and requiring root permissions. > > Thanks. > > Are the following cases benign if the scan only happens on the host side? > > . virtio-mem - unplugged memory > . Unaccepted memory No, only in virtualized worlds. I assume GART memory that implements the pfn_is_ram() callback is around on physical machines. -- Thanks, David / dhildenb