From: Nikolay Borisov <nik.borisov@suse.com>
To: Dan Williams <dan.j.williams@intel.com>, dave.hansen@linux.intel.com
Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>,
Vishal Annapurve <vannapurve@google.com>,
Kees Cook <kees@kernel.org>,
stable@vger.kernel.org, x86@kernel.org,
Naveen N Rao <naveen@kernel.org>, Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev
Subject: Re: [PATCH v3 0/2] Restrict devmem for confidential VMs
Date: Tue, 22 Apr 2025 17:09:24 +0300 [thread overview]
Message-ID: <99902694-65b0-4c0b-bc71-b082efb15625@suse.com> (raw)
In-Reply-To: <174491711228.1395340.3647010925173796093.stgit@dwillia2-xfh.jf.intel.com>
On 17.04.25 г. 22:11 ч., Dan Williams wrote:
> Changes since v2 [1]:
> * Drop the new x86_platform_op and just use
> cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT) directly where needed
> (Naveen)
> * Make the restriction identical to lockdown and stop playing games with
> devmem_is_allowed()
> * Ensure that CONFIG_IO_STRICT_DEVMEM is enabled to avoid conflicting
> mappings for userspace mappings of PCI MMIO.
>
> The original response to Nikolay's report of an SEPT violation triggered
> by /dev/mem access to private memory was "let's just turn off /dev/mem".
>
> After some machinations of x86_platform_ops to block a subset of
> problematic access, spelunking the history of devmem_is_allowed()
> returning "2" to enable some compatibility benefits while blocking
> access, and discovering that userspace depends buggy kernel behavior for
> mmap(2) of the first 1MB of memory on x86, the proposal has circled back
> to "disable /dev/mem".
>
> Require both STRICT_DEVMEM and IO_STRICT_DEVMEM for x86 confidential
> guests to close /dev/mem hole while still allowing for userspace
> mapping of PCI MMIO as long as the kernel and userspace are not mapping
> the range at the same time.
>
> The range_is_allowed() cleanup is not strictly necessary, but might as
> well close a 17 year-old "TODO".
>
> ---
>
> Dan Williams (2):
> x86/devmem: Remove duplicate range_is_allowed() definition
> x86/devmem: Drop /dev/mem access for confidential guests
>
>
> arch/x86/Kconfig | 4 ++++
> arch/x86/mm/pat/memtype.c | 31 ++++---------------------------
> drivers/char/mem.c | 27 +++++++++------------------
> include/linux/io.h | 21 +++++++++++++++++++++
> 4 files changed, 38 insertions(+), 45 deletions(-)
>
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
next prev parent reply other threads:[~2025-04-22 14:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-17 19:11 [PATCH v3 0/2] Restrict devmem for confidential VMs Dan Williams
2025-04-17 19:12 ` [PATCH v3 1/2] x86/devmem: Remove duplicate range_is_allowed() definition Dan Williams
2025-04-17 19:30 ` Dave Hansen
2025-04-17 19:12 ` [PATCH v3 2/2] x86/devmem: Drop /dev/mem access for confidential guests Dan Williams
2025-04-17 19:33 ` Dave Hansen
2025-04-17 22:31 ` kernel test robot
2025-04-17 23:24 ` kernel test robot
2025-04-18 20:04 ` [PATCH v4 " Dan Williams
2025-04-22 13:38 ` Nikolay Borisov
2025-04-23 17:18 ` Naveen N Rao
2025-04-23 20:36 ` Dan Williams
2025-04-24 6:35 ` Naveen N Rao
2025-04-28 15:53 ` Dave Hansen
2025-04-28 16:30 ` Jianxiong Gao
2025-04-28 16:36 ` Dave Hansen
2025-05-07 5:44 ` [PATCH v3 " kernel test robot
2025-04-22 14:09 ` Nikolay Borisov [this message]
2025-04-28 15:50 ` [PATCH v3 0/2] Restrict devmem for confidential VMs Dave Hansen
2025-04-28 22:48 ` Dan Williams
2025-04-29 0:37 ` Dave Hansen
2025-04-30 15:41 ` Suzuki K Poulose
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=99902694-65b0-4c0b-bc71-b082efb15625@suse.com \
--to=nik.borisov@suse.com \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=kees@kernel.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=naveen@kernel.org \
--cc=stable@vger.kernel.org \
--cc=vannapurve@google.com \
--cc=x86@kernel.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