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,URIBL_BLOCKED,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 8B0FDC433DF for ; Thu, 27 Aug 2020 19:34:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 53CD920714 for ; Thu, 27 Aug 2020 19:34:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53CD920714 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 D8B436B0002; Thu, 27 Aug 2020 15:34:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D39FA6B0003; Thu, 27 Aug 2020 15:34:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C021D6B0006; Thu, 27 Aug 2020 15:34:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AAE796B0002 for ; Thu, 27 Aug 2020 15:34:02 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6A58240FB for ; Thu, 27 Aug 2020 19:34:02 +0000 (UTC) X-FDA: 77197349124.02.trail15_24105e12706f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 33A8510097AA2 for ; Thu, 27 Aug 2020 19:34:02 +0000 (UTC) X-HE-Tag: trail15_24105e12706f X-Filterd-Recvd-Size: 4827 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Thu, 27 Aug 2020 19:34:00 +0000 (UTC) IronPort-SDR: Dcy03W2xv+83te3jcSqx4zH4JkWpxabuSMS45uEzWQDulOW5CycSBNZEiff0b/oFa/G6oAlN2K LjNOKBia/xyw== X-IronPort-AV: E=McAfee;i="6000,8403,9726"; a="154106615" X-IronPort-AV: E=Sophos;i="5.76,360,1592895600"; d="scan'208";a="154106615" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2020 12:33:58 -0700 IronPort-SDR: OPISa7thH3ifFl2p+owBLIitIqmZbW/hl+EP5wSwNVukJNFhzMv4wB+31X5KIa136wfknEKV7P 7teTxH4ipSsQ== X-IronPort-AV: E=Sophos;i="5.76,360,1592895600"; d="scan'208";a="500229981" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.213.179.54]) ([10.213.179.54]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2020 12:33:57 -0700 Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack To: Andy Lutomirski Cc: Florian Weimer , "H.J. Lu" , 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: <4BDFD364-798C-4537-A88E-F94F101F524B@amacapital.net> From: "Yu, Yu-cheng" Message-ID: Date: Thu, 27 Aug 2020 12:33:56 -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: <4BDFD364-798C-4537-A88E-F94F101F524B@amacapital.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Queue-Id: 33A8510097AA2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 Content-Transfer-Encoding: quoted-printable 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 11:56 AM, Andy Lutomirski wrote: >=20 >=20 >> On Aug 27, 2020, at 11:13 AM, Yu, Yu-cheng wro= te: >> >> =EF=BB=BFOn 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 situat= ions. >>>>>>> This isn't a new problem though. There are already generic prctl= s with >>>>>>> fewer than 4 args that are used on x86. >>>>>> >>>>>> As originally posted, glibc prctl would have to know that it has t= o pull >>>>>> an u64 argument off the argument list for ARCH_X86_CET_DISABLE. B= ut >>>>>> 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 ou= t earlier. Without a wrapper, the shadow stack mmap call (from user spac= e) will be: >> >> syscall(_NR_arch_prctl, ARCH_X86_CET_MMAP_SHSTK, size, MAP_32BIT). >=20 > I admit I don=E2=80=99t see a show stopping technical reason we can=E2=80= =99t add arguments to an existing syscall, but I=E2=80=99m pretty sure it= =E2=80=99s unprecedented, and it doesn=E2=80=99t seem like a good idea. >=20 There are nine existing arch_prctl calls now. If the concern is the=20 extra new arguments getting misused, we can mask them out for the=20 existing calls. Otherwise, I have not seen anything that can break. Yu-cheng