From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu-cheng Yu Subject: Re: [PATCH v10 26/26] x86/cet/shstk: Add arch_prctl functions for shadow stack Date: Fri, 22 May 2020 10:17:43 -0700 Message-ID: References: <20200429220732.31602-1-yu-cheng.yu@intel.com> <20200429220732.31602-27-yu-cheng.yu@intel.com> <202005211528.A12B4AD@keescook> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <202005211528.A12B4AD@keescook> Sender: linux-doc-owner@vger.kernel.org To: Kees Cook Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel List-Id: linux-arch.vger.kernel.org On Thu, 2020-05-21 at 15:42 -0700, Kees Cook wrote: > On Wed, Apr 29, 2020 at 03:07:32PM -0700, Yu-cheng Yu wrote: [...] > > + > > +int prctl_cet(int option, u64 arg2) > > +{ > > + struct cet_status *cet; > > + > > + if (!IS_ENABLED(CONFIG_X86_INTEL_CET)) > > + return -EINVAL; > > Using -EINVAL here means userspace can't tell the difference between an > old kernel and a kernel not built with CONFIG_X86_INTEL_CET. Perhaps > -ENOTSUPP? Looked into this. The kernel and GLIBC are not in sync. So maybe we still use EINVAL here? Yu-cheng In kernel: ---------- #define EOPNOTSUPP 95 #define ENOTSUPP 524 In GLIBC: --------- printf("ENOTSUP=%d\n", ENOTSUP); printf("EOPNOTSUPP=%d\n", EOPNOTSUPP); printf("%s=524\n", strerror(524)); ENOTSUP=95 EOPNOTSUPP=95 Unknown error 524=524 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: Subject: Re: [PATCH v10 26/26] x86/cet/shstk: Add arch_prctl functions for shadow stack From: Yu-cheng Yu Date: Fri, 22 May 2020 10:17:43 -0700 In-Reply-To: <202005211528.A12B4AD@keescook> References: <20200429220732.31602-1-yu-cheng.yu@intel.com> <20200429220732.31602-27-yu-cheng.yu@intel.com> <202005211528.A12B4AD@keescook> Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-doc-owner@vger.kernel.org To: Kees Cook Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang List-ID: Message-ID: <20200522171743.T33CoqUN3ak1_4PP0j8CnsiKX5ik1mC25qJelgQsJ2E@z> On Thu, 2020-05-21 at 15:42 -0700, Kees Cook wrote: > On Wed, Apr 29, 2020 at 03:07:32PM -0700, Yu-cheng Yu wrote: [...] > > + > > +int prctl_cet(int option, u64 arg2) > > +{ > > + struct cet_status *cet; > > + > > + if (!IS_ENABLED(CONFIG_X86_INTEL_CET)) > > + return -EINVAL; > > Using -EINVAL here means userspace can't tell the difference between an > old kernel and a kernel not built with CONFIG_X86_INTEL_CET. Perhaps > -ENOTSUPP? Looked into this. The kernel and GLIBC are not in sync. So maybe we still use EINVAL here? Yu-cheng In kernel: ---------- #define EOPNOTSUPP 95 #define ENOTSUPP 524 In GLIBC: --------- printf("ENOTSUP=%d\n", ENOTSUP); printf("EOPNOTSUPP=%d\n", EOPNOTSUPP); printf("%s=524\n", strerror(524)); ENOTSUP=95 EOPNOTSUPP=95 Unknown error 524=524