From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7F88C43331 for ; Fri, 3 Apr 2020 23:39:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D194206F8 for ; Fri, 3 Apr 2020 23:39:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726220AbgDCXjs (ORCPT ); Fri, 3 Apr 2020 19:39:48 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:42962 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725268AbgDCXjs (ORCPT ); Fri, 3 Apr 2020 19:39:48 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jKVuG-009xUJ-1w; Fri, 03 Apr 2020 23:39:24 +0000 Date: Sat, 4 Apr 2020 00:39:24 +0100 From: Al Viro To: Nick Desaulniers Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, Peter Zijlstra , clang-built-linux@googlegroups.com, Linus Torvalds , "H. Peter Anvin" , x86@kernel.org, Sebastian Andrzej Siewior , Andy Lutomirski , Sami Tolvanen , Marco Elver , Brian Gerst , Arnd Bergmann , Andrew Morton , Oleg Nesterov , "Eric W. Biederman" , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] x86: signal: move save_altstack_ex out of generic headers Message-ID: <20200403233924.GM23230@ZenIV.linux.org.uk> References: <20200324220830.110002-1-ndesaulniers@google.com> <20200403231611.81444-1-ndesaulniers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200403231611.81444-1-ndesaulniers@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 03, 2020 at 04:16:06PM -0700, Nick Desaulniers wrote: > In some configurations (clang+KASAN), sas_ss_reset() may emit calls to > memset(). This is a problem for SMAP protections on x86, which should > try to minimize calls to any function not already on short whitelist, in > order to prevent leaking AC flags or being used as a gadget. > > Linus noted that unsafe_save_altstack() only has callsites in the > arch-specific arch/x86/kernel/signal.c, and shouldn't be defined in arch > independent headers. > > Split the logic of unsafe_save_altstack() into two, and move the definitions > to arch/x86/include/asm/sigframe.h. This does less work with the SMAP > guards down. Just move that into signal_delivered() and that's it. SMAP or no SMAP - doing that until the sigframe is set and we are committed to entering the handler is wrong.