From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu-cheng Yu Subject: Re: [RFC PATCH v9 15/27] mm: Handle THP/HugeTLB Shadow Stack page fault Date: Fri, 13 Mar 2020 15:00:20 -0700 Message-ID: References: <20200205181935.3712-1-yu-cheng.yu@intel.com> <20200205181935.3712-16-yu-cheng.yu@intel.com> <202002251258.7D6DA92@keescook> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <202002251258.7D6DA92@keescook> Sender: linux-doc-owner@vger.kernel.org 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 List-Id: linux-arch.vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: Subject: Re: [RFC PATCH v9 15/27] mm: Handle THP/HugeTLB Shadow Stack page fault From: Yu-cheng Yu 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" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-doc-owner@vger.kernel.org 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 List-ID: Message-ID: <20200313220020.lbkb-A-V1nRFhfy9bPgXakeqBmumRbOR3cD_MeP3qLA@z> 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