Re: [RESEND PATCH] x86/devmem: Drop /dev/mem access for confidential guests
From: Naveen N Rao
Date: Fri Nov 27 2026 - 03:52:06 EST
On Thu, Nov 26, 2026 at 09:17:49AM +0200, Nikolay Borisov wrote:
>
>
> On 25.11.26 г. 18:51 ч., Naveen N Rao wrote:
> > On Tue, Nov 24, 2026 at 07:57:05PM +0200, Nikolay Borisov wrote:
> > > On 24.11.26 г. 19:10 ч., Pedro Falcato wrote:
> > > > On Tue, Nov 24, 2026 at 08:36:45AM -0800, Dave Hansen wrote:
> > > > > On 11/24/26 08:00, Nikolay Borisov wrote:
> > >
> > > > 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?
> > >
> > > Well, you are right that if we retain just the select
> > > STRICT_DEVMEM/IO_STRICT_DEVMEM it might fix the immediate issue. I don't
> > > know why eventually Dan decided to also add this check, I guess it's an
> > > instance of "fail fast".
> >
> > Actually no? On x86, devmem_is_allowed() allows access to the first 1 MB
> > area, so STRICT_DEVMEM alone isn't sufficient.
>
> For the first megabyte of memory (BIOS) is return 2, meaning "Just return 0,
> rather than trying to access the address range".
That applies to read(). For mmap(), the accesses are allowed causing a
#VC -- though this is taken in user-mode so the application gets a
SIGBUS.
- Naveen