Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1270566pxk; Fri, 18 Sep 2020 08:11:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylfgj4CkUaau4Lej1EnqbEcn7vaFJM4XflpGufqgVztXuk7w8Xlc27bNgqxUCUcshvFnzJ X-Received: by 2002:a50:f1cf:: with SMTP id y15mr39841785edl.204.1600441895072; Fri, 18 Sep 2020 08:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600441895; cv=none; d=google.com; s=arc-20160816; b=0OCHrbkw+RnejppoS5m+om/oygUbOu/Fq+WqngXFn2W/lH8EVP0UUZRjPn1XhHn5hC CmMPcTTwsL4XbFvnTAdUzRWSbk+ZaeogVn7tPPVIhnflvdTLkkh5R56GPvHqqMkE/oSu nGHXXtkAXR8N9E3+wkLetz+WfkcFZRzslEWFC99F8hps6/CCYUB6cOobw7svrceE2WBy eRXAo5WF1htMam4iZjsStkJS+t1brU8xLT0jbayHJioGuzPLx7/V0Ie0H3GAPzgqe8jG 413CMzj9XnI64ONleJwAymJhsKs0ECQNhOZf2hj/L/wY2M8awt1rJ6vpjE7MmmOQDsw3 1kAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=O0P+Biz9TZ2rpDrwHdJDo+5utmWGEUkfmX/Q3N4+ug8=; b=FTR2ykyCPb99ZjrGR5ibblR9vthDYgk2JtaH7DGmw5BDUMHeFMSFUQLjv6WPQFCHjW 8fgxRaEEmhMW8ZwPbjYYrGHtaNFYPRDMHKzG/bR9/i7dWEwFUZUmxtfM4dUs/7I3NNrS /HDJ3XiAkkddYmQfpiHBllG/8HY1hm/mEu5caXxFN+dvr3/ijnz154rDDvzutUrWNCXQ 2EiJ8nnYr1FAuKgWRGUthDsbRnU7mCKd+Yl7mGeK+uVFd0iNI4wjOxUdCnNn8EmBjh4e w5zN7cVTVMUXxPQlGJCaKTkusdDLXZAlJVklcIDoffvkzh+L2xMpJC/1zqyf8KtHFRtI JxoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wQ81rRBm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i88si2537454edd.601.2020.09.18.08.11.11; Fri, 18 Sep 2020 08:11:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wQ81rRBm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726130AbgIRPJS (ORCPT + 99 others); Fri, 18 Sep 2020 11:09:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:58798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725941AbgIRPJS (ORCPT ); Fri, 18 Sep 2020 11:09:18 -0400 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E5F422395C for ; Fri, 18 Sep 2020 15:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600441758; bh=IkOqknM/pgGLyHstRYRh+yvQ8FdTpYzJtOj13eKOQoo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=wQ81rRBmz55lhQkw2ePr88cuYBKO/mwDLRArD0Dl8vrCF5JXRSXioBz0uBj1vbe70 7ubHe+MaHqxq7vYXgkIa4718PY9E1caLN8k+OyQ/4Lw3jA7BY/kHAtCbuaiqUdqiDw K0rCTSxm+b5VRI6PUTZSoBTMiyAMIGCPrMWMoFt4= Received: by mail-wr1-f52.google.com with SMTP id w5so5980591wrp.8 for ; Fri, 18 Sep 2020 08:09:17 -0700 (PDT) X-Gm-Message-State: AOAM5334J84JhAvZGmN5yGcP42jLUaihLWFwROy1umeXOFpQ/DaLD9tV SFtaWhRIUSZtFizsJpHNeBr/3XUr97sUZ/fBnstBtw== X-Received: by 2002:a5d:5111:: with SMTP id s17mr37934142wrt.70.1600441756359; Fri, 18 Sep 2020 08:09:16 -0700 (PDT) MIME-Version: 1.0 References: <20200915112842.897265-1-jarkko.sakkinen@linux.intel.com> <20200915112842.897265-11-jarkko.sakkinen@linux.intel.com> In-Reply-To: <20200915112842.897265-11-jarkko.sakkinen@linux.intel.com> From: Andy Lutomirski Date: Fri, 18 Sep 2020 08:09:04 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v38 10/24] mm: Add vm_ops->mprotect() To: Jarkko Sakkinen Cc: X86 ML , linux-sgx@vger.kernel.org, LKML , Sean Christopherson , Linux-MM , Andrew Morton , Matthew Wilcox , Jethro Beekman , Darren Kenny , Andy Shevchenko , asapek@google.com, Borislav Petkov , "Xing, Cedric" , chenalexchen@google.com, Conrad Parker , cyhanish@google.com, Dave Hansen , "Huang, Haitao" , Josh Triplett , "Huang, Kai" , "Svahn, Kai" , Keith Moyer , Christian Ludloff , Andrew Lutomirski , Neil Horman , Nathaniel McCallum , Patrick Uiterwijk , David Rientjes , Thomas Gleixner , yaozhangx@google.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 4:28 AM Jarkko Sakkinen wrote: > > From: Sean Christopherson > > Add vm_ops()->mprotect() for additional constraints for a VMA. > > Intel Software Guard eXtensions (SGX) will use this callback to add two > constraints: > > 1. Verify that the address range does not have holes: each page address > must be filled with an enclave page. > 2. Verify that VMA permissions won't surpass the permissions of any enclave > page within the address range. Enclave cryptographically sealed > permissions for each page address that set the upper limit for possible > VMA permissions. Not respecting this can cause #GP's to be emitted. It's been awhile since I looked at this. Can you remind us: is this just preventing userspace from shooting itself in the foot or is this something more important? --Andy