From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
To: Brian Gerst <brgerst@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
linux-kernel@vger.kernel.org, x86@kernel.org,
Robert Gill <rtgill82@gmail.com>,
Jari Ruusu <jariruusu@protonmail.com>,
"Linux regression tracking (Thorsten Leemhuis)"
<regressions@leemhuis.info>,
antonio.gomez.iglesias@linux.intel.com,
daniel.sneddon@linux.intel.com
Subject: Re: [PATCH v2] x86/entry_32: Move CLEAR_CPU_BUFFERS before restoring segments
Date: Mon, 1 Jul 2024 09:23:36 -0700 [thread overview]
Message-ID: <20240701162336.ox6yedgovb7qdwde@desk> (raw)
In-Reply-To: <CAMzpN2gmxgbuYqwEcia7bpXhHHh_KgY37_wbwGeK5oBAy5=reA@mail.gmail.com>
On Sat, Jun 29, 2024 at 11:41:07AM -0400, Brian Gerst wrote:
> > #GP(0) - If a memory operand effective address is outside the CS, DS, ES,
> > FS, or GS segment limit.
>
> This isn't limited to just VM86 mode, since any user DS that isn't a
> flat segment can also cause problems.
Right.
> > CLEAR_CPU_BUFFERS macro executes VERW instruction before returning to
> > user space. Add CLEAR_CPU_BUFFERS to the macro RESTORE_REGS before it
> > restores segment registers. In vm86 mode kernel does not support SYSCALL
> > and SYSENTER instructions, so the problem is only limited to int80 path
> > in 32-bit mode. In the opportunistic SYSEXIT path use
> > CLEAR_CPU_BUFFERS_SAFE that ensures a sane %ds value.
>
> The simpler fix is to use an SS segment override (verw
> %ss:mds_verw_sel), since the stack segment is still valid right up to
> the IRET/SYSEXIT.
Thanks a lot, I have verified that your suggestion works. I will send a new
version with your suggestion.
prev parent reply other threads:[~2024-07-01 16:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-27 23:51 Pawan Gupta
2024-06-29 15:41 ` Brian Gerst
2024-07-01 16:23 ` Pawan Gupta [this message]
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=20240701162336.ox6yedgovb7qdwde@desk \
--to=pawan.kumar.gupta@linux.intel.com \
--cc=antonio.gomez.iglesias@linux.intel.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=daniel.sneddon@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=jariruusu@protonmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=regressions@leemhuis.info \
--cc=rtgill82@gmail.com \
--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
all inboxes | Powered by JetHome®