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=-7.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 1CD03C433E1 for ; Thu, 27 Aug 2020 18:13:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DFE4722B4B for ; Thu, 27 Aug 2020 18:13:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DFE4722B4B 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 765B16B0003; Thu, 27 Aug 2020 14:13:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 716056B0006; Thu, 27 Aug 2020 14:13:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6058D6B0007; Thu, 27 Aug 2020 14:13:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0051.hostedemail.com [216.40.44.51]) by kanga.kvack.org (Postfix) with ESMTP id 483D06B0003 for ; Thu, 27 Aug 2020 14:13:58 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0A46F181AEF0B for ; Thu, 27 Aug 2020 18:13:58 +0000 (UTC) X-FDA: 77197147356.30.rice70_0301f482706f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id B42B7180B3C83 for ; Thu, 27 Aug 2020 18:13:57 +0000 (UTC) X-HE-Tag: rice70_0301f482706f X-Filterd-Recvd-Size: 4988 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Thu, 27 Aug 2020 18:13:55 +0000 (UTC) IronPort-SDR: xo2vaW9V5FmYg/KHXQR7vuWzJbXfGexBxD9usAjBCcvHU6c3uxwm2t3g0MpYOutewzXvRsaZKD 5/8bL7fLIVyQ== X-IronPort-AV: E=McAfee;i="6000,8403,9726"; a="155803888" X-IronPort-AV: E=Sophos;i="5.76,360,1592895600"; d="scan'208";a="155803888" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2020 11:13:52 -0700 IronPort-SDR: kU95U/D1O7kHgHr1WXXPT1vdBAMIbglRTHBy0TxJgYsrsBJ105d5EwsufFz1dq2ONoiEaDdGpR SH4Z20+xAPUA== X-IronPort-AV: E=Sophos;i="5.76,360,1592895600"; d="scan'208";a="339608214" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.213.179.54]) ([10.213.179.54]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2020 11:13:49 -0700 Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack To: Florian Weimer , "H.J. Lu" Cc: Dave Martin , Dave Hansen , Andy Lutomirski , 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 , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Weijiang Yang References: <20200825002540.3351-1-yu-cheng.yu@intel.com> <20200825002540.3351-26-yu-cheng.yu@intel.com> <2d253891-9393-44d0-35e0-4b9a2da23cec@intel.com> <086c73d8-9b06-f074-e315-9964eb666db9@intel.com> <73c2211f-8811-2d9f-1930-1c5035e6129c@intel.com> <20200826164604.GW6642@arm.com> <87ft892vvf.fsf@oldenburg2.str.redhat.com> <20200826170841.GX6642@arm.com> <87tuwow7kg.fsf@oldenburg2.str.redhat.com> <873648w6qr.fsf@oldenburg2.str.redhat.com> From: "Yu, Yu-cheng" Message-ID: Date: Thu, 27 Aug 2020 11:13:48 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <873648w6qr.fsf@oldenburg2.str.redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: B42B7180B3C83 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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 8/27/2020 6:36 AM, Florian Weimer wrote: > * H. J. Lu: > >> On Thu, Aug 27, 2020 at 6:19 AM Florian Weimer wrote: >>> >>> * Dave Martin: >>> >>>> You're right that this has implications: for i386, libc probably pulls >>>> more arguments off the stack than are really there in some situations. >>>> This isn't a new problem though. There are already generic prctls with >>>> fewer than 4 args that are used on x86. >>> >>> As originally posted, glibc prctl would have to know that it has to pull >>> an u64 argument off the argument list for ARCH_X86_CET_DISABLE. But >>> then the u64 argument is a problem for arch_prctl as well. >>> >> >> Argument of ARCH_X86_CET_DISABLE is int and passed in register. > > The commit message and the C source say otherwise, I think (not sure > about the C source, not a kernel hacker). > H.J. Lu suggested that we fix x86 arch_prctl() to take four arguments, and then keep MMAP_SHSTK as an arch_prctl(). Because now the map flags and size are all in registers, this also solves problems being pointed out earlier. Without a wrapper, the shadow stack mmap call (from user space) will be: syscall(_NR_arch_prctl, ARCH_X86_CET_MMAP_SHSTK, size, MAP_32BIT). I think this would be a nice alternative to another new syscall. If this looks good to everyone, I can send out new patches as response to my current version, and then after all issues fixed, send v12. Thanks, Yu-cheng