From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Lutomirski Subject: Re: [PATCH v8 15/27] mm: Handle shadow stack page fault Date: Tue, 13 Aug 2019 15:55:07 -0700 Message-ID: References: <20190813205225.12032-1-yu-cheng.yu@intel.com> <20190813205225.12032-16-yu-cheng.yu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: <20190813205225.12032-16-yu-cheng.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org To: Yu-cheng Yu 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 List-Id: linux-api@vger.kernel.org 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? --Andy