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] [day] [month] [year] [list]
Message-ID: <CAFULd4axRbk4rT_+xuwjWv2J0+TP-qKjNK+QaivOGFdJ3aL+vg@mail.gmail.com>
Date:   Tue, 13 Oct 2020 10:00:45 +0200
From:   Uros Bizjak <ubizjak@...il.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Borislav Petkov <bp@...e.de>, x86-ml <x86@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>
Subject: Re: [GIT PULL] x86/asm updates for v5.10

On Mon, Oct 12, 2020 at 10:57 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> On Mon, Oct 12, 2020 at 1:22 PM Uros Bizjak <ubizjak@...il.com> wrote:
> >
> > No, this fact is not documented, although there are close to zero
> > chances it will ever change. High registers are independent from their
> > 8bit lowparts, but they still clobber corresponding 16bit, 32bit and
> > 64bit representations. I guess this limitation is so severe that the
> > compiler writers will be more than happy to document that %ah and %al
> > can't be independent.
>
> Ok, if we can get that agreed upon (and the clang people too), then I
> have no concerns about the patch.

The GCC's development documentation says:

--cut here--
         When storing to a normal 'subreg' that is smaller than a
         block, the other bits of the referenced block are usually left
         in an undefined state.  This laxity makes it easier to
         generate efficient code for such instructions.  To represent
         an instruction that preserves all the bits outside of those in
         the 'subreg', use 'strict_low_part' or 'zero_extract' around
         the 'subreg'.
--cut here--

REG is divided into individually-addressable blocks in which each block has:

              REGMODE_NATURAL_SIZE (M2)

bytes.  Usually the value is 'UNITS_PER_WORD'; that is, most targets
usually treat each word of a register as being independently
addressable.

The 'block' is 32bits for i386 or 64bits for x86_64. When asm is
writing to %al, this effectively means that other bits of a register
are left in an undefined state. Please note that 'strict_low_part' and
'zero_extract' are internal representations, not available in asm
statements.

> Just so that we don't have any nasty surprises in the future where
> some clever compiler change ends up breaking this (very rare)
> exception case.

IMO the above documents that write to a partial register clobbers the
entire register.

Uros.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ