LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Andi Kleen <andi@firstfloor.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	"the arch/x86 maintainers" <x86@kernel.org>
Subject: Re: [PATCH 2/2] x86_64,signal: Remove 'fs' and 'gs' from sigcontext
Date: Thu, 17 Jul 2014 18:13:12 -0700	[thread overview]
Message-ID: <CALCETrWuL1GC1PjYQC3z0LNf=ZVSEYpx0toBvP=twhK-2dcq8Q@mail.gmail.com> (raw)
In-Reply-To: <CALCETrVTm0YWCoj8pLEi9Yu1ECiYLV8CgDhEVehzgw_21eSNAw@mail.gmail.com>

On Sat, Jul 12, 2014 at 2:17 PM, Andy Lutomirski <luto@amacapital.net> wrote:
> On Sat, Jul 12, 2014 at 11:52 AM, Andi Kleen <andi@firstfloor.org> wrote:
>> On Sat, Jul 12, 2014 at 11:40:03AM -0700, H. Peter Anvin wrote:
>>> Because you are doing something weird (like Pin, for example) and take an asynchronous fault?
>>
>> But even for pin that would need executing 16 bit code, or really weird
>> 32bit code. AFAIK for 32bit the only good use case was NX emulation
>> (and old virtualization) which are both completely obsolete.
>
> Nothing particularly weird is needed.  Set a non-default stack segment
> (e.g. any 16-bit ss) and take *any* fault.  This could be something
> asynchronous or even a normal synchronous fault.  Return from the
> signal handler: boom.
>
> We know that people use 16-bit stack segments: it's what prompted the
> whole espfix64 thing.
>
>>
>> I don't think it's worth messing with the signal handlers for 16bit
>> code. If there's any problem with saving/restoring state that emulator
>> can always handle it by itself.
>>
>
> How?
>
> I can think of at least two vaguely feasible ways.  The program could
> ptrace itself, trap sigreturn, and fix ss.  Or it could restore
> registers itself and return using far ret or iret.  Both suck.

You can't even hack around this with ptrace -- ptrace silently fails
to write ss for non-TIF_IA32 tasks.

--Andy

      reply	other threads:[~2014-07-18  1:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 16:29 [PATCH 0/2] x86_64,signal: Fix the set of saved segment registers Andy Lutomirski
2014-07-11 16:29 ` [PATCH 1/2] x86_64,signal: Save and restore SS in signal frames Andy Lutomirski
2015-03-09 20:15   ` Andy Lutomirski
2014-07-11 16:29 ` [PATCH 2/2] x86_64,signal: Remove 'fs' and 'gs' from sigcontext Andy Lutomirski
2014-07-11 18:12   ` Andi Kleen
2014-07-11 18:39     ` Andy Lutomirski
2014-07-12  2:09       ` H. Peter Anvin
2014-07-12  2:04   ` H. Peter Anvin
2014-07-12  2:21   ` Linus Torvalds
2014-07-12  2:26     ` H. Peter Anvin
2014-07-12  8:39     ` Andy Lutomirski
2014-07-12 18:37       ` Andi Kleen
2014-07-12 18:40         ` H. Peter Anvin
2014-07-12 18:52           ` Andi Kleen
2014-07-12 21:17             ` Andy Lutomirski
2014-07-18  1:13               ` Andy Lutomirski [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='CALCETrWuL1GC1PjYQC3z0LNf=ZVSEYpx0toBvP=twhK-2dcq8Q@mail.gmail.com' \
    --to=luto@amacapital.net \
    --cc=andi@firstfloor.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH 2/2] x86_64,signal: Remove '\''fs'\'' and '\''gs'\'' from sigcontext' \
    /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

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).