Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1185890imu; Wed, 9 Jan 2019 13:15:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN4RXbA43KjyLbyWpYjMVPdTQEXf+YcKoafkM+ZVC9JhCsLw8ifgBjO3Kqu0AY1yh1jUb8cF X-Received: by 2002:a62:3811:: with SMTP id f17mr7668656pfa.206.1547068512446; Wed, 09 Jan 2019 13:15:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547068512; cv=none; d=google.com; s=arc-20160816; b=ZaNwuQgB+GLKrL2uRA1XZXb4IiA2BPm175Gx/yuF2tXp7pjBStZJTlW5JFCNXrBxeV kQS0aE7OfFON424C9CqMAaC79aggw5HFrqEUG9+pGk9cK9bDxul8qdbgoVhnloTq9t8d fHgYMeJ/lmhLGOqTqZ6cjgrMyH8zQyN681Xr1sL5h/9flPKhSMYtY6bqp+pkUQOFAxvJ BQodc/tAIttC7+LObfMWyoMCxxbT+2wHaFEV1C5/wdxfz0SrVONKv1BwkmA1TcaBhUP9 lJKTe24KVB+UPhRdSolwOAeQMfuvEHnkNd1Depl13lE2CImgGHtD//YFFjyfvg7yWHMh U94A== 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=EmBMA6GO+6Uc8NSnev8KQ6avqe9/TIz0RFFXmES3pPA=; b=kbocSYusXsfYGXTwPP92YvsJVfrxR/MCg0GdpQ1oUmORZQUc4AXrDyVHuTe7iOD4YV DZxS+J4bT8dZ0RJq/jay4JQu1Gc7JIURg9y1u4XtvOPRDaPJWHmyGdOfhcbgmQyDF7eM SMlA+AE6+DAaGWXAJKOsz/4kEkJdKyd/srQrcpSDBniFWOK6xdb/ZGrUOwNj/Q68c2cm U9okrqTWjo31TOAVxdOKs1FP957QUxgr1/x0/QB4kHvbCCrUwFkqGrdtO0em6OTsj+Ds maOdLRjPpEnrvMyqG8VK0vgyLXbtRNq3Tw6nqlwdDy6RCWZVDZunMPMAq0YFtucTP8qO b/rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=NoPZixy+; 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 j28si31453425pgm.160.2019.01.09.13.14.57; Wed, 09 Jan 2019 13:15:12 -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=NoPZixy+; 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 S1726928AbfAIVLU (ORCPT + 99 others); Wed, 9 Jan 2019 16:11:20 -0500 Received: from mail.skyhub.de ([5.9.137.197]:34280 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726146AbfAIVLU (ORCPT ); Wed, 9 Jan 2019 16:11:20 -0500 Received: from zn.tnic (p200300EC2BEA10006802B5941DDA3DDE.dip0.t-ipconnect.de [IPv6:2003:ec:2bea:1000:6802:b594:1dda:3dde]) (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 224F31EC0432; Wed, 9 Jan 2019 22:11:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1547068278; 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=EmBMA6GO+6Uc8NSnev8KQ6avqe9/TIz0RFFXmES3pPA=; b=NoPZixy+X72CO1FsDBO6iq+W9n5NbaYOM6jhz+MWpZbpFXNC+hXqL4we7ENh3FL+FBCJje R91phJIiFrZFSAxAcA8AZE9GrDyJFE8U2bWJYuHZcXlgnIlHwjfPpkf1+pLNZDwc0pA7o3 2zIdvPsgDLV46ZTVQhqHpPSd2VGBw44= Date: Wed, 9 Jan 2019 22:11:04 +0100 From: Borislav Petkov To: Paul Menzel Cc: Thomas Lendacky , Thomas Gleixner , Jiri Kosina , "x86@kernel.org" , LKML , Tim Chen Subject: Re: General protection fault in `switch_mm_irqs_off()` Message-ID: <20190109211104.GG15665@zn.tnic> References: <784ab00e-ed72-c1bc-bc0c-31264deb7726@molgen.mpg.de> <5c38f377-f088-5684-91a5-c2cc2d64dbbd@molgen.mpg.de> <206f4322-c15e-6f0b-733d-fd19cd9c24a7@molgen.mpg.de> <98ed83c0-3077-848b-9de4-add70e9b417a@amd.com> <9bca3e26-1dfc-6e86-cf28-90cadd983ff4@molgen.mpg.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <9bca3e26-1dfc-6e86-cf28-90cadd983ff4@molgen.mpg.de> 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 Wed, Jan 09, 2019 at 05:34:11PM +0100, Paul Menzel wrote: > Is there a way to trace the value of `boot_cpu_data` from > `arch/x86/include/asm/cpufeature.h` with some Linux Kernel magic? > > #define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit) > > Or is rebuilding with print statements the only solution? Yes. Just apply this and catch output. It is a wild guess anyway as this whole deal looks really strange but at least it should not #GP the machine. --- diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index dad12b767ba0..ec4688779900 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -284,6 +284,9 @@ static inline void indirect_branch_prediction_barrier(void) { u64 val = PRED_CMD_IBPB; + if (WARN_ON(boot_cpu_has(X86_FEATURE_USE_IBPB))) + return; + alternative_msr_write(MSR_IA32_PRED_CMD, val, X86_FEATURE_USE_IBPB); } diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 1de0f4170178..4ed4cc99a2c0 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -371,6 +371,8 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd) if (boot_cpu_has(X86_FEATURE_IBPB)) { setup_force_cpu_cap(X86_FEATURE_USE_IBPB); + pr_err("%s: set X86_FEATURE_USE_IBPB\n", __func__); + switch (cmd) { case SPECTRE_V2_USER_CMD_FORCE: case SPECTRE_V2_USER_CMD_PRCTL_IBPB: -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.