Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756448AbbGVMfT (ORCPT ); Wed, 22 Jul 2015 08:35:19 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:3219 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756348AbbGVMfQ (ORCPT ); Wed, 22 Jul 2015 08:35:16 -0400 Date: Wed, 22 Jul 2015 14:34:22 +0200 From: Willy Tarreau To: Andy Lutomirski Cc: Ingo Molnar , Brian Gerst , Andy Lutomirski , Peter Zijlstra , Steven Rostedt , "security@kernel.org" , X86 ML , Borislav Petkov , Sasha Levin , Linux Kernel Mailing List , Konrad Rzeszutek Wilk , Boris Ostrovsky Subject: Re: [PATCH v2 2/3] x86/ldt: Make modify_ldt optional Message-ID: <20150722123422.GH1588@1wt.eu> References: <06f4a63325ac221868770a8d63207d74b160df89.1437508486.git.luto@kernel.org> <20150722060643.GA25466@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2295 Lines: 53 On Tue, Jul 21, 2015 at 11:23:02PM -0700, Andy Lutomirski wrote: > >> >> +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. > > > > Too bad we have to guess, if only we had the Wine source code under a nicely > > accessible Git archive or so to check? > > > > git clone git://source.winehq.org/git/wine.git > > > > ;-) > > You don't say? > > It appears that Wine uses set_thread_area with a fallback to > modify_ldt for 32-bit binaries and arch_prctl for 64-bit. Why wouldn't we have this (as well as X86_16BIT) as a sysctl for the long term, just like we've finally got rid of NULL mapping ? We would encourage distros to ship with those settings disabled by default and to only enable them when breakage is *observed*. Currently I think that adding new config options will just make distro ship with the option enabled "just in case". It's also a nice way to discover users of these mechanisms and to suggest their developers to contemplate other options or to whine loudly. Willy -- 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/