From: Dan Williams <dan.j.williams@intel.com>
To: Naveen N Rao <naveen@kernel.org>,
Dan Williams <dan.j.williams@intel.com>
Cc: <dave.hansen@linux.intel.com>, <x86@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Vishal Annapurve <vannapurve@google.com>,
Kirill Shutemov <kirill.shutemov@linux.intel.com>,
Nikolay Borisov <nik.borisov@suse.com>, <stable@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] x86/devmem: Restrict /dev/mem access for potentially unaccepted memory by default
Date: Wed, 16 Apr 2025 14:30:57 -0700 [thread overview]
Message-ID: <68002191c4733_71fe294da@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <l2crzyeoux2pammbifkivrhp637gza7piumd3s6j66mezsfvdy@nwczgs2hkq4f>
Naveen N Rao wrote:
> On Thu, Apr 10, 2025 at 06:22:38PM -0700, Dan Williams wrote:
> > Nikolay reports [1] that accessing BIOS data (first 1MB of the physical
> > address space) via /dev/mem results in an SEPT violation.
> >
> > The cause is ioremap() (via xlate_dev_mem_ptr()) establishes an
> > unencrypted mapping where the kernel had established an encrypted
> > mapping previously.
> >
> > An initial attempt to fix this revealed that TDX and SEV-SNP have
> > different expectations about which and when address ranges can be mapped
> > via /dev/mem.
> >
> > Rather than develop a precise set of allowed /dev/mem capable TVM
> > address ranges, teach devmem_is_allowed() to always restrict access to
> > the BIOS data space.
>
> This patch does more than just restrict the BIOS data space - it rejects
> all accesses to /dev/mem _apart_ from the first 1MB. That should be made
> clear here.
>
Agree, and per the follow on conversation [1] even that low 1MB access to
return zeroes is not helpful. Confidential Computing userspace should
drop its dependency on interfaces that are difficult to make compatible
with consistent encryption policy and acceptance status.
http://lore.kernel.org/67f98e27a799e_7205294e3@dwillia2-xfh.jf.intel.com.notmuch [1]
[..]
> > int devmem_is_allowed(unsigned long pagenr)
> > {
> > + bool platform_allowed = x86_platform.devmem_is_allowed(pagenr);
> > +
>
> If we are going to do this, I don't see the point of having an
> x86_platform_op. It may be better to simply gate this on
> cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT) directly here.
That is fair, no point in premature flexibility.
next prev parent reply other threads:[~2025-04-16 21:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 1:22 [PATCH v2 0/3] Restrict devmem for confidential VMs Dan Williams
2025-04-11 1:22 ` [PATCH v2 1/3] x86/devmem: Remove duplicate range_is_allowed() definition Dan Williams
2025-04-14 18:17 ` Naveen N Rao
2025-04-16 21:25 ` Dan Williams
2025-04-17 7:28 ` Naveen N Rao
2025-04-17 18:27 ` Dan Williams
2025-04-19 9:09 ` Naveen N Rao
2025-04-11 1:22 ` [PATCH v2 2/3] devmem: Block mmap access when read/write access is restricted Dan Williams
2025-04-11 2:32 ` Kees Cook
2025-04-11 4:59 ` Dan Williams
2025-04-11 15:38 ` Dave Hansen
2025-04-11 21:48 ` Dan Williams
2025-04-11 1:22 ` [PATCH v2 3/3] x86/devmem: Restrict /dev/mem access for potentially unaccepted memory by default Dan Williams
2025-04-14 18:22 ` Naveen N Rao
2025-04-16 21:30 ` Dan Williams [this message]
2025-04-14 10:56 ` [PATCH v2 0/3] Restrict devmem for confidential VMs 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=68002191c4733_71fe294da@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=naveen@kernel.org \
--cc=nik.borisov@suse.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.