[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrXgddhM7FTiD2Dih9fgfvU3Wb908GbOOwJOarHSwa-yLg@mail.gmail.com>
Date: Tue, 15 Sep 2015 11:14:36 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Ingo Molnar <mingo@...nel.org>
Cc: Frederic Weisbecker <fweisbec@...il.com>,
Denys Vlasenko <dvlasenk@...hat.com>,
Kees Cook <keescook@...omium.org>,
Borislav Petkov <bp@...en8.de>, X86 ML <x86@...nel.org>,
Oleg Nesterov <oleg@...hat.com>,
Alexei Starovoitov <ast@...mgrid.com>,
Steven Rostedt <rostedt@...dmis.org>,
Will Drewry <wad@...omium.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH v4 RESEND] x86/asm/entry/32, selftests: Add
'test_syscall_vdso' test
On Sep 14, 2015 11:00 PM, "Ingo Molnar" <mingo@...nel.org> wrote:
>
>
> * Andy Lutomirski <luto@...capital.net> wrote:
>
> > On Sep 14, 2015 1:15 AM, "Ingo Molnar" <mingo@...nel.org> wrote:
> > >
> > >
> > > * Denys Vlasenko <dvlasenk@...hat.com> wrote:
> > >
> > > > >> + /* INT80 syscall entrypoint can be used by
> > > > >> + * 64-bit programs too, unlike SYSCALL/SYSENTER.
> > > > >> + * Therefore it must preserve R12+
> > > > >> + * (they are callee-saved registers in 64-bit C ABI).
> > > > >> + *
> > > > >> + * This was probably historically not intended,
> > > > >> + * but R8..11 are clobbered (cleared to 0).
> > > > >> + * IOW: they are the only registers which aren't
> > > > >> + * preserved across INT80 syscall.
> > > > >> + */
> > > > >> + if (*r64 == 0 && num <= 11)
> > > > >> + continue;
> > > > >
> > > > > Ugh. I'll change my big entry patchset to preserve these and maybe to
> > > > > preserve all of the 64-bit regs.
> > > >
> > > > If you do that, this won't change the ABI: we don't _promise_
> > > > to save them. If we accidentally do, that means nothing.
> > >
> > > Argh, that's dangerous nonsense! You _still_ don't seem to understand what the
> > > Linux ABI means and how to change code that implements it...
> >
> > I think Denys might be taking about R8-R11 here. If we change them
> > from clobbered to saved, that's probably fine. Certainly I have to
> > save R12-R15 -- my v1 is just buggy there. I was too deep in
> > __kernel_vsyscall when I wrote that code, and I wasn't thinking about
> > the raw int $0x80 entry variant.
> >
> > I'd be rather surprised if anything broke if we started preserving
> > R8-R11 instead of zeroing them.
>
> Well, read the statement:
>
> " If you do that, this won't change the ABI: we don't _promise_
> to save them. If we accidentally do, that means nothing. "
>
> of _course_ it means everything: if we preserve R8-R11 and any app learns to rely
> on it, it becomes an ABI.
Right, it changes the ABI in a way that we can't undo, but it probably
doesn't break the old ABI.
Certainly for v2, I'll try to preserve the old behavior exactly. If
we change it later to preserve all high regs, that'll be a separate
patch.
--Andy
--
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