[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <83c9b05e7d359c0486a061f3bd31920ddb5c33a0.camel@intel.com>
Date: Mon, 5 Aug 2024 22:40:55 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "linux-coco@...ts.linux.dev" <linux-coco@...ts.linux.dev>,
"legion@...nel.org" <legion@...nel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
CC: "ytcoode@...il.com" <ytcoode@...il.com>, "Huang, Kai"
<kai.huang@...el.com>, "Yao, Yuan" <yuan.yao@...el.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"John.Starks@...rosoft.com" <John.Starks@...rosoft.com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"mingo@...hat.com" <mingo@...hat.com>, "tglx@...utronix.de"
<tglx@...utronix.de>, "Cui, Dexuan" <decui@...rosoft.com>, "oleg@...hat.com"
<oleg@...hat.com>, "bhe@...hat.com" <bhe@...hat.com>, "hpa@...or.com"
<hpa@...or.com>, "bp@...en8.de" <bp@...en8.de>, "geert@...ux-m68k.org"
<geert@...ux-m68k.org>, "cho@...rosoft.com" <cho@...rosoft.com>
Subject: Re: [PATCH v2 2/5] x86/tdx: Add validation of userspace MMIO
instructions
On Mon, 2024-08-05 at 15:29 +0200, Alexey Gladkov (Intel) wrote:
> + vaddr = (unsigned long)insn_get_addr_ref(&insn, regs);
> +
> + if (user_mode(regs)) {
> + if (mmap_read_lock_killable(current->mm))
> + return -EINTR;
> +
> + ret = valid_vaddr(ve, mmio, size, vaddr);
> + if (ret)
> + goto unlock;
> + }
> +
In the case of user MMIO, if the user instruction + MAX_INSN_SIZE straddles a
page, then the "fetch" in the kernel could trigger a #VE. In this case the
kernel would handle this second #VE as a !user_mode() MMIO I guess.
Would something prevent the same munmap() checks needing to happen for that
second kernel #VE? If not, I wonder if the munmap() protection logic should also
trigger for any userspace range ve->gpa as well.
Powered by blists - more mailing lists