From: Ingo Molnar <mingo@kernel.org>
To: Brian Gerst <brgerst@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Andy Lutomirski <luto@amacapital.net>,
Denys Vlasenko <dvlasenk@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Borislav Petkov <bp@alien8.de>,
the arch/x86 maintainers <x86@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/signal: Remove pax argument from restore_sigcontext
Date: Tue, 7 Apr 2015 11:42:44 +0200 [thread overview]
Message-ID: <20150407094244.GA10973@gmail.com> (raw)
In-Reply-To: <CAMzpN2jbnUnAjqLK+TiA5t8-MgjoV5vdnkO4G6hGcULmGW7n+A@mail.gmail.com>
* Brian Gerst <brgerst@gmail.com> wrote:
> On Mon, Apr 6, 2015 at 3:03 AM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Brian Gerst <brgerst@gmail.com> wrote:
> >
> >> > I'm wondering what the original reason for adding the extra
> >> > handling of regs->ax was. Maybe something changed regs->ax - but I
> >> > cannot find such code path anymore.
> >> >
> >> > It would be nice to try to do a bit of Git archeology to figure
> >> > out the origins of this complication - maybe it's something subtle
> >> > - or it's something that has changed meanwhile.
> >>
> >> It goes all the way back to 2.1.106pre1, when restore_sigcontext()
> >> was changed to return an error code instead of EAX directly.
> >>
> >> https://git.kernel.org/cgit/linux/kernel/git/history/history.git/diff/arch/i386/kernel/signal.c?id=9a8f8b7ca3f319bd668298d447bdf32730e51174
> >
> > Indeed: restore_sigcontext() used to return eax as a return value,
> > without copying it into regs->ax.
> >
> > Then in 2007
>
> Version 2.1.106 was released on Jun 13, 1998.
Sigh, the Git timestamp of the historic tree threw me off :-)
> > sigaltstack syscall support was added, where the return value of
> > restore_sigcontext() was changed to carry the memory-copying
> > failure code. But instead of putting 'ax' into regs->ax, it was
> > carried in via a pointer and then returned, where the generic
> > syscall return code copied it to regs->ax.
> >
> > So there was never any deeper reason for this suboptimal pattern,
> > it was simply never noticed after being introduced.
> >
> > (Btw., the regs->ax we return will be copied back to regs->ax
> > after the syscall straight away once again - but I guess this
> > cannot be helped.)
>
> The 64-bit stub could skip saving it back to regs.
Yeah, but at the cost of having a duplicated entry stub, right?
Thanks,
Ingo
next prev parent reply other threads:[~2015-04-07 9:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-04 12:58 [PATCH] x86/signal: Remove pax argument from restore_sigcontext Brian Gerst
2015-04-04 14:14 ` Ingo Molnar
2015-04-04 17:07 ` Brian Gerst
2015-04-05 5:09 ` Ingo Molnar
2015-04-05 0:01 ` Brian Gerst
2015-04-06 7:03 ` Ingo Molnar
2015-04-06 12:00 ` Brian Gerst
2015-04-07 9:42 ` Ingo Molnar [this message]
2015-04-07 9:40 ` [tip:x86/asm] " tip-bot for 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=20150407094244.GA10973@gmail.com \
--to=mingo@kernel.org \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=torvalds@linux-foundation.org \
--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 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.