lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150407094244.GA10973@gmail.com>
Date:	Tue, 7 Apr 2015 11:42:44 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Brian Gerst <brgerst@...il.com>
Cc:	"H. Peter Anvin" <hpa@...or.com>,
	Andy Lutomirski <luto@...capital.net>,
	Denys Vlasenko <dvlasenk@...hat.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Borislav Petkov <bp@...en8.de>,
	the arch/x86 maintainers <x86@...nel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86/signal: Remove pax argument from restore_sigcontext


* Brian Gerst <brgerst@...il.com> wrote:

> On Mon, Apr 6, 2015 at 3:03 AM, Ingo Molnar <mingo@...nel.org> wrote:
> >
> > * Brian Gerst <brgerst@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ