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: <20260120224014.29e7f326@pumpkin>
Date: Tue, 20 Jan 2026 22:40:14 +0000
From: David Laight <david.laight.linux@...il.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Thomas Gleixner <tglx@...nel.org>, Ingo Molnar <mingo@...hat.com>,
 Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
 Uros Bizjak <ubizjak@...il.com>, Petr Mladek <pmladek@...e.com>, Andrew
 Morton <akpm@...ux-foundation.org>, Kees Cook <kees@...nel.org>, "Peter
 Zijlstra (Intel)" <peterz@...radead.org>, Nathan Chancellor
 <nathan@...nel.org>, Kiryl Shutsemau <kas@...nel.org>, Rick Edgecombe
 <rick.p.edgecombe@...el.com>, linux-kernel@...r.kernel.org,
 linux-coco@...ts.linux.dev, x86@...nel.org
Subject: Re: [PATCH v1 02/14] x86/realmode: make %gs == 0 an invariant

On Tue, 20 Jan 2026 11:53:54 -0800
"H. Peter Anvin" <hpa@...or.com> wrote:

> When accessing data that is not "near", either only one segment is
> used or one segment is always zero. Leave %gs == 0 at all times
> throughout the C code; this reduces the number of segment loads
> needed.
...
> diff --git a/arch/x86/boot/a20.c b/arch/x86/boot/a20.c
> index bda042933a05..3ab6cd8eaa31 100644
> --- a/arch/x86/boot/a20.c
> +++ b/arch/x86/boot/a20.c
> @@ -56,20 +56,19 @@ static int a20_test(int loops)
>  	int ok = 0;
>  	int saved, ctr;
>  
> -	set_fs(0x0000);
> -	set_gs(0xffff);
> +	set_fs(0xffff);
>  
> -	saved = ctr = rdfs32(A20_TEST_ADDR);
> +	saved = ctr = rdgs32(A20_TEST_ADDR);

Would it be better to wrap that as (say) read_abs_32() since the
objective is to read an absolute address (using the relevant zero segment
register) rather than to read though either fs or gs.

Is this code all running in 32bit linear mode with non-zero cs/ss/ds
segment registers and 'suitable' entries in the GDT?
That mode makes my brain hurt :-)
Or is there a fudge to get 16bit asm from the C.

	David





Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ