From: Eric Lacombe <goretux@gmail.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Arjan van de Ven <arjan@infradead.org>,
Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org
Subject: Re: [x86] do_arch_prctl - bug?
Date: Wed, 19 Nov 2008 10:23:16 +0100 [thread overview]
Message-ID: <200811191023.16358.goretux@gmail.com> (raw)
In-Reply-To: <492366CB.8020905@goop.org>
Le mercredi 19 novembre 2008 02:07:23 Jeremy Fitzhardinge, vous avez écrit :
> Eric Lacombe wrote:
> > I look at the Intel docs (vol. 3A) again, and see that in 64 bits mode
> > the hidden field gs.base are physically mapped to the MSR, so it seems
> > that in order to load gs.base we don't need to load gs (like in 32 bits
> > mode), but rather we only need to load the MSR.
> >
> > So I don't understand the purpose of load_gs_index in that context :
> >
> > if (doit) {
> > load_gs_index(0);
> > ret = checking_wrmsrl(MSR_KERNEL_GS_BASE, addr);
> > }
> >
> > Why don't we only load the MSR ?
> > What is the purpose of calling load_gs_index with 0 as parameter ?
>
> Because %gs of 0 means "base too large, go to MSR". If you have a
> 32-bit base, then loading it into the gdt and loading %gs with the right
> selector is faster. wrmsr/rdmsr are slow instructions.
Ok, thanks, so I suppose now that only doing :
asm volatile("movl %0,%%gs" :: "r" (0));
could corrupt the address of the PDA that resides actually in the MSR_GS_BASE.
And that's why load_gs_index is used as it contains "swapgs" before and after
the "mov to gs".
Is that correct?
Regards,
Eric
next prev parent reply other threads:[~2008-11-19 9:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-18 17:35 [x86] do_arch_prctl - bug? Eric Lacombe
2008-11-18 23:44 ` Eric Lacombe
2008-11-19 1:07 ` Jeremy Fitzhardinge
2008-11-19 9:23 ` Eric Lacombe [this message]
2008-11-19 21:06 ` Jeremy Fitzhardinge
2008-11-19 23:35 ` [x86] do_arch_prctl Eric Lacombe
2008-11-20 0:07 ` Jeremy Fitzhardinge
2008-11-20 0:22 ` Eric Lacombe
2008-11-24 12:24 ` Eric Lacombe
2008-11-24 18:22 ` Jeremy Fitzhardinge
2008-11-24 19:28 ` Eric Lacombe
-- strict thread matches above, loose matches on Subject: below --
2008-11-18 14:33 [x86] do_arch_prctl - bug? Eric Lacombe
2008-11-18 14:45 ` Arjan van de Ven
[not found] ` <200811181820.04064.goretux@gmail.com>
2008-11-18 17:35 ` Eric Lacombe
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=200811191023.16358.goretux@gmail.com \
--to=goretux@gmail.com \
--cc=arjan@infradead.org \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.