Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9295743ybi; Wed, 10 Jul 2019 07:56:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5WOsg0vp2lU8f+fWuZQAdf7sIOMCC9VxCWiJQlH0IUTF/xaSpVjf38IoHWDylS7Q8RlBN X-Received: by 2002:a17:902:a40c:: with SMTP id p12mr39431732plq.146.1562770568331; Wed, 10 Jul 2019 07:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562770568; cv=none; d=google.com; s=arc-20160816; b=r2HWHAsV7ow2a4L9vcLmr/uAbfozCgzP7uBIqQb4cerFQAMYHmOVVwmtQ+6OjhgGBu fpXhr1fHOhQ5SdLnkPV8hYCdUJ+LI+iF8OZSreDsrNLhp6IsVzOfqaR/1csFrTXbCLZR 8hP7BFS2u5LnKcfKaDzcn3DobteISsIFzX18qgn9NoPDha+Z2iUUHqSN8u4sAaP13Suv 6TS+Q8LOGBBh9QEliv4hdPZSkE4zTWykVokwq4PoMwpJ7NZnIa/sdg2t8jCAt1Pu5C4S +Y48HPooHgOQOp/T6Yqbl8y6rN1RXw1KL0PL/aTAt1MX1bNgi2nThOGqUCRuINiTwcXK Qi5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=LQJx49Lk+JlaaB/PDCeOfvrpjy0Ym/c/NLkIXQM/GWI=; b=pqfT2aPTk470kvY2tXcRAPSdAH9gzgWk1CEHk9dcgB9kaORvS3lbMmL8aRMrDvBXV/ SVKhmpxi7yToxBEhhq1o7evG8yKgrNq/q4gNR0HHvxvGIiCX0CepkK8BauinQgyIQ8Xg +vZaq+jRdzt1W9kx92sKK9bQ52PE3eZbNSW5j/F4/BbBZdMBSSE/otyeAm06CqZfTsGT qnh5mPCvBsrKcprvRy3oPUUkS8Q7vm8idqh7t5Z72DU5ZJ55mdxErNwJ/liVhZgImMMR D/nIfSePiIwq4EYMvgOkch+V52lRcA4uGeWIkbPr01XpFMDskUofcrFHcKdVXKfjaJFV nRYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mengyan1223.wang header.s=mail header.b=E9qTiaTS; 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=mengyan1223.wang Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 142si2626199pgf.35.2019.07.10.07.55.52; Wed, 10 Jul 2019 07:56:08 -0700 (PDT) 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=@mengyan1223.wang header.s=mail header.b=E9qTiaTS; 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=mengyan1223.wang Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727524AbfGJOos (ORCPT + 99 others); Wed, 10 Jul 2019 10:44:48 -0400 Received: from mengyan1223.wang ([89.208.246.23]:38848 "EHLO mengyan1223.wang" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726458AbfGJOos (ORCPT ); Wed, 10 Jul 2019 10:44:48 -0400 Received: from [IPv6:2408:8270:a58:d980:697b:cb16:ae5f:f5aa] (unknown [IPv6:2408:8270:a58:d980:697b:cb16:ae5f:f5aa]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: xry111@mengyan1223.wang) by mengyan1223.wang (Postfix) with ESMTPSA id 4312965B50; Wed, 10 Jul 2019 10:44:38 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mengyan1223.wang; s=mail; t=1562769888; bh=LQJx49Lk+JlaaB/PDCeOfvrpjy0Ym/c/NLkIXQM/GWI=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=E9qTiaTSWnaQZ3HQWSZkMlqHuN5ZDk/8ztSuZ+iIYU8Fs6QiZl6Y4Hj6oyshxUlqY 47Lh9qvtD2HVsuEsowWuQXFJ5RgcfwOjETtbE0ssaS6/E7JxiMSNPi8/0ASNRrFTje Ml5ZMTvwUMQJDDi0vAn/Ed1cZ6aZuocgbrOXBXVylNyUajLmoeKaqMeij7ypAipjWP N5fPwXUjCCFU2akj4ag4migh5QpTaS5+dT5RzHHfEvLzfUbazXEEdVpU9BufE3VRJe yIVHqxprfIsRLQOoRgokbWmTEjjkfBbYmOOddm2XlUR3G8dpPMaV9kNDLw2fc944kJ OVYkK2NI1l1Cg== Message-ID: <00e7f454c2d531cdc6033cd6e3761e8a0d60c2e0.camel@mengyan1223.wang> Subject: Re: [GIT PULL] x86/topology changes for v5.3 From: Xi Ruoyao To: Jiri Kosina , Peter Zijlstra Cc: Thomas Gleixner , Kees Cook , Linus Torvalds , Ingo Molnar , Linux List Kernel Mailing , Borislav Petkov , Len Brown , Andrew Morton , "Rafael J. Wysocki" , Tony Luck , Bob Moore , Erik Schmauss , Josh Poimboeuf , Daniel Bristot de Oliveira , xry111@mengyan1223.wang Date: Wed, 10 Jul 2019 22:44:33 +0800 In-Reply-To: References: <201907091727.91CC6C72D8@keescook> <1ad2de95e694a29909801d022fe2d556df9a4bd5.camel@mengyan1223.wang> <768463eb26a2feb0fcc374fd7f9cc28b96976917.camel@mengyan1223.wang> <20190710134433.GN3402@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.3 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-07-10 16:22 +0200, Jiri Kosina wrote: > On Wed, 10 Jul 2019, Peter Zijlstra wrote: > > > If we mark the key as RO after init, and then try and modify the key to > > link module usage sites, things might go bang as described. > > > > Thanks! > > > > > > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > > index 27d7864e7252..5bf7a8354da2 100644 > > --- a/arch/x86/kernel/cpu/common.c > > +++ b/arch/x86/kernel/cpu/common.c > > @@ -366,7 +366,7 @@ static __always_inline void setup_umip(struct > > cpuinfo_x86 *c) > > cr4_clear_bits(X86_CR4_UMIP); > > } > > > > -DEFINE_STATIC_KEY_FALSE_RO(cr_pinning); > > +DEFINE_STATIC_KEY_FALSE(cr_pinning); > > Good catch, I guess that is going to fix it. Yes it works. > At the same time though, it sort of destroys the original intent of Kees' > patch, right? The exploits will just have to call static_key_disable() > prior to calling native_write_cr4() again, and the protection is gone. I think I should do some study and try to understand the full story of Kees' change... -- Xi Ruoyao School of Aerospace Science and Technology, Xidian University