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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 B07A8C433E6 for ; Tue, 1 Sep 2020 18:17:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A5F6206FA for ; Tue, 1 Sep 2020 18:17:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CpAGYNbF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729239AbgIASRv (ORCPT ); Tue, 1 Sep 2020 14:17:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28658 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726126AbgIASRt (ORCPT ); Tue, 1 Sep 2020 14:17:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598984267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xRx7F9H7ZUnV1Tk9T9gZ3S6OyItYjcc54MDMYPipm7o=; b=CpAGYNbF7gSPT00zwC8l3yONuZyfyNITDeG7v6/nVqdO2AfBd8XwsS7bMOrm3lap3yshwF VeowAnxXsAZOVNuRzFY5SCkSj825uLw+J2wli9gp5+dChk1JKbJkzsWrVhXRGD+Tbm2DCN VU5TqMJSU7lf0TvyHBiFcAd+WL8JN6Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434-NkNJeA5tOReQGAd9lgnT0Q-1; Tue, 01 Sep 2020 14:17:43 -0400 X-MC-Unique: NkNJeA5tOReQGAd9lgnT0Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 114128015C5; Tue, 1 Sep 2020 18:17:40 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-113-228.ams2.redhat.com [10.36.113.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6AB677C558; Tue, 1 Sep 2020 18:17:28 +0000 (UTC) From: Florian Weimer To: "Yu, Yu-cheng" Cc: "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 Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack 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> <3c12b6ee-7c93-dcf4-fbf7-2698003386dd@intel.com> <87o8mpqtcn.fsf@oldenburg2.str.redhat.com> Date: Tue, 01 Sep 2020 20:17:26 +0200 In-Reply-To: (Yu-cheng Yu's message of "Tue, 1 Sep 2020 10:58:25 -0700") Message-ID: <87k0xdqs3t.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Yu-cheng Yu: > On 9/1/2020 10:50 AM, Florian Weimer wrote: >> * Yu-cheng Yu: >> >>> Like other arch_prctl()'s, this parameter was 'unsigned long' >>> earlier. The idea was, since this arch_prctl is only implemented for >>> the 64-bit kernel, we wanted it to look as 64-bit only. I will change >>> it back to 'unsigned long'. >> What about x32? In general, long is rather problematic for x32. > > The problem is the size of 'long', right? > Because this parameter is passed in a register, and only the lower > bits are used, x32 works as well. The userspace calling convention leaves the upper 32-bit undefined. Therefore, this only works by accident if the kernel does not check that the upper 32-bit are zero, which is probably a kernel bug. It's unclear to me what you are trying to accomplish. Why do you want to use unsigned long here? The correct type appears to be unsigned int. This correctly expresses that the upper 32 bits of the register do not matter. Thanks, Florian 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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 47D09C433E2 for ; Tue, 1 Sep 2020 18:17:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D252320866 for ; Tue, 1 Sep 2020 18:17:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CpAGYNbF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D252320866 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B50E06B00BC; Tue, 1 Sep 2020 14:17:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B02AC6B00C9; Tue, 1 Sep 2020 14:17:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F0496B00CB; Tue, 1 Sep 2020 14:17:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id 893FB6B00BC for ; Tue, 1 Sep 2020 14:17:50 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 44EBF180AD815 for ; Tue, 1 Sep 2020 18:17:50 +0000 (UTC) X-FDA: 77215301100.12.land23_4815a0d2709a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 98B821800EC5A for ; Tue, 1 Sep 2020 18:17:48 +0000 (UTC) X-HE-Tag: land23_4815a0d2709a X-Filterd-Recvd-Size: 5246 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Sep 2020 18:17:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598984267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xRx7F9H7ZUnV1Tk9T9gZ3S6OyItYjcc54MDMYPipm7o=; b=CpAGYNbF7gSPT00zwC8l3yONuZyfyNITDeG7v6/nVqdO2AfBd8XwsS7bMOrm3lap3yshwF VeowAnxXsAZOVNuRzFY5SCkSj825uLw+J2wli9gp5+dChk1JKbJkzsWrVhXRGD+Tbm2DCN VU5TqMJSU7lf0TvyHBiFcAd+WL8JN6Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434-NkNJeA5tOReQGAd9lgnT0Q-1; Tue, 01 Sep 2020 14:17:43 -0400 X-MC-Unique: NkNJeA5tOReQGAd9lgnT0Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 114128015C5; Tue, 1 Sep 2020 18:17:40 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-113-228.ams2.redhat.com [10.36.113.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6AB677C558; Tue, 1 Sep 2020 18:17:28 +0000 (UTC) From: Florian Weimer To: "Yu, Yu-cheng" Cc: "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 Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack 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> <3c12b6ee-7c93-dcf4-fbf7-2698003386dd@intel.com> <87o8mpqtcn.fsf@oldenburg2.str.redhat.com> Date: Tue, 01 Sep 2020 20:17:26 +0200 In-Reply-To: (Yu-cheng Yu's message of "Tue, 1 Sep 2020 10:58:25 -0700") Message-ID: <87k0xdqs3t.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Rspamd-Queue-Id: 98B821800EC5A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: * Yu-cheng Yu: > On 9/1/2020 10:50 AM, Florian Weimer wrote: >> * Yu-cheng Yu: >> >>> Like other arch_prctl()'s, this parameter was 'unsigned long' >>> earlier. The idea was, since this arch_prctl is only implemented for >>> the 64-bit kernel, we wanted it to look as 64-bit only. I will change >>> it back to 'unsigned long'. >> What about x32? In general, long is rather problematic for x32. > > The problem is the size of 'long', right? > Because this parameter is passed in a register, and only the lower > bits are used, x32 works as well. The userspace calling convention leaves the upper 32-bit undefined. Therefore, this only works by accident if the kernel does not check that the upper 32-bit are zero, which is probably a kernel bug. It's unclear to me what you are trying to accomplish. Why do you want to use unsigned long here? The correct type appears to be unsigned int. This correctly expresses that the upper 32 bits of the register do not matter. Thanks, Florian