From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Nikolay Borisov" <nik.borisov@suse.com>, x86@kernel.org
Cc: naveen@kernel.org, "Dan Williams" <dan.j.williams@intel.com>,
"Kees Cook" <kees@kernel.org>, "Ingo Molnar" <mingo@kernel.org>,
"Vishal Annapurve" <vannapurve@google.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Suzuki K Poulose" <suzuki.poulose@arm.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v3] x86/devmem: Drop /dev/mem access for confidential guests
Date: Wed, 02 Dec 2026 14:59:53 +0100 [thread overview]
Message-ID: <1faed4b6-2f4e-473a-a5fb-90f33ca190eb@app.fastmail.com> (raw)
In-Reply-To: <20261130120003.136771-1-nik.borisov@suse.com>
On Mon, 30 Nov 2026, at 13:00, Nikolay Borisov wrote:
> From: Dan Williams <dan.j.williams@intel.com>
>
> Nikolay reports that accessing BIOS data (first 1MB of the physical
> address space) via /dev/mem results in a "crash" / terminated VM
> (unhandled SEPT violation). See report [1] for details.
>
> The cause is ioremap() (via xlate_dev_mem_ptr()) establishes an
> unencrypted mapping where the kernel had established an encrypted
> mapping previously. The CPU enforces mapping consistency with a fault
> upon detecting a mismatch. A similar situation arises with devmem access
> to "unaccepted" confidential memory. In summary, it is fraught to allow
> uncoordinated userspace mapping of confidential memory.
>
> While there is an existing mitigation to simulate and redirect access to
> the BIOS data area with STRICT_DEVMEM=y, it is insufficient.
> Specifically, STRICT_DEVMEM=y traps read(2) access to the BIOS data
> area, and returns a zeroed buffer. However, it turns out the kernel
> fails to enforce the same via mmap(2), and a direct mapping is
> established. This is a hole, and unfortunately userspace has learned to
> exploit it [2].
>
> This means the kernel either needs: a mechanism to ensure consistent
> plus accepted "encrypted" mappings of this /dev/mem mmap() hole, close
> the hole by mapping the zero page in the mmap(2) path, block only BIOS
> data access and let typical STRICT_DEVMEM protect the rest, or disable
> /dev/mem altogether.
>
> The simplest option for now is to revoke memory access via /dev/mem for
> confidential guests.
> Require confidential guest userspace to jettison legacy dependencies on
> /dev/mem similar to how other legacy mechanisms are jettisoned for
> confidential operation. Recall that modern methods for BIOS data
> access are available like /sys/firmware/dmi/tables.
>
> Now, this begs the question what to do with PCI sysfs which allows
> userspace mappings of confidential MMIO with similar mapping consistency
> and acceptance expectations? Here, the existing mitigation of
> IO_STRICT_DEVMEM is likely sufficient. The kernel is expected to use
> request_mem_region() when toggling the state of MMIO. With
> IO_STRICT_DEVMEM that enforces kernel-exclusive access until
> release_mem_region(), i.e. mapping conflicts are prevented. However,
> this is left out for relevant series when secure MMIO support starts
> landing.
>
> Cc: x86@kernel.org
> Cc: Kees Cook <kees@kernel.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Vishal Annapurve <vannapurve@google.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Link:
> https://sources.debian.org/src/libdebian-installer/0.125/src/system/subarch-x86-linux.c/?hl=113#L93
> [2]
> Reported-by: Nikolay Borisov <nik.borisov@suse.com>
> Closes:
> http://lore.kernel.org/20250318113604.297726-1-nik.borisov@suse.com [1]
> Fixes: 9aa6ea69852c ("x86/tdx: Make pages shared in ioremap()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
> ---
>
> Changes in V3:
> * Only select STRICT_DEVMEM if DEVMEM is also selected (Sashiko,
> Naveen)
> * Remove superfluous check for CONFIG_STRICT_DEVMEM, devmem_is_allowed
> is only
> called when it's enabled
> * Slightly modify the last 2 paragraphs of the changelog to reflect
> that this no
> longer follows the LOCKDOWN model and simply revokes memory access. And
> explicilty call out the omission of IO_STRICT_DEVMEM
> * Removed tags as the patch is sufficiently different now.
>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
next prev parent reply other threads:[~2026-12-02 14:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 12:00 [PATCH v3] x86/devmem: Drop /dev/mem access for confidential guests Nikolay Borisov
2026-11-30 14:03 ` Naveen N Rao
2026-12-02 13:57 ` Arnd Bergmann
2026-12-02 13:59 ` Ard Biesheuvel [this message]
2026-12-03 23:08 ` Edgecombe, Rick P
2026-12-04 7:19 ` Nikolay Borisov
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=1faed4b6-2f4e-473a-a5fb-90f33ca190eb@app.fastmail.com \
--to=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=dan.j.williams@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=kees@kernel.org \
--cc=mingo@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=nik.borisov@suse.com \
--cc=stable@vger.kernel.org \
--cc=suzuki.poulose@arm.com \
--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