Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3113142pxa; Tue, 25 Aug 2020 11:46:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8VLTddURDbQ7efpQGXq4b+rZiZepZrBtFur4cnjqHgMeIUr5a9K4nr/iydb5wvtGxFJ5A X-Received: by 2002:a17:906:7d90:: with SMTP id v16mr11970960ejo.27.1598381216311; Tue, 25 Aug 2020 11:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598381216; cv=none; d=google.com; s=arc-20160816; b=CVGD821sv3YDReT6qMVgwLZvswzUd73zPGi6vaV1yw8POEEW90eTMfl1bxHvmR0fBM ulw8Gyw2s17eRjJJSe99b09txScGG/Z8C/38q9bPcRmOezB9GckfJkvPRVL+gIPNoSAK xMQacLnsNdofH5m32fEBq0+unKOCDZ/uYqycX1Mcnl6ahTDrFAC4P6Uqju4RKk5apmuI 9uXFQSWB4F/zvpoDZ8qslrCeuR5M+6zWvHdkow01vyCUQtnAY6SeIHz8UDOu3QGpM5+z YEU43Nl6eVJ/iit6EY9Xj95RTQlNN/FUQDozJZOBZiRM8KLTAMqrzUUJANGZVUyYigpp 2hNg== 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=mnCqjr34qKHWgkRcJ+rD7guyedq5Xu5dPTpPts2F6ds=; b=D6iGt6M0TJ1nXO0tFMDcpDRFLx+6nsEWBXF75Sl9tsbk2CjlQoU3LyR8JeLdLhTZTg oVdIdpoBz3DaDZuC9opM+Wym1ITsZpaZR4oVzkF/vTfRhlnXCXq4ekFJnXevtty1OD3p xLVY8AxZOb0LOSIsQiPhPjllNidTAV5LKOJZXQmq8617Vf47O7caSUNa6x+hVBHRzItZ 74WcynWOpjAkmOA1X3jkhY6TVZ9eSzxi/VRR98/FmnwB6mL1oCpq0PiqzCXgxEeqj+CI U5li2tEmJcVF7EfpP07jcZDyHENGjKpVkFXlYjH64RwWNgrhMm014+rO8jpE7zWLU6CO Wnng== 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 p62si11301253edb.9.2020.08.25.11.46.33; Tue, 25 Aug 2020 11:46:56 -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 S1726429AbgHYSny (ORCPT + 99 others); Tue, 25 Aug 2020 14:43:54 -0400 Received: from mga14.intel.com ([192.55.52.115]:12410 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726090AbgHYSnx (ORCPT ); Tue, 25 Aug 2020 14:43:53 -0400 IronPort-SDR: m4yz0HROXZ6HZHWPpqSWLqH4xlzxUW5911DRcp6s3J96xOmtJXoOKIw3etxahgiQvP3qMf/sTu 3Db6of0SNJig== X-IronPort-AV: E=McAfee;i="6000,8403,9723"; a="155439471" X-IronPort-AV: E=Sophos;i="5.76,353,1592895600"; d="scan'208";a="155439471" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2020 11:43:53 -0700 IronPort-SDR: qetOCdbrXhUWR50LkuRroCI0FBVBMcDQk5TuarjRNg+/M+0SIrJkeab98uN4ag6jhMxZrjXlKR d/7/Qx64Pq9g== X-IronPort-AV: E=Sophos;i="5.76,353,1592895600"; d="scan'208";a="322866093" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.213.162.112]) ([10.213.162.112]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2020 11:43:52 -0700 Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack To: 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> From: "Yu, Yu-cheng" Message-ID: <2d253891-9393-44d0-35e0-4b9a2da23cec@intel.com> Date: Tue, 25 Aug 2020 11:43:51 -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: 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/24/2020 5:36 PM, Andy Lutomirski wrote: > On Mon, Aug 24, 2020 at 5:30 PM Yu-cheng Yu 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? I think this is more arch-specific. Even if it becomes a new syscall, we still need to pass the same parameters. Yu-cheng