Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp628594pxa; Thu, 27 Aug 2020 11:17:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxA4W6j2Wxjwz1tJzPZIATOSIyB7c+CuCIOvzhIPXHW23NCHPQP9dCJfLPogmftAcs9HYUC X-Received: by 2002:a17:906:4b0d:: with SMTP id y13mr22165080eju.39.1598552226957; Thu, 27 Aug 2020 11:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598552226; cv=none; d=google.com; s=arc-20160816; b=aNrMwwktbAa/zc9xFRmh+uyhC6InVG+Tt7IjLOuH+Y2j7cWFiLuoL2HjyLxAWsgeC1 APLmFtoeSJeV8eDcSzc17X0hhfOkvWDYgqrCX+5IiyFeFMOT+wAhZTPmSI0ZuBtLXdHE 6K0htn2tAI2Z5mUnBAirdJHUfX7vLJdZR4Fm1NgC6a/Px6y2gqgWYXBAQ8lKSeOQdpLz dhLvgz7pf+sUuj6SJDEd3eapFEmfKm/Yatrb4Ha0N9nJdoEHQTG58WHkDONuYhNOSGzq X9VF2MZ8NG0nUpVVQz0qoTedqfXaxMVaFxYq2Cx4jNIDaqACuq2GPg16va5A3zlC+CCt VV+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=cLOxLCK+AcoDJoesRPf5XAWK1rbFbc/TPRvhatt5N2M=; b=Bq58YNfNjzryCB42kHoyHpzrGaEHUyibc3Pnjl6z6yQbaHivZ9y9r++VWmqtZbM3z5 tI11pQSsO2Eo+Pd4i0dJ1hqr54dlMlbRfCiyLpg+jaREvGfNduRijt/1VhkzG9XjRybq 5ST6Hmg/6xwYklCJ54wba8lWNR3yRDLjzkSiM7HaxwGBBHZ++KXny9Jse8RNQqUdjmif 28QIJ61gmtdFtxrHAp9Btdgf2F6Ezvc6zX8qV7/m9+hCWMaMstoNa/xIt4bQhZq8Y8Qj e1EOwaCVWE4dm8McRFiTYIVvDiv47s363g9ZbzJLAnw48rtkL/LhcVaHbfpu8uIvLcdf L3Bg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si2028021eds.209.2020.08.27.11.16.43; Thu, 27 Aug 2020 11:17:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726873AbgH0SNy (ORCPT + 99 others); Thu, 27 Aug 2020 14:13:54 -0400 Received: from mga17.intel.com ([192.55.52.151]:48462 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726243AbgH0SNy (ORCPT ); Thu, 27 Aug 2020 14:13:54 -0400 IronPort-SDR: WrnzObmuJOy57JjsYfD0y8fTXE8Bra6ttBhMYXfvLG78kKPXzT0MTLrU8vnsQtqx3j026zSFwR +TGDvmuuDc8A== X-IronPort-AV: E=McAfee;i="6000,8403,9726"; a="136609330" X-IronPort-AV: E=Sophos;i="5.76,360,1592895600"; d="scan'208";a="136609330" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2020 11:13:53 -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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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