Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1398476ybc; Tue, 19 Nov 2019 20:30:09 -0800 (PST) X-Google-Smtp-Source: APXvYqxyWQvT0uSXsQb65F5AmymHyskI3PpLKARkTvPIsSxdU0C71GqhldaA3HDd6EizYmA4iwZh X-Received: by 2002:a17:906:d210:: with SMTP id w16mr2337938ejz.86.1574224209879; Tue, 19 Nov 2019 20:30:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574224209; cv=none; d=google.com; s=arc-20160816; b=Mo8YHj9phNJOJK7u1HLPDbBTBBNYzHcSZkP+BbVSs6rGIfyi8xukrxpEE3MchQ+lso Tp7IpjLC7qEcpnVtsf1Z4stUu9IqJIFoqVz9DUpWgdsVJM1/qA1IvTAVbirxWJRRiwfa 0oUvzG5iA8qMhMy3wo9cAw0Hyjhv+8eyFk5AAiM2XJQlW4URcKqinTrGA2LhWe9sKqwV jFS6naKTi4rTPk6X/z2MtlbogX9ft1WDgPoh6juOzDtCmuvO1LTcZjk6qkPuO1nbn7Wn tFmNgXWMsqVbWifKJupaRvFUSpbfOUvm5DY+VCX8+b0LV19+hWy/Bdge/QGmFv0Te2SQ Gu9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=ZJs8pZhKJiLq0G1GDQdqyl4klhHAXAHZT9LCaPqSJOM=; b=WBSVtmBQU4SChbhKOENvr5TPkXMsIdrV6rSfhHHQPq/6BXsrd4aKXs9Xp5zIvCAP0h okBawz/vLCiX9BvTNZDBfJXmkoDKmGhCKM32zNOstxaMkGJ2IvEmLNPRlKWBcwlIyTPR dl7YsY2LZXKiCWiNZob6Af5IPlO/UljiuTm3eRJ5CWwlgnACZ0hLAx3kSGwf1vGYiPs2 jLxOT8GJkvC3b5woqRXFTez6QgsBC27SnxMhwr5ophMABE7AW+T2m5oTK/dhC1uSUxgU FioT2hoF4GPcKmGMAj722dsMo/MCjdI09cHunP/g4FE6NIF1u+lKQMysU5gkcJWlepO/ y5Ng== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24si18861058eda.446.2019.11.19.20.29.45; Tue, 19 Nov 2019 20:30:09 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727428AbfKTEZe (ORCPT + 99 others); Tue, 19 Nov 2019 23:25:34 -0500 Received: from mga14.intel.com ([192.55.52.115]:58654 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727264AbfKTEZe (ORCPT ); Tue, 19 Nov 2019 23:25:34 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Nov 2019 20:25:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,220,1571727600"; d="scan'208";a="209625675" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.21]) by orsmga006.jf.intel.com with ESMTP; 19 Nov 2019 20:25:33 -0800 Received: by tassilo.localdomain (Postfix, from userid 1000) id 440B330084E; Tue, 19 Nov 2019 20:25:33 -0800 (PST) From: Andi Kleen To: Jann Horn Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "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 v2 2/3] x86/traps: Print non-canonical address on #GP References: <20191115191728.87338-1-jannh@google.com> <20191115191728.87338-2-jannh@google.com> Date: Tue, 19 Nov 2019 20:25:33 -0800 In-Reply-To: <20191115191728.87338-2-jannh@google.com> (Jann Horn's message of "Fri, 15 Nov 2019 20:17:27 +0100") Message-ID: <87lfsbfa2q.fsf@linux.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jann Horn writes: > + > + if (error_code) > + pr_alert("GPF is segment-related (see error code)\n"); > + else > + print_kernel_gp_address(regs); Is this really correct? There are a lot of instructions that can do #GP (it's the CPU's equivalent of EINVAL) and I'm pretty sure many of them don't set an error code, and many don't have operands either. You would need to make sure the instruction decoder handles these cases correctly, and ideally that you detect it instead of printing a bogus address. -Andi