From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [RFC PATCH v2 25/27] x86/cet: Add PTRACE interface for CET Date: Wed, 11 Jul 2018 12:20:35 +0200 Message-ID: <20180711102035.GB8574@gmail.com> References: <20180710222639.8241-1-yu-cheng.yu@intel.com> <20180710222639.8241-26-yu-cheng.yu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20180710222639.8241-26-yu-cheng.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org To: Yu-cheng Yu 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 , Cyrill Gorcunov , Dave Hansen , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek Peter List-Id: linux-arch.vger.kernel.org * Yu-cheng Yu wrote: > Add PTRACE interface for CET MSRs. Please *always* describe new ABIs in the changelog, in a precise, well-documented way. > diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c > index e2ee403865eb..ac2bc3a18427 100644 > --- a/arch/x86/kernel/ptrace.c > +++ b/arch/x86/kernel/ptrace.c > @@ -49,7 +49,9 @@ enum x86_regset { > REGSET_IOPERM64 = REGSET_XFP, > REGSET_XSTATE, > REGSET_TLS, > + REGSET_CET64 = REGSET_TLS, > REGSET_IOPERM32, > + REGSET_CET32, > }; Why does REGSET_CET64 alias on REGSET_TLS? > struct pt_regs_offset { > @@ -1276,6 +1278,13 @@ static struct user_regset x86_64_regsets[] __ro_after_init = { > .size = sizeof(long), .align = sizeof(long), > .active = ioperm_active, .get = ioperm_get > }, > + [REGSET_CET64] = { > + .core_note_type = NT_X86_CET, > + .n = sizeof(struct cet_user_state) / sizeof(u64), > + .size = sizeof(u64), .align = sizeof(u64), > + .active = cetregs_active, .get = cetregs_get, > + .set = cetregs_set > + }, Ok, could we first please make this part of the regset code more readable and start the series with a standalone clean-up patch that changes these initializers to something more readable: [REGSET_CET64] = { .core_note_type = NT_X86_CET, .n = sizeof(struct cet_user_state) / sizeof(u64), .size = sizeof(u64), .align = sizeof(u64), .active = cetregs_active, .get = cetregs_get, .set = cetregs_set }, ? (I'm demonstrating the cleanup based on REGSET_CET64, but this should be done on every other entry first.) > --- a/include/uapi/linux/elf.h > +++ b/include/uapi/linux/elf.h > @@ -401,6 +401,7 @@ typedef struct elf64_shdr { > #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ > #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ > #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ > +#define NT_X86_CET 0x203 /* x86 cet state */ Acronyms in comments should be in capital letters. Also, I think I asked this before: why does "Control Flow Enforcement" abbreviate to "CET" (which is a well-known acronym for "Central European Time"), not to CFE? Thanks, Ingo From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com ([74.125.82.66]:55653 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732466AbeGKKYQ (ORCPT ); Wed, 11 Jul 2018 06:24:16 -0400 Date: Wed, 11 Jul 2018 12:20:35 +0200 From: Ingo Molnar Subject: Re: [RFC PATCH v2 25/27] x86/cet: Add PTRACE interface for CET Message-ID: <20180711102035.GB8574@gmail.com> References: <20180710222639.8241-1-yu-cheng.yu@intel.com> <20180710222639.8241-26-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180710222639.8241-26-yu-cheng.yu@intel.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Yu-cheng Yu 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 , Cyrill Gorcunov , Dave Hansen , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , "Ravi V. Shankar" , Vedvyas Shanbhogue Message-ID: <20180711102035.Ba0xixf-XHHk7SJlAteRNsPv37ktGDaf1FuHmOk-sRI@z> * Yu-cheng Yu wrote: > Add PTRACE interface for CET MSRs. Please *always* describe new ABIs in the changelog, in a precise, well-documented way. > diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c > index e2ee403865eb..ac2bc3a18427 100644 > --- a/arch/x86/kernel/ptrace.c > +++ b/arch/x86/kernel/ptrace.c > @@ -49,7 +49,9 @@ enum x86_regset { > REGSET_IOPERM64 = REGSET_XFP, > REGSET_XSTATE, > REGSET_TLS, > + REGSET_CET64 = REGSET_TLS, > REGSET_IOPERM32, > + REGSET_CET32, > }; Why does REGSET_CET64 alias on REGSET_TLS? > struct pt_regs_offset { > @@ -1276,6 +1278,13 @@ static struct user_regset x86_64_regsets[] __ro_after_init = { > .size = sizeof(long), .align = sizeof(long), > .active = ioperm_active, .get = ioperm_get > }, > + [REGSET_CET64] = { > + .core_note_type = NT_X86_CET, > + .n = sizeof(struct cet_user_state) / sizeof(u64), > + .size = sizeof(u64), .align = sizeof(u64), > + .active = cetregs_active, .get = cetregs_get, > + .set = cetregs_set > + }, Ok, could we first please make this part of the regset code more readable and start the series with a standalone clean-up patch that changes these initializers to something more readable: [REGSET_CET64] = { .core_note_type = NT_X86_CET, .n = sizeof(struct cet_user_state) / sizeof(u64), .size = sizeof(u64), .align = sizeof(u64), .active = cetregs_active, .get = cetregs_get, .set = cetregs_set }, ? (I'm demonstrating the cleanup based on REGSET_CET64, but this should be done on every other entry first.) > --- a/include/uapi/linux/elf.h > +++ b/include/uapi/linux/elf.h > @@ -401,6 +401,7 @@ typedef struct elf64_shdr { > #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ > #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ > #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ > +#define NT_X86_CET 0x203 /* x86 cet state */ Acronyms in comments should be in capital letters. Also, I think I asked this before: why does "Control Flow Enforcement" abbreviate to "CET" (which is a well-known acronym for "Central European Time"), not to CFE? Thanks, Ingo