Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1032084ybl; Wed, 14 Aug 2019 09:39:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2qcYYAvT0yF/Sn2zpgV0VvoydX39UcclRyA1uRmgIUxA9D1chmAcl+fEL34GZpyQI4GMW X-Received: by 2002:a17:90a:8d86:: with SMTP id d6mr612203pjo.94.1565800752074; Wed, 14 Aug 2019 09:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565800752; cv=none; d=google.com; s=arc-20160816; b=ueXZBPvTBRmRsh6/aK0DpGlTWqWoTLqJ44jgcNNAPay8FdmnX7fgOcGqQnJmXEBFk4 d1LoqFhJMr9zXIfh40C4cHRPfjXPA/gE6eaQV9z2dFtTKQ7aFwrmLZ++oLc8jAIshlPl yivyfl+GVgOTEp5C504BJK+A9lXHDwIFx0BBIXe8gl7D/6u1rVR8MQRL1h+Wz4hO6PL9 c7W3C1J0CPNbYWvcjlWFP761CzrkwaDrvaiEB9V2X9+suFxrlGeeKXX0cXj3DyoJI7Sd ZSreuxS7wk3FZDR+NnEUIjrfV9zpaSODO5UehyEEVp7kawdyKnS0BBDX6j4CUzhhL9SX BJMQ== 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 :references:in-reply-to:date:cc:to:from:subject:message-id; bh=d680KbhFZ4qIq08Ka9XHhYo1Nch+LhtDrCGpFKJGiSc=; b=kc/z8g9nMqvn7X20uVn7c87oIsHOkdaBlB+m6/kMnYMOjL7s0WT4u+ti6kLBr0i2k7 3RYD/5BdaB9OiH8izgDQeVKsn7xKIjIsLcFtr2yblgtHsZ8MMJxktqVVam8o0uTX8e0w IlroxUAvTFAFHm+5F7SInchW6vtWpNCirtKacXXuUvb9uvcMGvBaSdMIuY/xabuzYNmn 8GOEVOQVoqJtiGza0wrj6GQM4L8V3QjHkJmll6ox+GyuQ7Yn/NGFXEOA4V0KFrrXnxSo /Hp3k2hdr4bMFPP93q/WHhSpEYeJFtmC7F+NeVDCFTE5Ks29BujzneCYHcnD61w4nD5H qMlA== 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 em12si139885pjb.25.2019.08.14.09.38.55; Wed, 14 Aug 2019 09:39:12 -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 S1728014AbfHNQhB (ORCPT + 99 others); Wed, 14 Aug 2019 12:37:01 -0400 Received: from mga02.intel.com ([134.134.136.20]:39981 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726126AbfHNQhB (ORCPT ); Wed, 14 Aug 2019 12:37:01 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Aug 2019 09:37:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,385,1559545200"; d="scan'208";a="178213373" Received: from yyu32-desk1.sc.intel.com ([10.144.153.205]) by fmsmga007.fm.intel.com with ESMTP; 14 Aug 2019 09:37:00 -0700 Message-ID: Subject: Re: [PATCH v8 15/27] mm: Handle shadow stack page fault From: Yu-cheng Yu To: Andy Lutomirski Cc: X86 ML , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , "open list:DOCUMENTATION" , Linux-MM , linux-arch , Linux API , Arnd Bergmann , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin Date: Wed, 14 Aug 2019 09:27:21 -0700 In-Reply-To: References: <20190813205225.12032-1-yu-cheng.yu@intel.com> <20190813205225.12032-16-yu-cheng.yu@intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1-2 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 Tue, 2019-08-13 at 15:55 -0700, Andy Lutomirski wrote: > On Tue, Aug 13, 2019 at 2:02 PM Yu-cheng Yu wrote: > > > > When a task does fork(), its shadow stack (SHSTK) must be duplicated > > for the child. This patch implements a flow similar to copy-on-write > > of an anonymous page, but for SHSTK. > > > > A SHSTK PTE must be RO and dirty. This dirty bit requirement is used > > to effect the copying. In copy_one_pte(), clear the dirty bit from a > > SHSTK PTE to cause a page fault upon the next SHSTK access. At that > > time, fix the PTE and copy/re-use the page. > > Is using VM_SHSTK and special-casing all of this really better than > using a special mapping or other pseudo-file-backed VMA and putting > all the magic in the vm_operations? A special mapping is cleaner. However, we also need to exclude normal [RO + dirty] pages from shadow stack. Yu-cheng