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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 5F310C432C0 for ; Wed, 20 Nov 2019 16:21:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 30D6120659 for ; Wed, 20 Nov 2019 16:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732771AbfKTQVp (ORCPT ); Wed, 20 Nov 2019 11:21:45 -0500 Received: from mga03.intel.com ([134.134.136.65]:55136 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727885AbfKTQVp (ORCPT ); Wed, 20 Nov 2019 11:21:45 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2019 08:21:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,222,1571727600"; d="scan'208";a="204775025" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.41]) by fmsmga008.fm.intel.com with ESMTP; 20 Nov 2019 08:21:43 -0800 Date: Wed, 20 Nov 2019 08:21:43 -0800 From: Sean Christopherson To: Borislav Petkov Cc: Ingo Molnar , Jann Horn , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , the arch/x86 maintainers , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , kasan-dev , kernel list , Andrey Konovalov , Andy Lutomirski , Andi Kleen Subject: Re: [PATCH v3 2/4] x86/traps: Print non-canonical address on #GP Message-ID: <20191120162143.GB32572@linux.intel.com> References: <20191120103613.63563-1-jannh@google.com> <20191120103613.63563-2-jannh@google.com> <20191120111859.GA115930@gmail.com> <20191120123058.GA17296@gmail.com> <20191120123926.GE2634@zn.tnic> <20191120132830.GB54414@gmail.com> <20191120133913.GG2634@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191120133913.GG2634@zn.tnic> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 20, 2019 at 02:39:13PM +0100, Borislav Petkov wrote: > On Wed, Nov 20, 2019 at 02:28:30PM +0100, Ingo Molnar wrote: > > I'd rather we not trust the decoder and the execution environment so much > > that it never produces a 0 linear address in a #GP: > > I was just scratching my head whether I could trigger a #GP with address > of 0. But yeah, I agree, let's be really cautious here. I wouldn't want > to debug a #GP with a wrong address reported. It's definitely possible, there are a handful of non-SIMD instructions that generate #GP(0) it CPL=0 in 64-bit mode *and* have a memory operand. Some of them might even be legitimately encountered in the wild. - CMPXCHG16B if it's not supported by the CPU. - VMXON if CR4 is misconfigured or VMX isn't enabled in FEATURE_CONTROL. - MONITOR if ECX has an invalid hint (although MONITOR hardcodes the address in DS:RAX and so doesn't have a ModR/M byte). Undoudbtedly there are other instructions with similar sources of #GP.