[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABi2SkVmAw379G-o26sZnmt5p2FY8atoDfRMfKv0yFsfJOe7rA@mail.gmail.com>
Date: Wed, 31 May 2023 18:39:00 -0700
From: Jeff Xu <jeffxu@...omium.org>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Jeff Xu <jeffxu@...gle.com>,
Stephen Röttger <sroettger@...gle.com>,
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
Hi Dave,
Thanks for feedback, regarding sigaltstack:
On Thu, May 18, 2023 at 2:04 PM Dave Hansen <dave.hansen@...el.com> wrote:
> >
> > Agreed on signaling handling is a tough part: what do you think about
> > the approach (modifying PKRU from saved stack after XSAVE), is there a
> > blocker ?
>
> Yes, signal entry and sigreturn are not necessarily symmetric so you
> can't really have a stack.
>
To clarify: I mean this option below:
- before get_sigframe(), save PKUR => tmp
- modify thread's PKRU so it can write to sigframe
- XSAVE
- save tmp => sigframe
I believe you proposed this in a previous discussion [1]:
and I quote here:
"There's a delicate point when building the stack frame that the
kernel would need to move over to the new PKRU value to build the
frame before it writes the *OLD* value to the frame. But, it's far
from impossible."
sigreturn will restore thread's original PKRU from sigframe.
In case of asymmetrics caused by siglongjmp, user space doesn't call
sigreturn, the application needs to set desired PKRU before siglongjmp.
I think this solution should work.
[1] https://lore.kernel.org/lkml/b4f0dca5-1d15-67f7-4600-9a0a91e9d0bd@intel.com/
Best regards,
-Jeff
Powered by blists - more mailing lists