Re: [PATCH v3 10/10] x86-64: Add CONFIG_UNSAFE_VSYSCALLS to feature-removal-schedule

From: Andrew Lutomirski
Date: Wed Jun 01 2011 - 13:42:21 EST


On Wed, Jun 1, 2011 at 1:35 PM, <Valdis.Kletnieks@xxxxxx> wrote:
> On Tue, 31 May 2011 09:16:04 EDT, Andy Lutomirski said:
>
>> +What:        CONFIG_UNSAFE_VSYSCALLS (x86_64)
>
> Wow. I went nuts trying to find where this was because I couldn't find it in
> Linus's tree I pulled a little while ago, before I realized you added it in patch 8
> and deprecated it in patch 10.
>
> Speaking of which:
>
> +         On a system with recent enough glibc (probably 2.14 or
> +         newer) and no static binaries, you can say N without a
> +         performance penalty to improve security
>
> So I checked my laptop (Fedora 16 Rawhide), and found a bunch of static binaries. The ones
> that look like people may care:
>
> # file /sbin/* | grep statically
> /sbin/grub:                ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.18, stripped
> /sbin/insmod.static:       ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, stripped
> /sbin/ldconfig:            ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, stripped
> /sbin/sln:                 ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, stripped
>

The binaries will still work -- they'll just take a small performance
hit (~220ns on Sandy Bridge) every time they call time().

Somehow I doubt that grub, ldconfig, and sln care much.

The only things I can see being a problem are big enterprise packages
like, say, Oracle's server, but I think that most of those things are
dynamically linked anyway.

Also, on systems that use a non-tsc clocksource, this hit should be
lost in the noise, except for time(). On my systems, HPET already
takes nearly a microsecond to read and the acpi clock takes over 3us.

> Might be a challenge to get rid of them though.  Unless we don't care anymore
> about "use a statically linked ldconfig to fix a corrupted ls.so.cache" and
> "reboot from a rescue disk" the only choice.  I think the insmod.static ends up
> getting used in initrds to get the root filesystem mounted, we may care about
> that as well.. ;)

You'll just have to wait a few hundred extra ns to get your system fixed :)

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/