Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1940131pxk; Tue, 1 Sep 2020 11:21:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/aNXQ/dcW1xaNje5SFUek5n5Rl+W6mQvfL0V6J+JkDQssKno6W8q9mCqS7sJ413EwV+T0 X-Received: by 2002:a05:6402:1d97:: with SMTP id dk23mr3038149edb.350.1598984461716; Tue, 01 Sep 2020 11:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598984461; cv=none; d=google.com; s=arc-20160816; b=CSlfIUapBvVog6BRMe9nfw9BnAHsLASpzzpexsvc2XDIpRM182DFM/k4AwWFm+Zcwu enu8x7iO2Qu3rKjJNm5FlcpUGmr9oOJLJb2jwt39akCvbSmMbJZOhzmBIiRNw+xc6Z11 NP9f8x6vQRQgmk4YDbSJeY+nkUqfVfnCuxF3u1cDXwQBfPOGbY3336YaNuVPLq9/1Z0S gWvUDY6HEE6ZmyyqSihFgdvsQDGpbLrTwxItwyUEVhxIaWLZ0It7Rw1tyyZRG7yImA9y 4nTK3Kt6U6Ibty5fUSdIMjjXzA59slBwuktYfDdXRaQtB2Iez92SZnjCYKar8Cszv/b3 XRjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=cLstzH1LNj+g6CEwT6Bs49sL4xGFgD5yGkJsHn4QoB0=; b=g0aT6zBVp5rRKSsQcVoIvEnTNzlWegTUM/wFM2RsegVD+IVRKUTnNwkeuOR2CpIc3E s4ygqfrGvod1gZ0dnSeYpY2/rv7DC6Z7NbJ3AwVM/fLUnK88IlYgDscR2WUd0ch1f3JS u4Tr58hwWwG/XP6mHG2HHe6eLF3lX+5i2xKzXqiMrdRQvdxxf94/OAfRgo8AXAtiLP8J UvgIdqx+GtlUIQx1WjRVZNqzpS9o0J8ZIpHc6tFOOCRdZYOVeRoRe0Nx7EdaAOrTinc1 r5XcWxPB/fm5fXKyBZDskr+DPv/C50NR8eYHMhjojL+UR3rsi65Xkbc0wXUNZFKYK8do z1KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e3DcllFi; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q12si1208859ejs.273.2020.09.01.11.20.37; Tue, 01 Sep 2020 11:21:01 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e3DcllFi; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730031AbgIASTw (ORCPT + 99 others); Tue, 1 Sep 2020 14:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbgIASTu (ORCPT ); Tue, 1 Sep 2020 14:19:50 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B721C061244; Tue, 1 Sep 2020 11:19:50 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id u126so2356658iod.12; Tue, 01 Sep 2020 11:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cLstzH1LNj+g6CEwT6Bs49sL4xGFgD5yGkJsHn4QoB0=; b=e3DcllFiRd99EFhMW9PLPljTKxeW0vc47NVr96CC+Vzh6dkUK4Mmdgcl1sZq/kJoLz 3gSmb4o3MV+chM/XWnck2/Zy6U7/keXIVgEz6ul7hTS5rc5nzSq0xbh/ySELyvsy9XIl lhjnS4qyrQbLLnuMaEAxGqsrEafBGzFSqtavTwXm8Ld91gWaaYxdXma2DtaUItBrCsZO rBFEQvxDLcIoPbDzdA8dqgJSFMXSmhb7Yy6Z4CsWymvHmVt6CT3Vu2JFpWvDhWC7XIDi pbII5TYx04WFyt8aDKcjv64XYlRzKlnU8AwnIK6LecQEoJlhDlzZTCKQpAjaKs0YXLkK rBBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cLstzH1LNj+g6CEwT6Bs49sL4xGFgD5yGkJsHn4QoB0=; b=YXNIdLVrd9ApRB1gt8TRDCQ1NV1gKC6y7ltZAPl7qHQvTRvOxP6ZElwhkpSl3uWMvb gsJO25nXa9LuXz8gKgiQ8+HFPcD4/WJhvJSB8LEfatek43PM9XB0L6808xerGLp4yeL1 5nRNqNayxA3SI+TnSVlBBET8bKxBINBL9BFL7B1t5clZ2ILDKIDNsQFSdYsaUCyTdDQN 10z+N5di2yRprnQWpDm0/BSTN7BO8lcd0xRwHWALGjL2EULv2i6akRdRVE+PeENgKpqr aDyCD1uL7Akgt1uPXqP5wljSQYPsdrshE4WAJFJyzSCyG1wm1kz9Y8YF0dghINwuVGmo d80Q== X-Gm-Message-State: AOAM531lGP+gtNCQ6IOHOvn/Tj8NfrS8B2ZJ3eQ+T0aXkCjh0UQJXAal jiDnFBMIuWFrf73yMTwWhGpTTHo+s1pyBp3jIJQ= X-Received: by 2002:a05:6602:6c9:: with SMTP id n9mr269234iox.91.1598984389615; Tue, 01 Sep 2020 11:19:49 -0700 (PDT) MIME-Version: 1.0 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> <87k0xdqs3t.fsf@oldenburg2.str.redhat.com> In-Reply-To: <87k0xdqs3t.fsf@oldenburg2.str.redhat.com> From: "H.J. Lu" Date: Tue, 1 Sep 2020 11:19:13 -0700 Message-ID: Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack To: Florian Weimer Cc: "Yu, Yu-cheng" , 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 1, 2020 at 11:17 AM Florian Weimer wrote: > > * 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. > unsigned int is the correct type since only the lower 32 bits are used. -- H.J.