Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp4006069ybd; Tue, 25 Jun 2019 12:18:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVEhbSy/ovwmvjKZvA1UdoAdYsC12HFPbClpPSkQxkUUlkSJJaDVfGdhXJ0BZL6sBjOs5g X-Received: by 2002:a17:90a:25c8:: with SMTP id k66mr435891pje.129.1561490283352; Tue, 25 Jun 2019 12:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561490283; cv=none; d=google.com; s=arc-20160816; b=Z5FEiRD3QWPWvPssMzmgtHSdZdV+hNec0vIG4LzkmmSQxgPoJ3uiIo46dp12Dvqah1 bXkZFWaPXEITesi0aeMO3X4V9QoPo/fPnFV+YPuvDhsF6v8V6+LDC9+wO4uog1DGwUws 6V5pANXvlKJ2OLjoF5ZoXGy+LQ6Xr06N3l37fr5/mzGuxf+451IH/flsHzY2mun6k5Z/ t+AmMBxAbmv/okXcFv0hWprEqwCcn//ULYKiKZKNPC1PoTFznzcbKDynBEQzCYD9ekE1 +wvBxBQtcWoPPQq+pnKsEt998ydmHEtKg+ZOsX5FV19yeai3X6uOmVbyItqfd/YCyZHf Hrag== 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=BlYhqYoj504GazZ4s6fRK0KLebxgbFNYBCCXiy3m13g=; b=kFjpFRSZyGRk4DBfELxjNGrGll+KT5JM0Q/XrcSaHkGg3YI62QALgz25yTLEZisY0M DYOJhWyUmI+5v+J0Y8AG4CtDKvLHYYt8/K00hIgtThMPq1E3OkiK/wY3ACn6KC5oGsEi RK+yaEdus07OF9IXSPpR1sDre6EJnnuU1D0ouVQF9IVur7h8edkYs6OFO73sHsJyNtBi bxJ5bhOuw87z4UlnM37KI/XYx2Z7ZYikA0tk01m04noTOveUyoFA1XQtAz6+yTVbqm4s dsYigJ+pdQnZCsghsqzqaRK5JI8VVu4TW33UWOFa80gXlFzH7zd53xIjRVYoyW/6L7mj ZQSQ== 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 cl7si1083792plb.267.2019.06.25.12.17.47; Tue, 25 Jun 2019 12:18:03 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732460AbfFYPnu (ORCPT + 99 others); Tue, 25 Jun 2019 11:43:50 -0400 Received: from mga03.intel.com ([134.134.136.65]:7838 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726443AbfFYPnu (ORCPT ); Tue, 25 Jun 2019 11:43:50 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2019 08:43:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,416,1557212400"; d="scan'208";a="152334540" Received: from pkoeberl-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.33.126]) by orsmga007.jf.intel.com with ESMTP; 25 Jun 2019 08:43:42 -0700 Date: Tue, 25 Jun 2019 18:43:41 +0300 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org, sean.j.christopherson@intel.com Cc: akpm@linux-foundation.org, dave.hansen@intel.com, nhorman@redhat.com, npmccallum@redhat.com, serge.ayoun@intel.com, shay.katz-zamir@intel.com, haitao.huang@intel.com, andriy.shevchenko@linux.intel.com, tglx@linutronix.de, kai.svahn@intel.com, bp@alien8.de, josh@joshtriplett.org, luto@kernel.org, kai.huang@intel.com, rientjes@google.com, Andy Lutomirski , Dave Hansen Subject: Re: [PATCH v20 22/28] x86/traps: Attempt to fixup exceptions in vDSO before signaling Message-ID: <20190625154341.GA7046@linux.intel.com> References: <20190417103938.7762-1-jarkko.sakkinen@linux.intel.com> <20190417103938.7762-23-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190417103938.7762-23-jarkko.sakkinen@linux.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, Apr 17, 2019 at 01:39:32PM +0300, Jarkko Sakkinen wrote: > From: Sean Christopherson > > vDSO functions can now leverage an exception fixup mechanism similar to > kernel exception fixup. For vDSO exception fixup, the initial user is > Intel's Software Guard Extensions (SGX), which will wrap the low-level > transitions to/from the enclave, i.e. EENTER and ERESUME instructions, > in a vDSO function and leverage fixup to intercept exceptions that would > otherwise generate a signal. This allows the vDSO wrapper to return the > fault information directly to its caller, obviating the need for SGX > applications and libraries to juggle signal handlers. > > Attempt to fixup vDSO exceptions immediately prior to populating and > sending signal information. Except for the delivery mechanism, an > exception in a vDSO function should be treated like any other exception > in userspace, e.g. any fault that is successfully handled by the kernel > should not be directly visible to userspace. > > Although it's debatable whether or not all exceptions are of interest to > enclaves, defer to the vDSO fixup to decide whether to do fixup or > generate a signal. Future users of vDSO fixup, if there ever are any, > will undoubtedly have different requirements than SGX enclaves, e.g. the > fixup vs. signal logic can be made function specific if/when necessary. > > Suggested-by: Andy Lutomirski > Cc: Andy Lutomirski > Cc: Jarkko Sakkinen > Cc: Dave Hansen > Cc: Josh Triplett > Signed-off-by: Sean Christopherson I went through the vDSO changes just to revisit couple of details that I had forgotten. Sean, if you don't mind I'd squash this and prepending patch. Is there any obvious reason why #PF fixup is in its own patch and the rest are collected to the same patch? I would not find it confusing if there was one patch per exception but really don't get this division. /Jarkko