Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp197113imu; Thu, 8 Nov 2018 07:05:42 -0800 (PST) X-Google-Smtp-Source: AJdET5cdnatvN5nEZuIPe09qJ4/HLyKMRUDBrOxKd+yokGYKPh2LiSC7Ph8z2yMWlbCSlv6mT7ql X-Received: by 2002:a62:120b:: with SMTP id a11-v6mr4845841pfj.165.1541689542798; Thu, 08 Nov 2018 07:05:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541689542; cv=none; d=google.com; s=arc-20160816; b=c4kEma4mZNlUb32+x48zs2RMUZ2jF5NqdEoe5E2HwxCakUTIfykpqCjZn/kiuUqVV/ lVZsMpaEtvBeyszG63Nf1KN5lkFNzZZQBuRj9NOOdxdOmzMJjKqRGrUo7D1ou/vtMcY+ TFWQfPvBAsLvaxBVckV9C+mQgPTwwRn96pZPPDDFWimclQR8hkI1VEhO4ngKmPsuGpx9 uGXAvdzNb2BUX4ItBO+VEIQCrOW5Tf4Cm7B6BKBhi08vFkkR1YNOhYFHWz1b+xK4cjGD AJlIr5eUivDXfMzQHvR9NBnpa3Kx8DFrBHVIIQmFbm32qErSmP+CATji4j6QUd6u+Eq4 ZKyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=IitXVkkNo4xOThcPUQ4bAfdDlVXvbEFHB1aHqAYuyQA=; b=PT7o7tKbgiOs7buX0A4u9s3pAcxu5Vft2y5V/Xd6MXvekuLV5c3Y99I2KpQNH/TGkG Z8CVk35d0Q26tNFJE6sjbUdMqo9OBUMyc3LBKb6plp8BRXHve9hd7VQQfNBskbqcpz8Z 0jXTp9btKC67JZWHjO1LXPzI0rzbh1A04qXAwjIDc5FYoJ/Js5SkWlEsH1XECMe7K9b4 IMQwNgUskxpAuDdP5XEoXfQvOf1eLO8Bc6aQ9h5kJZS6RypJAzoEsx6C0DgOgBwZc3AV WzprrSpTByDBbtNStooCIXqN3UllyUw9kLwPQa1RIRbVB5FJd4uZIlwmqkUELnFjX06s qDfQ== 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 1-v6si4530189plw.81.2018.11.08.07.05.17; Thu, 08 Nov 2018 07:05:42 -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 S1727002AbeKIAkN (ORCPT + 99 others); Thu, 8 Nov 2018 19:40:13 -0500 Received: from mga14.intel.com ([192.55.52.115]:13569 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbeKIAkN (ORCPT ); Thu, 8 Nov 2018 19:40:13 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Nov 2018 07:04:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,480,1534834800"; d="scan'208";a="106544802" Received: from ibanaga-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.254.75]) by orsmga001.jf.intel.com with ESMTP; 08 Nov 2018 07:04:06 -0800 Date: Thu, 8 Nov 2018 17:04:05 +0200 From: Jarkko Sakkinen To: Dave Hansen Cc: Sean Christopherson , Andy Lutomirski , Jann Horn , Linus Torvalds , Rich Felker , Dave Hansen , Jethro Beekman , Florian Weimer , Linux API , X86 ML , linux-arch , LKML , Peter Zijlstra , nhorman@redhat.com, npmccallum@redhat.com, "Ayoun, Serge" , shay.katz-zamir@intel.com, linux-sgx@vger.kernel.org, Andy Shevchenko , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Carlos O'Donell , adhemerval.zanella@linaro.org Subject: Re: RFC: userspace exception fixups Message-ID: <20181108150405.GB14072@linux.intel.com> References: <1541541565.8854.13.camel@intel.com> <7FF4802E-FBC5-4E6D-A8F6-8A65114F18C7@amacapital.net> <20181106233515.GB11101@linux.intel.com> <20181107000235.GC11101@linux.intel.com> <20181107153452.GB22972@linux.intel.com> <20181107190114.GA26603@linux.intel.com> <662fa2c8-c9a8-b2a8-ee8b-92a8a89c0630@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <662fa2c8-c9a8-b2a8-ee8b-92a8a89c0630@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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, Nov 07, 2018 at 12:56:58PM -0800, Dave Hansen wrote: > On 11/7/18 11:01 AM, Sean Christopherson wrote: > > Going off comments in similar code related to UMIP, we'd need to figure > > out how to handle protection keys. > > There are two options: > 1. Don't depend on the userspace mapping. Do get_user_pages() to find > the instruction in the kernel direct map, and use that. > 2. Do a WRPKRU that allows read access, do the read, then put PKRU back. > This is a pain because of preemption and all that jazz. > > Right now, we just let the prefetch instruction detection fail if you > mark it unreadable with pkeys. Tough cookies, basically. But, that's > just the kernel being nice, but you need it for functionality, so it's > tougher. I would go with one because it is the stable way to do it and we are 100% sure to not conflict with pk's. /Jarkko