Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp15245444ybl; Tue, 31 Dec 2019 04:18:06 -0800 (PST) X-Google-Smtp-Source: APXvYqwnioecFo3ZaE3djoT5m7A2jKDGQ4fp1Sj1sBSyrhlnFfgEpOCjKI0mZ0oSxEjQ/vmGmblg X-Received: by 2002:a05:6402:714:: with SMTP id w20mr65718543edx.46.1577794686574; Tue, 31 Dec 2019 04:18:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577794686; cv=none; d=google.com; s=arc-20160816; b=CuNOdj1TEjBcSUyQIWPCflIw4jMyIVLu6I/SjSUlKMHmXUrs7U1jzeQamXEZ2CJgDh VT4eFyaUEMUp/CC9BhD34fTxryPC408XLCd2yWsuarkda6GkeN6bMS4W43BtL9MGRL+f 08ay1VKKb71edWhr273G4YZtKh0WuWJwzu8IL1G+bnXOGyO/WtN2ltsQ0QYGPgmx/SWj VWdVPw3eUPwpWzPsMid1VM9+GE9JLuUpzZtMtlA7SBMUJyqCvEdlLODj1hRcblExcsJZ w/NAwX1Xx5i6AjHLgMR9r+gLn20rzFDsRLi2kRlayR3bqBro589CrcQluRFXfiuuYVOw AS1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=oR2xbj0U/pPGMoJ8gZOuKTnC6YknArbdAxhM7IvzOgI=; b=YBJppWlNTkJhVv/xbj4/FLUbTR8I6kzHSrX866qJuy3U8e6K96SEK2Si2NINiuYD+U 4hijha4Qj4ozAgE20t8Nc3/u4kGDNXVSrX5mZYDG2XlMVLQn+O4UBpwx7wO0svY6oHE8 roj379efKQNVSrxs7UfnjOhPwO4auuGoToIuEZvsDLt82k7H306MaSgmxeCTfdw5xdLA /+48x0KM0yyT5EJZNcJ33vypAWLpFJ2e9vX2rvzr9ak67chCP30vsTYi8ikI6Jua5kAz KQniXLGe2avA8ZwaHP447Nh/hZsfdKkGVlD7Ir8mwHdQq0MBMdd+Lvd/bRSFJZcd6KsE 0Qyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=L1M0d2Mf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si30536746ejz.221.2019.12.31.04.17.41; Tue, 31 Dec 2019 04:18:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=L1M0d2Mf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727085AbfLaMNm (ORCPT + 99 others); Tue, 31 Dec 2019 07:13:42 -0500 Received: from mail.skyhub.de ([5.9.137.197]:43534 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726334AbfLaMNm (ORCPT ); Tue, 31 Dec 2019 07:13:42 -0500 Received: from zn.tnic (p4FED3FEE.dip0.t-ipconnect.de [79.237.63.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id C266E1EC0216; Tue, 31 Dec 2019 13:13:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1577794421; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=oR2xbj0U/pPGMoJ8gZOuKTnC6YknArbdAxhM7IvzOgI=; b=L1M0d2MfDvXwB06BInNWbNrRyxXJ4p8eDWXOOC1n/RXs6mpQ2saXsgVesChtYtCn60jG7+ SBCfc9UtbWk0c6apV5LWzFHPhERhSr3VoPf1lCSNVyNciCmnC8tHSycqfsu4pL/EZgPGlQ 28R/sA9gg+yXZLyaBXZGDBcyGdJlvSI= Date: Tue, 31 Dec 2019 13:11:21 +0100 From: Borislav Petkov To: Jann Horn Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, Andrey Konovalov , Andy Lutomirski , Sean Christopherson Subject: Re: [PATCH v7 3/4] x86/dumpstack: Introduce die_addr() for die() with #GP fault address Message-ID: <20191231121121.GA13549@zn.tnic> References: <20191218231150.12139-1-jannh@google.com> <20191218231150.12139-3-jannh@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191218231150.12139-3-jannh@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 19, 2019 at 12:11:49AM +0100, Jann Horn wrote: > diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c > index c8b4ae6aed5b..4c691bb9e0d9 100644 > --- a/arch/x86/kernel/traps.c > +++ b/arch/x86/kernel/traps.c > @@ -621,7 +621,10 @@ do_general_protection(struct pt_regs *regs, long error_code) > "maybe for address", > gp_addr); > - die(desc, regs, error_code); I've added here: /* * KASAN is interested only in the non-canonical case, clear it * otherwise. */ > + if (hint != GP_NON_CANONICAL) > + gp_addr = 0; otherwise you have: if (hint != GP_NO_HINT) ... if (hint != GP_NON_CANONICAL) ... which is kinda confusing at a first glance and one has to follow the code into die_addr() to figure out the usage of the address argument. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette