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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 52D53C433E0 for ; Wed, 24 Feb 2021 19:53:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0EFC764F07 for ; Wed, 24 Feb 2021 19:53:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234340AbhBXTxR (ORCPT ); Wed, 24 Feb 2021 14:53:17 -0500 Received: from mga11.intel.com ([192.55.52.93]:56215 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232392AbhBXTxQ (ORCPT ); Wed, 24 Feb 2021 14:53:16 -0500 IronPort-SDR: DT67NmJxOc44P4KRo695ALANGfG2/Bi+mPFp3Ienf2hc5iGT7zgL6V0kfqZDgABtxDoT5zYWrP +fBQKfoyMjaA== X-IronPort-AV: E=McAfee;i="6000,8403,9905"; a="181865671" X-IronPort-AV: E=Sophos;i="5.81,203,1610438400"; d="scan'208";a="181865671" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 11:52:34 -0800 IronPort-SDR: yXEcVzW98djE749wmWJeznbw7y/eWDKIg2JFChUy2uVPACaW3lKFTSPh+w1NRB+Semm7HIGoQg 1PmH0DR7BcFQ== X-IronPort-AV: E=Sophos;i="5.81,203,1610438400"; d="scan'208";a="431800681" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.212.35.50]) ([10.212.35.50]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 11:52:33 -0800 Subject: Re: [PATCH v21 06/26] x86/cet: Add control-protection fault handler To: Borislav Petkov , 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 , 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 , Pengfei Xu , Haitao Huang , Michael Kerrisk References: <20210217222730.15819-1-yu-cheng.yu@intel.com> <20210217222730.15819-7-yu-cheng.yu@intel.com> <20210224161343.GE20344@zn.tnic> <32ac05ef-b50b-c947-095d-bc31a42947a3@intel.com> <20210224165332.GF20344@zn.tnic> <20210224192044.GH20344@zn.tnic> <20210224194204.GI20344@zn.tnic> From: "Yu, Yu-cheng" Message-ID: Date: Wed, 24 Feb 2021 11:52:33 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210224194204.GI20344@zn.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On 2/24/2021 11:42 AM, Borislav Petkov wrote: > On Wed, Feb 24, 2021 at 11:30:34AM -0800, Andy Lutomirski wrote: >> On Wed, Feb 24, 2021 at 11:20 AM Borislav Petkov wrote: >>> >>> On Wed, Feb 24, 2021 at 09:56:13AM -0800, Yu, Yu-cheng wrote: >>>> No. Maybe I am doing too much. The GP fault sets si_addr to zero, for >>>> example. So maybe do the same here? >>> >>> No, you're looking at this from the wrong angle. This is going to be >>> user-visible and the moment it gets upstream, it is cast in stone. >>> >>> So the whole use case of what luserspace needs to do or is going to do >>> or wants to do on a SEGV_CPERR, needs to be described, agreed upon by >>> people etc before it goes out. And thus clarified whether the address >>> gets copied out or not. >> >> I vote 0. The address is in ucontext->gregs[REG_RIP] [0] regardless. >> Why do we need to stick a copy somewhere else? >> >> [0] or however it's spelled. i can never remember. > > Fine with me. Let's have this documented in the manpage and then we can > move forward with this. > > Thx. > The man page at https://man7.org/linux/man-pages/man2/sigaction.2.html says, SIGILL, SIGFPE, SIGSEGV, SIGBUS, and SIGTRAP fill in si_addr with the address of the fault. But it is not entirely true. I will send a patch to update it, and another patch for the si_code. -- Yu-cheng