lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230603094808.GAZHsMWDc5iUSWeBmK@fat_crate.local>
Date:   Sat, 3 Jun 2023 11:48:08 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Xin Li <xin3.li@...el.com>
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org, kvm@...r.kernel.org,
        tglx@...utronix.de, mingo@...hat.com, dave.hansen@...ux.intel.com,
        hpa@...or.com, peterz@...radead.org, andrew.cooper3@...rix.com,
        seanjc@...gle.com, pbonzini@...hat.com, ravi.v.shankar@...el.com,
        jiangshanlai@...il.com, shan.kang@...el.com
Subject: Re: [PATCH v8 02/33] x86/fred: make unions for the cs and ss fields
 in struct pt_regs

On Mon, Apr 10, 2023 at 01:14:07AM -0700, Xin Li wrote:
> diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
> index f4db78b09c8f..2abb23e6c1e2 100644
> --- a/arch/x86/include/asm/ptrace.h
> +++ b/arch/x86/include/asm/ptrace.h
> @@ -82,12 +82,40 @@ struct pt_regs {
>   * On hw interrupt, it's IRQ number:
>   */
>  	unsigned long orig_ax;
> -/* Return frame for iretq */
> +/* Return frame for iretq/eretu/erets */
>  	unsigned long ip;
> -	unsigned long cs;
> +	union {
> +		unsigned long  csx;	/* cs extended: CS + any fields above it */
> +		struct __attribute__((__packed__)) {

diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 2abb23e6c1e2..d850d3072263 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -86,7 +86,7 @@ struct pt_regs {
 	unsigned long ip;
 	union {
 		unsigned long  csx;	/* cs extended: CS + any fields above it */
-		struct __attribute__((__packed__)) {
+		struct {
 			unsigned short cs;	/* CS selector proper */
 			unsigned int current_stack_level: 2;
 			unsigned int __csx_resv1	: 6;
@@ -96,13 +96,13 @@ struct pt_regs {
 			unsigned int nmi		: 1;
 			unsigned int __csx_resv3	: 3;
 			unsigned int __csx_resv4	: 32;
-		};
+		} __packed;
 	};
 	unsigned long flags;
 	unsigned long sp;
 	union {
 		unsigned long  ssx;	/* ss extended: SS + any fields above it */
-		struct __attribute__((__packed__)) {
+		struct {
 			unsigned short ss;	/* SS selector proper */
 			unsigned int __ssx_resv1	: 16;
 			unsigned int vector		: 8;
@@ -114,7 +114,7 @@ struct pt_regs {
 			unsigned int nested		: 1;
 			unsigned int __ssx_resv4	: 1;
 			unsigned int instr_len		: 4;
-		};
+		} __packed;
 	};
 /* top of stack page */
 };

> +			unsigned short cs;	/* CS selector proper */

Also, please put all those comments above the members, like the rest of the
file does.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ