Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3189518pxa; Tue, 25 Aug 2020 14:05:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4rCXApzsD6xHrrDtba3vKqaBlsO4JFMjCNswHHLV79UPemwv84uiiWDcbeihlJpD7B5JJ X-Received: by 2002:a17:906:4f8f:: with SMTP id o15mr12200103eju.220.1598389542942; Tue, 25 Aug 2020 14:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598389542; cv=none; d=google.com; s=arc-20160816; b=jQo4gqXGEFsdSh6u8UEDSI4XbVwev25xgXpSwalxOS4zhkJUIVUuUW+jAqfcOGzGQC tgNWlLoaSf8U+SeqtzViiupCrL+k8yvopMoiNYIkbQblFnNO9YCTNBRtM6pzJga7UH0p zqDueHnQkLc4tm4X3fXK5NT92vhxDIp7sHqMtGzMswR8v77rIHfQwZNZE4/0T2aezfaQ 6DCBPEY1jVDQxa2bg1j2NqFwg+pS8cpdAAulI4xvBhTsc+Ia/IW2pAXAHVt8+xYNhtxv ki5Cv/AK5aZ9tOhtn/2CYCoJmRZKkHzEH2J4ooEnECI5mT2UFYg3Luu6UGGd0SUzzD2z 9ZrQ== 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=69EalKtecaF5SKHmOE5avK4gh0YTA/Q2/u29QR/N2Uo=; b=FR98MngbuOwG+J3qg5512lCTiixmUx9/SOozQbc9x0Hdb7mJ0myvzDMqPYHGude3nb VD5tp3qj2IvIYfZU2w01K6yomZPRixDv//0SwH8221EVphcUlETmd+WO1NZEhmmMbi49 8oA/ZDf/GPTDQVXMvkrONf+TQYERJ+Y7ReeCsaVa40zX/HC/sQmQG7fn53amXSwMzHHc yxCXwbRO2sWW0/xoC0R2Kg5uMhwKhh+4ERGLY8r+Wa0OvsSKHqrpDXzDioM+lfbmHkJq +OKOMrt+HMx0VjiAC8VfdWLflxsHmXKFAWQ2jgOmWdwkn6SEk2HC3ufxfvF2SPnYU8np PkbA== 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 ch7si123600ejb.689.2020.08.25.14.04.56; Tue, 25 Aug 2020 14:05:42 -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 S1726578AbgHYVEE (ORCPT + 99 others); Tue, 25 Aug 2020 17:04:04 -0400 Received: from mga09.intel.com ([134.134.136.24]:21941 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726149AbgHYVED (ORCPT ); Tue, 25 Aug 2020 17:04:03 -0400 IronPort-SDR: r/MA08np3fu6fS50FTj6C0nofkAHd5JqEwR3Du7vbNXPkdLENTy30e+J23ACPvNGSfE96CFRw5 nE44u+/H1WtA== X-IronPort-AV: E=McAfee;i="6000,8403,9724"; a="157238490" X-IronPort-AV: E=Sophos;i="5.76,354,1592895600"; d="scan'208";a="157238490" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2020 14:04:03 -0700 IronPort-SDR: WoRGvY0PoRGbOXpqpJzl8Xjzeiomd80lkvcS9rWmmRwQORlx7kbHU7liFPi0L8I1jnFtU4A5EK gSD7dSjmypQQ== X-IronPort-AV: E=Sophos;i="5.76,354,1592895600"; d="scan'208";a="474507675" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.213.162.112]) ([10.213.162.112]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2020 14:04:01 -0700 Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack To: Dave Hansen , Andy Lutomirski 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 , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , 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> From: "Yu, Yu-cheng" Message-ID: <73c2211f-8811-2d9f-1930-1c5035e6129c@intel.com> Date: Tue, 25 Aug 2020 14:04:00 -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: <086c73d8-9b06-f074-e315-9964eb666db9@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/25/2020 12:19 PM, Dave Hansen wrote: > On 8/25/20 11:43 AM, Yu, Yu-cheng wrote: >>>> arch_prctl(ARCH_X86_CET_MMAP_SHSTK, u64 *args) >>>>      Allocate a new shadow stack. >>>> >>>>      The parameter 'args' is a pointer to a user buffer. >>>> >>>>      *args = desired size >>>>      *(args + 1) = MAP_32BIT or MAP_POPULATE >>>> >>>>      On returning, *args is the allocated shadow stack address. >>> >>> This is hideous.  Would this be better as a new syscall? >> >> Could you point out why this is hideous, so that I can modify the >> arch_prctl? > > Passing values in memory is hideous when we don't have to. A syscall > would let you have separate arguments for size and flags and would also > let you have a nice return value instead of needing to do that in memory > too. That is a good justification. > >> I think this is more arch-specific.  Even if it becomes a new syscall, >> we still need to pass the same parameters. > > Right, but without the copying in and out of memory. > Linux-api is already on the Cc list. Do we need to add more people to get some agreements for the syscall?