Re: [PATCH] x86/vsyscall/64: Drop "native" vsyscalls

From: Dominik Brodowski
Date: Wed Mar 07 2018 - 14:31:16 EST


On Wed, Mar 07, 2018 at 11:21:46AM -0800, Kees Cook wrote:
> On Wed, Mar 7, 2018 at 11:12 AM, Andy Lutomirski <luto@xxxxxxxxxx> wrote:
> > Since Linux 3.2, vsyscalls have been deprecated and slow. From 3.2
> > on, Linux had three vsyscall modes: "native", "emulate", and "none".
> >
> > "emulate" is the default. All known user programs work correctly in
> > emulate mode, but vsyscalls turn into page faults and are emulated.
> > This is very slow. In "native" mode, the vsyscall page is easily
> > usable as an exploit gadget, but vsyscalls are a bit faster -- they
> > turn into normal syscalls. (This is in contrast to vDSO functions,
> > which can be much faster than syscalls.) In "none" mode, there are
> > no vsyscalls.
> >
> > For all practical purposes, "native" was really just a chicken bit
> > in case something went wrong with the emulation. It's been over six
> > years, and nothing has gone wrong. Delete it.
> >
> > Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>
>
> Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>
>
> I related news, I wonder how long before we can switch from EMULATE to
> NONE as the default? glibc 2.15 (which stopped using vsyscall) is (not
> coincidentally) 6 years old too...

Or, in the meantime, add a warning

if (vsyscall_mode == EMULATE) {
warn_bad_vsyscall(KERN_INFO, regs,
"vsyscalls are deprecated -- use vDSO instead");
}

Otherwise, the patch looks good.

Thanks,
Dominik