Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp950644imm; Wed, 11 Jul 2018 14:04:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc5CL2k7deT+v+2bA1HSHK0EhhtefQ3WKrKqN4x6sIaBKdIQdUgmR4ZUrx1vkPxtblvYhW7 X-Received: by 2002:a17:902:e3:: with SMTP id a90-v6mr188688pla.227.1531343097054; Wed, 11 Jul 2018 14:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531343097; cv=none; d=google.com; s=arc-20160816; b=rUWQxvCD849tKb7QbbssDINtUfd22gep5E52STDMYjzIh7V0kK8Xkyxa2S6kmXZI/z YDZnWd9zxYvbzCV5Ac4X8EdMpYYh4RQUEfjXN7MQ6OdpJLbZBdtz4uLC5ulFls6cwmfk bF8OBZ8FaYq/Uh6YQAfM2EewFfm4dM0kZcuJs3MqraIyprUMw2R3a8M/25TLAk0y1+fu /8VgMMhFctTm4cvs/rW7cT+2dNObbGBNlk3W1yF+VzMm5u4oXzFRCHf9M6t38jdT036M BTqgzISJi7Kes7NFOL2OK+IjYxPbinY8oSigNM2ItdJHXBFpIMIRZCMusXlYkfKiQHXu ZRGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=9xN3Q8iI2IgAjZb1bbYSB8028/DFSyGiCfLXAVG+MSs=; b=qB29SPkmHThFNj4mg9P8Q+/RG4T223eeQL957OnpcFg0bHRPWw+S85URuwHXdz3/H0 hVhdQ2fhCKNWyP7RVxUNOqlmIONNHKmO1L/U3Pyeawu5tWdibLME00jIdpiI5UpcBFH6 QBquvjUOPj9qTAbUKgg7IiVc23BU03AruB59nR0cSun9raGzWfZ9aztc+ohM10o+MkB8 gGCrL5iFXweVB/QE6v88BIA3Iwago4okcCsPAxCabJx+lZ0QvGdkqjbpgQ5agZk5un8Q v/L+zC12kOJ7aaqEywJm+PGcMiimvRBGeSG9uGhWaWHPaQoLW0UyHns0YC3348LiuJtl hJug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j66-v6si20443298pfc.243.2018.07.11.14.04.41; Wed, 11 Jul 2018 14:04:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389349AbeGKPtS (ORCPT + 99 others); Wed, 11 Jul 2018 11:49:18 -0400 Received: from mga04.intel.com ([192.55.52.120]:8554 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732819AbeGKPtS (ORCPT ); Wed, 11 Jul 2018 11:49:18 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2018 08:44:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,338,1526367600"; d="scan'208";a="56861618" Received: from 2b52.sc.intel.com ([143.183.136.52]) by orsmga006.jf.intel.com with ESMTP; 11 Jul 2018 08:44:16 -0700 Message-ID: <1531323638.13297.24.camel@intel.com> Subject: Re: [RFC PATCH v2 25/27] x86/cet: Add PTRACE interface for CET From: Yu-cheng Yu To: Ingo Molnar 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 Date: Wed, 11 Jul 2018 08:40:38 -0700 In-Reply-To: <20180711102035.GB8574@gmail.com> References: <20180710222639.8241-1-yu-cheng.yu@intel.com> <20180710222639.8241-26-yu-cheng.yu@intel.com> <20180711102035.GB8574@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-07-11 at 12:20 +0200, Ingo Molnar wrote: > * Yu-cheng Yu wrote: > > > > > Add PTRACE interface for CET MSRs. > Please *always* describe new ABIs in the changelog, in a precise, > well-documented  > way. Ok! > > > > 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? In x86_64_regsets[], there is no [REGSET_TLS].  The core dump code cannot handle holes in the array. > > > > >  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.) > I will fix it. > > > > > --- 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? > I don't know if I can change that, will find out. Thanks, Yu-cheng