Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751313AbdCMJkI (ORCPT ); Mon, 13 Mar 2017 05:40:08 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:36082 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751260AbdCMJkB (ORCPT ); Mon, 13 Mar 2017 05:40:01 -0400 Date: Mon, 13 Mar 2017 10:39:57 +0100 (CET) From: Thomas Gleixner To: Dmitry Safonov cc: linux-kernel@vger.kernel.org, 0x7f454c46@gmail.com, Ingo Molnar , "H. Peter Anvin" , Andy Lutomirski , Borislav Petkov , x86@kernel.org, linux-mm@kvack.org, Cyrill Gorcunov , "Kirill A. Shutemov" Subject: Re: [PATCHv6 4/5] x86/mm: check in_compat_syscall() instead TIF_ADDR32 for mmap(MAP_32BIT) In-Reply-To: <20170306141721.9188-5-dsafonov@virtuozzo.com> Message-ID: References: <20170306141721.9188-1-dsafonov@virtuozzo.com> <20170306141721.9188-5-dsafonov@virtuozzo.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1033 Lines: 24 On Mon, 6 Mar 2017, Dmitry Safonov wrote: > Result of mmap() calls with MAP_32BIT flag at this moment depends > on thread flag TIF_ADDR32, which is set during exec() for 32-bit apps. > It's broken as the behavior of mmap() shouldn't depend on exec-ed > application's bitness. Instead, it should check the bitness of mmap() > syscall. > How it worked before: > o for 32-bit compatible binaries it is completely ignored. Which was > fine when there were one mmap_base, computed for 32-bit syscalls. > After introducing mmap_compat_base 64-bit syscalls do use computed > for 64-bit syscalls mmap_base, which means that we can allocate 64-bit > address with 64-bit syscall in application launched from 32-bit > compatible binary. And ignoring this flag is not expected behavior. Well, the real question here is, whether we should allow 32bit applications to obtain 64bit mappings at all. We can very well force 32bit applications into the 4GB address space as it was before your mmap base splitup and be done with it. Thanks, tglx