[PATCH 1/2] x86_64: Use __seg_fs qualifiers in NPTL accessors

Uros Bizjak ubizjak@gmail.com
Fri Aug 15 09:35:17 GMT 2025


On Fri, Aug 15, 2025 at 10:40 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Uros Bizjak:
>
> > Use __seg_fs named address space qualifiers to cast NPTL accessors
> > to %fs: prefixed addresses.  Use volatile access only where
> > strictly necessary.
> >
> > Also remove stalled __GNUC_PREREQ (6, 0) condition.  Currenty GCC-12
> > is required as the minimum supported compiler version.
>
> Are null pointer accesses through __seg_fs permitted by GCC?

Yes, x86 defines TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID as:

"All use of segmentation is assumed to make address 0 valid."

> How does GCC now that these accesses my not be reordered before the
> initialization of %fs?

If initialization is done by the inline assembler, then it is expected
for "volatile asm" to have a "memory" clobber. This effectively forms
a read/write memory barrier for the compiler.

Uros,


More information about the Libc-alpha mailing list