Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751922AbdCVVRK (ORCPT ); Wed, 22 Mar 2017 17:17:10 -0400 Received: from terminus.zytor.com ([65.50.211.136]:35201 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751819AbdCVVQ7 (ORCPT ); Wed, 22 Mar 2017 17:16:59 -0400 Subject: Re: [PATCH v4 1/4] syscalls: Restore address limit after a syscall To: Andy Lutomirski , Thomas Garnier References: <20170322203834.67556-1-thgarnie@google.com> Cc: Martin Schwidefsky , Heiko Carstens , Dave Hansen , David Howells , Al Viro , Arnd Bergmann , =?UTF-8?Q?Ren=c3=a9_Nyffenegger?= , Andrew Morton , "Paul E . McKenney" , Ingo Molnar , Thomas Gleixner , Oleg Nesterov , Pavel Tikhomirov , Stephen Smalley , Ingo Molnar , Andy Lutomirski , Paolo Bonzini , Rik van Riel , Kees Cook , Josh Poimboeuf , Borislav Petkov , Brian Gerst , "Kirill A . Shutemov" , Christian Borntraeger , Russell King , Vladimir Murzin , Will Deacon , Catalin Marinas , Mark Rutland , James Morse , "linux-s390@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Linux API , X86 ML , "linux-arm-kernel@lists.infradead.org" , "kernel-hardening@lists.openwall.com" From: "H. Peter Anvin" Message-ID: <5c59808f-6518-f51b-ee71-891b71404fc8@zytor.com> Date: Wed, 22 Mar 2017 13:54:10 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 719 Lines: 24 On 03/22/17 13:44, Andy Lutomirski wrote: > > While it's possible that silently papering over the bug is slightly > faster than BUGging, it will allow bugs to continue to exist > undetected. > It would also allow the test to be inlined (at least on architectures which have a one-site implementation) and have only the failure case out of line, with a __noreturn annotation (which allows it to be jumped to rather than called, which is usually available as a conditional operation whereas call often isn't.) That is... extern void __noreturn __pre_usermode_state_invalid(void); static void verify_pre_usermode_state(void) { if (unlikely(!segment_eq(get_fs(), USER_DS)) __pre_usermode_state_invalid(); } -hpa