From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A66D9C2BB1D for ; Fri, 13 Mar 2020 22:00:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F2752074F for ; Fri, 13 Mar 2020 22:00:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F2752074F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B78746B0003; Fri, 13 Mar 2020 18:00:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B29E96B0006; Fri, 13 Mar 2020 18:00:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3F066B0007; Fri, 13 Mar 2020 18:00:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id 891406B0003 for ; Fri, 13 Mar 2020 18:00:24 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1D7571EE6 for ; Fri, 13 Mar 2020 22:00:24 +0000 (UTC) X-FDA: 76591708368.17.stop74_77d9e75174f11 X-HE-Tag: stop74_77d9e75174f11 X-Filterd-Recvd-Size: 3093 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Fri, 13 Mar 2020 22:00:23 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2020 15:00:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,550,1574150400"; d="scan'208";a="416431849" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by orsmga005.jf.intel.com with ESMTP; 13 Mar 2020 15:00:21 -0700 Message-ID: Subject: Re: [RFC PATCH v9 15/27] mm: Handle THP/HugeTLB Shadow Stack page fault From: Yu-cheng Yu To: Kees Cook Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , x86-patch-review@intel.com Date: Fri, 13 Mar 2020 15:00:20 -0700 In-Reply-To: <202002251258.7D6DA92@keescook> References: <20200205181935.3712-1-yu-cheng.yu@intel.com> <20200205181935.3712-16-yu-cheng.yu@intel.com> <202002251258.7D6DA92@keescook> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 2020-02-25 at 12:59 -0800, Kees Cook wrote: > On Wed, Feb 05, 2020 at 10:19:23AM -0800, Yu-cheng Yu wrote: > > This patch implements THP Shadow Stack (SHSTK) copying in the same way as > > in the previous patch for regular PTE. > > > > In copy_huge_pmd(), clear the dirty bit from the PMD to cause a page fault > > upon the next SHSTK access to the PMD. At that time, fix the PMD and > > copy/re-use the page. > > Now is as good a time as any to ask: do you have selftests for all this? > It seems like it would be really nice to have a way to verify SHSTK is > working correctly. Yes, I have some simple tests at https://github.com/yyu168/cet-smoke-test. I also run Linux/tools/testing/selftests/x86 and GLIBC tests with CET and THP combinations. Yu-cheng