From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jiri Slaby <jslaby@suse.cz>, Thomas Gleixner <tglx@linutronix.de>,
Nikolay Borisov <nik.borisov@suse.com>,
x86@kernel.org
Cc: linux-kernel@vger.kernel.org, mhocko@suse.com
Subject: Re: [PATCH 3/3] x86: Disable running 32bit processes if ia32_disabled is passed
Date: Thu, 8 Jun 2023 16:32:41 +0100 [thread overview]
Message-ID: <4b1833cc-a68a-78ce-7e3a-3f9eb17e367f@citrix.com> (raw)
In-Reply-To: <4217f682-f0e3-28de-1fb9-634c5df3581a@suse.cz>
On 08/06/2023 7:16 am, Jiri Slaby wrote:
> On 08. 06. 23, 2:25, Thomas Gleixner wrote:
>> I really wish that we could disable syscall32 reliably on AMD and make
>> it raise #UD as it does on Intal.
>
> Sorry, I am likely missing something, but why is not #GP enough when
> we set CSTAR = 0?
Yeah, don't be setting CSTAR to 0.
If you set CSTAR to 0, and userspace has mapped something at 0, then the
CPU will start executing from 0 in kernel mode.
If you've got SMEP active, this doesn't help. Instead of executing from
0, you'll take #PF. Except you were already in kernel mode and #PF
isn't an IST vector, so you'll then start executing the #PF handler on
the same stack as before... which is the user stack, and it can still
hijack execution by hooking a return address.
If you've got (just) SMAP active, then this doesn't help. The hijacked
execution doesn't need to touch the stack to execute STAC and re-permit
user data accesses.
If you've got SMEP, SMAP, *and* FMASK configured to clear AC
automatically on syscall, then you end up in #DF from a SMEP violation
trying to fetch the code, and a SMAP violation while trying to push the
SMEP violation's #PF IRET frame.
It's almost as if not switching the stack was a terrible terrible idea...
~Andrew
next prev parent reply other threads:[~2023-06-08 15:33 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 7:29 [RFC PATCH 0/3] Add ability to disable ia32 at boot time Nikolay Borisov
2023-06-07 7:29 ` [PATCH 1/3] x86: Introduce ia32_disabled boot parameter Nikolay Borisov
2023-06-07 8:55 ` Thomas Gleixner
2023-06-07 7:29 ` [PATCH 2/3] x86/entry: Disable IA32 syscalls in the presence of ia32_disabled Nikolay Borisov
2023-06-07 9:11 ` Thomas Gleixner
2023-06-08 3:18 ` Brian Gerst
2023-06-07 7:29 ` [PATCH 3/3] x86: Disable running 32bit processes if ia32_disabled is passed Nikolay Borisov
2023-06-07 12:01 ` Thomas Gleixner
2023-06-07 12:19 ` Nikolay Borisov
2023-06-07 12:53 ` Thomas Gleixner
2023-06-07 13:38 ` Nikolay Borisov
2023-06-07 14:49 ` Thomas Gleixner
2023-06-07 17:25 ` Andrew Cooper
2023-06-07 21:52 ` Thomas Gleixner
2023-06-07 23:43 ` Andrew Cooper
2023-06-08 0:25 ` Thomas Gleixner
2023-06-08 6:16 ` Jiri Slaby
2023-06-08 6:36 ` Jiri Slaby
2023-06-08 15:30 ` Thomas Gleixner
2023-06-08 15:32 ` Andrew Cooper [this message]
2023-06-08 6:29 ` Jiri Slaby
2023-06-08 11:25 ` Andrew Cooper
2023-06-08 15:56 ` Thomas Gleixner
2023-06-08 21:29 ` Nikolay Borisov
2023-06-07 12:55 ` Thomas Gleixner
2023-06-08 4:37 ` Brian Gerst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4b1833cc-a68a-78ce-7e3a-3f9eb17e367f@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=nik.borisov@suse.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).