[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b69f6809-b483-158f-8be9-4976fad918d8@intel.com>
Date: Wed, 17 May 2023 08:29:47 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Jeff Xu <jeffxu@...gle.com>
Cc: Stephen Röttger <sroettger@...gle.com>,
jeffxu@...omium.org, luto@...nel.org, jorgelo@...omium.org,
keescook@...omium.org, groeck@...omium.org, jannh@...gle.com,
akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-mm@...ck.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH 0/6] Memory Mapping (VMA) protection using PKU - set 1
On 5/17/23 08:21, Jeff Xu wrote:
>>> I’m not sure I follow the details, can you give an example of an asynchronous
>>> mechanism to do this? E.g. would this be the kernel writing to the memory in a
>>> syscall for example?
>> I was thinking of all of the IORING_OP_*'s that can write to memory or
>> aio(7).
> IORING is challenging from security perspectives, for now, it is
> disabled in ChromeOS. Though I'm not sure how aio is related ?
Let's say you're the attacking thread and you're the *only* attacking
thread. You have three things at your disposal:
1. A benign thread doing aio_read()
2. An arbitrary write primitive
3. You can send signals to yourself
4. You can calculate where your signal stack will be
You calculate the address of PKRU on the future signal stack. You then
leverage the otherwise benign aio_write() to write a 0 to that PKRU
location. Then, send a signal to yourself. The attacker's PKRU value
will be written to the stack. If you can time it right, the AIO will
complete while the signal handler is in progress and PKRU is on the
stack. On sigreturn, the kernel restores the aio_read()-placed,
attacker-provided PKRU value. Now the attacker has PKRU==0. It
effectively build a WRPKRU primitive out of those other pieces.
Powered by blists - more mailing lists