Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp336891imm; Wed, 11 Jul 2018 03:25:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdMVpNCKFCdKpNwMvrgGggt2cYuPmSSGhYF1AspoHuohDzfo0xKYEecXx3aEERZ4/i5ojQz X-Received: by 2002:a65:48cd:: with SMTP id o13-v6mr25121881pgs.99.1531304709362; Wed, 11 Jul 2018 03:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531304709; cv=none; d=google.com; s=arc-20160816; b=KUjQkpoYzukb4H1W8vUgtzEBlY98DvBrPeMm4FPYjzUW1VG/TK89NuNL00l43YbTDL k93cz8JVfil5MDbGy5Mc/rK9cTKbe07EVo7mzJD2aKXhG2ibKCtdmuLsTJwDOXw+ig23 CFEmio3PBCSxxss5PNilRXjng8gqwEgaQTEdov+i3us4s5SEO9GMhkwRxqQLukKW6dzx iSKE5/FKlZAgeW/sIciMPQO9so/fgASnQODhQyi2/7p7ck+FGSdfRQlpYFFzms5MHgfj cFdKt7HpQIvNEC1IpEui5lft8aOhUwtEga4uQaz5e+MhFzYuFEIYBFbqRFqt8F5XF6jI C/QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=nSp3+wzsdAhxLCvXlZ+mk8sdJkEDYAeAFB3cwn5eQZE=; b=ec3wYV8vfFm11uuu1ThxU4siCuFMRkxLTU9JCf1JQzv3jc5ZY5PTgsCoKGwTkdrwlu JfWOiLG+Qy7lPuuwV5d1l5y9sPn1RhW7tdLuBLF24lnW6iyzD6rkrE7Yzl7tO2aFMZMn h74utdaWeE7t6RHcYCJZtIdToDLnxw2JQJC/dbYOEURroTCQJjm32odQc4Ik9f/psast S7z8t1mpnjnX/6Ph4NK4isNf680wz5Cf9mZuuGns+BKnmG1gEblWUdi3giPAzBPZUNe0 Xt88HHCA+CjL5SrSB4yBE4WSVWMcU5gW86gKN1ij29g0tTI3AaCg4NKgLMcmdyuZedL0 Pefw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=aKZ8ryFY; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x11-v6si6687494pgv.669.2018.07.11.03.24.54; Wed, 11 Jul 2018 03:25:09 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=aKZ8ryFY; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732536AbeGKKYR (ORCPT + 99 others); Wed, 11 Jul 2018 06:24:17 -0400 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 Received: by mail-wm0-f66.google.com with SMTP id v128-v6so1872495wme.5; Wed, 11 Jul 2018 03:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nSp3+wzsdAhxLCvXlZ+mk8sdJkEDYAeAFB3cwn5eQZE=; b=aKZ8ryFYidsJqErEl30iE3sVb8LmUVOGPG2IhTJViJlBK4yWdeBW97puG2sy0jkIBs FyOOU90ordpLFEPLRMGJzFiAIm14hHJ0bZvZtQmSUUjtzmWLxUGRZuFoK5zc5bxQg5V/ 8jigbqrf1ut60Dr/ZIu3K3HiGaNXmWFr49D7dTASJ5cXf/1khfnf1gSZj6hb1vWp2QXd vjetvwGzjdV+pIalBAoztCwOXxyQuidJ92nrLC1geJmGuAhSAquruDWamDvdEMt07BFj 5yBfi5zQWCIZLUYX8qCnMib2vPtUYkTEt1q8WL36++kWFeHEgDzDXFJZvxrEwHMsVsF5 IAJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=nSp3+wzsdAhxLCvXlZ+mk8sdJkEDYAeAFB3cwn5eQZE=; b=nhdwpWD3zu2Jbe12wj/DisUPlnlGS2aBo0pSPCI2m/QrK01YExf78P4jr6EkpOZ92d +MbvV2PVhAEf6X8qbpqnlQyTane/HB3QKPCCOeDzmvxnYwGUWyE/VlSBm3nH41eULhq0 PC2R7co5vEWbzQ2pw80BPBVLMDU4ucVOJu1QMzA6+MD32NGMMYewJrHg5vCS2K5WBjAJ WAK6Rf78Zi8NLIjXy6lecj1rjn5YTzr+Q0duCV6i8YpKhvE/rTWbAc8LzHAbZ7FuKQiy 7NwQ2oDNhFKTUj0WRYue2GBMGbIJu4gRQvWTv0kGYWq1zrscSnABdYxEs8Mm+x6lqBy4 YXKw== X-Gm-Message-State: APt69E2MnAp2hcqqsPpmmRDiiIGuH4deNPpoproEax9/9+ZHimq+GkCL r3C7IqslkYukvVGAf0PO7xA= X-Received: by 2002:a1c:928c:: with SMTP id u134-v6mr16275316wmd.106.1531304438785; Wed, 11 Jul 2018 03:20:38 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id g17-v6sm1685587wmd.25.2018.07.11.03.20.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 03:20:38 -0700 (PDT) Date: Wed, 11 Jul 2018 12:20:35 +0200 From: Ingo Molnar 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 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> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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