From nobody Thu Apr 9 13:11:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5295C38A2D for ; Fri, 21 Oct 2022 22:19:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbiJUWTi (ORCPT ); Fri, 21 Oct 2022 18:19:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbiJUWTM (ORCPT ); Fri, 21 Oct 2022 18:19:12 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 981DD2AAC00 for ; Fri, 21 Oct 2022 15:19:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666390743; x=1697926743; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=kNHtAX3mEHzTLo+VDVyWKv6DLaeRHOEsKonhUqzYgFQ=; b=QCX/O45PRyQc34qFv+UFzSnaH4L9dO43ZoM08ciKgBafJehsi+3dpXmo eR+RKHWE1Lx99MCafEiMId1wDrPnar3yN2lgDENBNCBr2CqtRbib+UGuC qnErhaBXn2U0S63lrwji7OUpsqXSOnY7faJ/Cn5f+7dTMuX5iVwfseSBP DUTVFORQU8HJHJP1MBeHsNYAIoZ1l4yd9DBYMWrHglsSWp7OH2edkKVJ/ I+TbUMTr49a6ZsrR5gd7rmpNKd4rorSeKussXcT9ismIeEXd+dGJRkAx5 bGZTcLWKHCKKwiZ6l796gX9NLGp1MUn4JTxvugdMglVluU3sFQud493k5 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369181095" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369181095" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 15:18:37 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="959808506" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="959808506" Received: from sanekar-mobl.amr.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.251.5.12]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 15:18:37 -0700 From: Rick Edgecombe To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, rick.p.edgecombe@intel.com, keescook@chromium.org, ebiederm@xmission.com Subject: [PATCH 2/2] x86: Improve formatting of user_regset arrays Date: Fri, 21 Oct 2022 15:18:03 -0700 Message-Id: <20221021221803.10910-3-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221021221803.10910-1-rick.p.edgecombe@intel.com> References: <20221021221803.10910-1-rick.p.edgecombe@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Back in 2018, Ingo Molnar suggested[0] to improve the formatting of the struct user_regset arrays. They have multiple member initializations per line and some lines exceed 100 chars. Reformat them like he suggested. [0] https://lore.kernel.org/lkml/20180711102035.GB8574@gmail.com/ Signed-off-by: Rick Edgecombe Reviewed-by: Kees Cook --- - Drop Kees' Reviewed-by, as I had to redo it with the new REGSET64_FOO format. arch/x86/kernel/ptrace.c | 107 ++++++++++++++++++++++++--------------- 1 file changed, 65 insertions(+), 42 deletions(-) diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 356495ab37a6..dfaa270a7cc9 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c @@ -1235,28 +1235,37 @@ long compat_arch_ptrace(struct task_struct *child, = compat_long_t request, =20 static struct user_regset x86_64_regsets[] __ro_after_init =3D { [REGSET64_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, - .n =3D sizeof(struct user_regs_struct) / sizeof(long), - .size =3D sizeof(long), .align =3D sizeof(long), - .regset_get =3D genregs_get, .set =3D genregs_set + .core_note_type =3D NT_PRSTATUS, + .n =3D sizeof(struct user_regs_struct) / sizeof(long), + .size =3D sizeof(long), + .align =3D sizeof(long), + .regset_get =3D genregs_get, + .set =3D genregs_set }, [REGSET64_FP] =3D { - .core_note_type =3D NT_PRFPREG, - .n =3D sizeof(struct fxregs_state) / sizeof(long), - .size =3D sizeof(long), .align =3D sizeof(long), - .active =3D regset_xregset_fpregs_active, .regset_get =3D xfpregs_get, .= set =3D xfpregs_set + .core_note_type =3D NT_PRFPREG, + .n =3D sizeof(struct fxregs_state) / sizeof(long), + .size =3D sizeof(long), + .align =3D sizeof(long), + .active =3D regset_xregset_fpregs_active, + .regset_get =3D xfpregs_get, + .set =3D xfpregs_set }, [REGSET64_XSTATE] =3D { - .core_note_type =3D NT_X86_XSTATE, - .size =3D sizeof(u64), .align =3D sizeof(u64), - .active =3D xstateregs_active, .regset_get =3D xstateregs_get, - .set =3D xstateregs_set + .core_note_type =3D NT_X86_XSTATE, + .size =3D sizeof(u64), + .align =3D sizeof(u64), + .active =3D xstateregs_active, + .regset_get =3D xstateregs_get, + .set =3D xstateregs_set }, [REGSET64_IOPERM] =3D { - .core_note_type =3D NT_386_IOPERM, - .n =3D IO_BITMAP_LONGS, - .size =3D sizeof(long), .align =3D sizeof(long), - .active =3D ioperm_active, .regset_get =3D ioperm_get + .core_note_type =3D NT_386_IOPERM, + .n =3D IO_BITMAP_LONGS, + .size =3D sizeof(long), + .align =3D sizeof(long), + .active =3D ioperm_active, + .regset_get =3D ioperm_get }, }; =20 @@ -1276,42 +1285,56 @@ static const struct user_regset_view user_x86_64_vi= ew =3D { #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION static struct user_regset x86_32_regsets[] __ro_after_init =3D { [REGSET32_GENERAL] =3D { - .core_note_type =3D NT_PRSTATUS, - .n =3D sizeof(struct user_regs_struct32) / sizeof(u32), - .size =3D sizeof(u32), .align =3D sizeof(u32), - .regset_get =3D genregs32_get, .set =3D genregs32_set + .core_note_type =3D NT_PRSTATUS, + .n =3D sizeof(struct user_regs_struct32) / sizeof(u32), + .size =3D sizeof(u32), + .align =3D sizeof(u32), + .regset_get =3D genregs32_get, + .set =3D genregs32_set }, [REGSET32_FP] =3D { - .core_note_type =3D NT_PRFPREG, - .n =3D sizeof(struct user_i387_ia32_struct) / sizeof(u32), - .size =3D sizeof(u32), .align =3D sizeof(u32), - .active =3D regset_fpregs_active, .regset_get =3D fpregs_get, .set =3D f= pregs_set + .core_note_type =3D NT_PRFPREG, + .n =3D sizeof(struct user_i387_ia32_struct) / sizeof(u32), + .size =3D sizeof(u32), + .align =3D sizeof(u32), + .active =3D regset_fpregs_active, + .regset_get =3D fpregs_get, + .set =3D fpregs_set }, [REGSET32_XFP] =3D { - .core_note_type =3D NT_PRXFPREG, - .n =3D sizeof(struct fxregs_state) / sizeof(u32), - .size =3D sizeof(u32), .align =3D sizeof(u32), - .active =3D regset_xregset_fpregs_active, .regset_get =3D xfpregs_get, .= set =3D xfpregs_set + .core_note_type =3D NT_PRXFPREG, + .n =3D sizeof(struct fxregs_state) / sizeof(u32), + .size =3D sizeof(u32), + .align =3D sizeof(u32), + .active =3D regset_xregset_fpregs_active, + .regset_get =3D xfpregs_get, + .set =3D xfpregs_set }, [REGSET32_XSTATE] =3D { - .core_note_type =3D NT_X86_XSTATE, - .size =3D sizeof(u64), .align =3D sizeof(u64), - .active =3D xstateregs_active, .regset_get =3D xstateregs_get, - .set =3D xstateregs_set + .core_note_type =3D NT_X86_XSTATE, + .size =3D sizeof(u64), + .align =3D sizeof(u64), + .active =3D xstateregs_active, + .regset_get =3D xstateregs_get, + .set =3D xstateregs_set }, [REGSET32_TLS] =3D { - .core_note_type =3D NT_386_TLS, - .n =3D GDT_ENTRY_TLS_ENTRIES, .bias =3D GDT_ENTRY_TLS_MIN, - .size =3D sizeof(struct user_desc), - .align =3D sizeof(struct user_desc), - .active =3D regset_tls_active, - .regset_get =3D regset_tls_get, .set =3D regset_tls_set + .core_note_type =3D NT_386_TLS, + .n =3D GDT_ENTRY_TLS_ENTRIES, + .bias =3D GDT_ENTRY_TLS_MIN, + .size =3D sizeof(struct user_desc), + .align =3D sizeof(struct user_desc), + .active =3D regset_tls_active, + .regset_get =3D regset_tls_get, + .set =3D regset_tls_set }, [REGSET32_IOPERM] =3D { - .core_note_type =3D NT_386_IOPERM, - .n =3D IO_BITMAP_BYTES / sizeof(u32), - .size =3D sizeof(u32), .align =3D sizeof(u32), - .active =3D ioperm_active, .regset_get =3D ioperm_get + .core_note_type =3D NT_386_IOPERM, + .n =3D IO_BITMAP_BYTES / sizeof(u32), + .size =3D sizeof(u32), + .align =3D sizeof(u32), + .active =3D ioperm_active, + .regset_get =3D ioperm_get }, }; =20 --=20 2.17.1