[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALCETrXPA9hH66AdRN5eQLV=EpM3mB6QzQVcrX473OXSPj32VA@mail.gmail.com>
Date: Sun, 29 Mar 2015 10:12:21 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Denys Vlasenko <vda.linux@...glemail.com>
Cc: Borislav Petkov <bp@...en8.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
X86 ML <x86@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Denys Vlasenko <dvlasenk@...hat.com>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: ia32_sysenter_target does not preserve EFLAGS
On Mar 28, 2015 6:17 AM, "Denys Vlasenko" <vda.linux@...glemail.com> wrote:
>
> On Sat, Mar 28, 2015 at 10:46 AM, Ingo Molnar <mingo@...nel.org> wrote:
> > * Denys Vlasenko <vda.linux@...glemail.com> wrote:
> >> This is a C function. [...]
> >
> > Arguably that's a self-inflicted wound of uclibc: nothing keeps it
> > from taking advantage of the syscall ABI and avoiding the double
> > save/restores.
>
> It's not uclibc who calls write(), it's user program.
>
> IIRC uclibc can't make user program aware that write()
> is not clobbering registers.
>
> Even if it could do that via an __attribute__ somehow,
> it would be a violation of standards: write() is supposed to be
> an ordinary C function, users must be able to take its address
> and assign it to a pointer declared as
>
> ssize_t (*ptr)(int, const void *, size_t);
>
> Slapping __attribute__((different_abi))
> onto write() makes that impossible, the signature
> no longer matches.
>
> Let me go back from hypothetics to the actual situation.
> We can't do such a drastic ABI change now, it's too big.
>
> But is looks like we can relax ABI wrt saving flags,
> because it's broken for some time, and no one complains.
>
> If we say that arith flags and DF are not saved, it may
> mean that we don't need to kill ourselves with
> awkward and costly (popf is 20 cycles) EFLAGS
> manipulations.
Given that I just posted a patch that removes the popf by using
sysret, I'm unconvinced this is worthwhile.
--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