From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757608AbbICRUG (ORCPT ); Thu, 3 Sep 2015 13:20:06 -0400 Received: from smtp16.mail.ru ([94.100.176.153]:52456 "EHLO smtp16.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754989AbbICRUF (ORCPT ); Thu, 3 Sep 2015 13:20:05 -0400 Subject: Re: stop breaking dosemu (Re: x86/kconfig/32: Rename CONFIG_VM86 and default it to 'n') To: Linus Torvalds , Austin S Hemmelgarn References: <55E6C36F.6080309@list.ru> <55E736E9.2000201@list.ru> <55E7607B.4070800@list.ru> <55E7663B.30402@list.ru> <55E76FCB.7090304@list.ru> <55E838E6.8060205@gmail.com> <55E839C7.8010501@list.ru> <55E86AF7.3090200@gmail.com> Cc: Andy Lutomirski , Josh Boyer , "linux-kernel@vger.kernel.org" , "Andrew Bird (Sphere Systems)" , Ingo Molnar , Kees Cook , Brian Gerst From: Stas Sergeev Message-ID: <55E88138.4080905@list.ru> Date: Thu, 3 Sep 2015 20:19:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Mras: Ok Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 03.09.2015 19:57, Linus Torvalds пишет: > On Thu, Sep 3, 2015 at 8:44 AM, Austin S Hemmelgarn > wrote: >> >> This lets you turn this on or off at runtime. > > Tangential aside: we already effectively have a flag that could turn > off vm86 mode dynamically: /proc/sys/vm/mmap_min_addr. > > Sadly (or not) we default it to 4096, which still leaves vm86 mode > usable, although it effectively disables *dos* use for it. Which is > kind of the worst of both worlds: you can use the vm86() system call > for bad things (if you can find a hole in it), but you probably cannot > actually use it for DOS emulation, because the traditional BIOS data > segment is at 0040. > > Anyway, what that means is that pretty much the only *valid* use of > vm86() mode is probably when the system maintainer has set > 'mmap_min_addr' to zero. So we could probably use that as an already > existing flag that disallows vm86 by our current default values. > > Stas - can you confirm that to actually use vm86 mode, you end up > setting that mmap_min_addr thing to zero? Or do you end up using a > mixed-mode setup, where you use vm86() for most things, but emulate > things that trap in the zero page? Yes, good point. dosemu complains about /proc/sys/vm/mmap_min_addr. Trapping on zero-page access will likely not work, because IIRC some distros raise that value even more. So yes, please use that to completely disable vm86(). You won't even break dosemu's checks, because it (obviously) tries mmap() before trying vm86(). Thanks!