Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755861AbbGUUyK (ORCPT ); Tue, 21 Jul 2015 16:54:10 -0400 Received: from mail-oi0-f46.google.com ([209.85.218.46]:35322 "EHLO mail-oi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752510AbbGUUyI (ORCPT ); Tue, 21 Jul 2015 16:54:08 -0400 MIME-Version: 1.0 In-Reply-To: References: <06f4a63325ac221868770a8d63207d74b160df89.1437508486.git.luto@kernel.org> Date: Tue, 21 Jul 2015 16:54:07 -0400 Message-ID: Subject: Re: [PATCH v2 2/3] x86/ldt: Make modify_ldt optional From: Brian Gerst To: Andy Lutomirski Cc: Andy Lutomirski , Peter Zijlstra , Steven Rostedt , "security@kernel.org" , X86 ML , Borislav Petkov , Sasha Levin , Linux Kernel Mailing List , Konrad Rzeszutek Wilk , Boris Ostrovsky Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2954 Lines: 67 On Tue, Jul 21, 2015 at 4:34 PM, Andy Lutomirski wrote: > On Tue, Jul 21, 2015 at 1:28 PM, Brian Gerst wrote: >> On Tue, Jul 21, 2015 at 3:59 PM, Andy Lutomirski wrote: >>> The modify_ldt syscall exposes a large attack surface and is >>> unnecessary for modern userspace. Make it optional. >>> >>> Signed-off-by: Andy Lutomirski >>> --- >>> arch/x86/Kconfig | 17 +++++++++++++++++ >>> arch/x86/include/asm/mmu.h | 2 ++ >>> arch/x86/include/asm/mmu_context.h | 31 +++++++++++++++++++++++-------- >>> arch/x86/kernel/Makefile | 3 ++- >>> arch/x86/kernel/cpu/perf_event.c | 4 ++++ >>> arch/x86/kernel/process_64.c | 2 ++ >>> arch/x86/kernel/step.c | 2 ++ >>> kernel/sys_ni.c | 1 + >>> 8 files changed, 53 insertions(+), 9 deletions(-) >>> >>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig >>> index 55bced17dc95..a7ff3980bd65 100644 >>> --- a/arch/x86/Kconfig >>> +++ b/arch/x86/Kconfig >>> @@ -1009,6 +1009,7 @@ config VM86 >>> config X86_16BIT >>> bool "Enable support for 16-bit segments" if EXPERT >>> default y >>> + depends on MODIFY_LDT_SYSCALL >>> ---help--- >>> This option is required by programs like Wine to run 16-bit >>> protected mode legacy code on x86 processors. Disabling >>> @@ -2047,6 +2048,22 @@ config CMDLINE_OVERRIDE >>> This is used to work around broken boot loaders. This should >>> be set to 'N' under normal conditions. >>> >>> +config MODIFY_LDT_SYSCALL >>> + bool "Enable the LDT (local descriptor table)" if EXPERT >>> + default y >>> + ---help--- >>> + Linux can allow user programs to install a per-process x86 >>> + Local Descriptor Table (LDT) using the modify_ldt(2) system >>> + call. This is required to run 16-bit or segmented code such as >>> + DOSEMU or some Wine programs. It is also used by some very old >>> + threading libraries. >>> + >>> + Enabling this feature adds a small amount of overhead to >>> + context switches and increases the low-level kernel attack >>> + surface. Disabling it removes the modify_ldt(2) system call. >>> + >>> + Saying 'N' here may make sense for embedded or server kernels. >>> + >> >> I believe Wine still uses the LDT for thread-local data, even for 32 >> and 64-bit programs. This is separate from the Linux runtime TLS. >> > > Really? I thought the whole reason we had three set_thread_area slots > was for Wine. You're right. I wasn't sure if Wine was ever changed to use that. -- Brian Gerst -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/