Re: [RESEND PATCH] x86/devmem: Drop /dev/mem access for confidential guests

From: Nikolay Borisov

Date: Tue Nov 24 2026 - 12:54:05 EST




On 24.11.26 г. 19:35 ч., Greg Kroah-Hartman wrote:
On Tue, Nov 24, 2026 at 05:10:21PM +0000, Pedro Falcato wrote:
Holy cow the CC list is stale.
Fixing some up.

On Tue, Nov 24, 2026 at 08:36:45AM -0800, Dave Hansen wrote:
On 11/24/26 08:00, Nikolay Borisov wrote:
Resending this with the hope of either getting it accepted or
arriving at a consensus what exactly is missing so that I can take
it from there and eventually get something merged. As previously
mentioned this results in real problems for confidential guests both
on TDX as well as SEV-SNP.>
arch/x86/Kconfig | 4 ++++
mm/char-mem.c | 10 ++++++++++
2 files changed, 14 insertions(+)

I'm still OK with doing this.

But I didn't want to sneak an mm/ change in via the tip tree. Any mm
acks or naks on this?

For what it's worth, I don't love this fix. Yes, it fixes issues in /dev/mem,
but it:
1) skips any other potential problem spots (I don't know which)
2) open-codes random CC checks in mm, which is kind-of regrettable

OTOH, it's unclear to me why that CC check is needed. If configs select
STRICT_DEVMEM and IO_STRICT_DEVMEM, shouldn't it Just Do The Right thing?
in iomem_is_exclusive, etc. If not, could the CC awareness sit there
instead?

Yeah, why is anyone letting a CC system access /dev/mem at all? That's
ripe for abuse lots of different ways, so I really don't like this
change either.

You are missing the point, this pertains to /dev/mem in the guest. There are a bunch of libraries (libhd for example) which reads the first meg of memory. This causes the CC guest to shutdown in both AMD-SEVSNP and TDX world.


thanks,

greg k-h