Received: by 10.213.65.68 with SMTP id h4csp275940imn; Tue, 20 Mar 2018 03:18:28 -0700 (PDT) X-Google-Smtp-Source: AG47ELtlUDXVFH78kHNO28IZThgD84DWDnoWTUaQLcPgv+o37z39dC4X4DhDShgeptOKCtWykXjD X-Received: by 2002:a17:902:9308:: with SMTP id bc8-v6mr11997509plb.189.1521541108307; Tue, 20 Mar 2018 03:18:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521541108; cv=none; d=google.com; s=arc-20160816; b=IZtpVMVFaiyb/j1/Gpu+qMPXjNSUuZyDKhccYtXgnLKO8gsdvZiPN3M045DsLxufPl vAKGDI70bp9XLdS9tIXU8jEt4l596qipq/+VVlJniw1PuXrxuA51mZkGRoZyHKXQcwjc CPyhigM2SxlSRpuHxT5sIF7wVsfSYCFnQYIcashkmsFlI5oCnQ9LpRvvBi1Vo6X/iDrf HCxzC28/5rI5XHgvAvst1Td4I7i8y8Y73DDu2eaSkrjQzrY4VBvCsdg+W/vdJ96cry4D 1Y9WMXIFvHXfqBQWDiQQ4EpCKKDZuGlEEe0LVXz9uFy+2ROSvcoMIRIbfflf+HZFs2/I aT5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=ddNd33Jh35l8miZ43ETtjYDGZP+M3K7MbBjEE+F0bzI=; b=ul51gOJbuNUhZaH7qpu46fzXdI6nVl9oKXWVrstzw9jubX4kAK44vZVYhNDrJc2jwG NLHgzeanMyVafBDX8++9aMAHG5CgSW/sj/1I3kTaAbA0ulewX4hhP7Js3Stu1WFG0kvF TyI/X2RfLJ4xqP4nK6DhvRsIcuNkKJJlcvcL86oSV5Xd1ls7grMB5JGlAQTpGuiNLdOu vLFZ88dCNg37Rf7ZXYgrpzrHhSk6K0Jf876CdwPlm3Y0bcMMe/Rl/wPzrJur1JtVwZlY e+hez34+s8xEDb5HFsI7iOZB5vKSyAjFz4u6eLcJ8ZbHNt0VwNQRzuQXfgcNAIdiYmt/ yuAQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si956741pgs.763.2018.03.20.03.18.14; Tue, 20 Mar 2018 03:18:28 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752738AbeCTKPy convert rfc822-to-8bit (ORCPT + 99 others); Tue, 20 Mar 2018 06:15:54 -0400 Received: from smtp-out6.electric.net ([192.162.217.190]:64861 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751929AbeCTKPt (ORCPT ); Tue, 20 Mar 2018 06:15:49 -0400 Received: from 1eyEIr-0007BF-V0 by out6b.electric.net with emc1-ok (Exim 4.90_1) (envelope-from ) id 1eyEIu-0007jd-VZ; Tue, 20 Mar 2018 03:15:40 -0700 Received: by emcmailer; Tue, 20 Mar 2018 03:15:40 -0700 Received: from [156.67.243.126] (helo=AcuMS.aculab.com) by out6b.electric.net with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1eyEIr-0007BF-V0; Tue, 20 Mar 2018 03:15:37 -0700 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 20 Mar 2018 10:16:36 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Tue, 20 Mar 2018 10:16:36 +0000 From: David Laight To: "'Chang S. Bae'" , "x86@kernel.org" CC: "luto@kernel.org" , "ak@linux.intel.com" , "hpa@zytor.com" , "markus.t.metzger@intel.com" , "tony.luck@intel.com" , "ravi.v.shankar@intel.com" , "linux-kernel@vger.kernel.org" , Dave Hansen Subject: RE: [PATCH 13/15] x86/fsgsbase/64: With FSGSBASE, compare GS bases on paranoid_entry Thread-Topic: [PATCH 13/15] x86/fsgsbase/64: With FSGSBASE, compare GS bases on paranoid_entry Thread-Index: AQHTv8TePyJOGC70+0OZPg5byt68MqPY6GkQ Date: Tue, 20 Mar 2018 10:16:36 +0000 Message-ID: References: <1521481767-22113-1-git-send-email-chang.seok.bae@intel.com> <1521481767-22113-14-git-send-email-chang.seok.bae@intel.com> In-Reply-To: <1521481767-22113-14-git-send-email-chang.seok.bae@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.33] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuMS.aculab.com X-TLS: TLSv1.2:ECDHE-RSA-AES256-SHA384:256 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 X-Virus-Status: Scanned by VirusSMART (c) X-Virus-Status: Scanned by VirusSMART (s) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chang S. Bae > Sent: 19 March 2018 17:49 ... > When FSGSBASE is enabled, SWAPGS needs if and only if (current) > GS base is not the kernel's. > > FSGSBASE instructions allow user to write any value on GS base; > even negative. Sign check on the current GS base is not > sufficient. Fortunately, reading GS base is fast. Kernel GS > base is also known from the offset table with the CPU number. ... Use code might want to put a negative value into GSBASE. While it is normal to put a valid address into GSBASE there is no reason why the code can't put an offset into GSBASE, in which case it might be negative. Yes, I know you can't put arbitrary 64bit values into GSBASE. But the difference between 2 user pointers will always be valid. David