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: <CAMzpN2i52orTgPqRARoCkuA=c2GEyWXLscrFRgDkb0LoFV01Rw@mail.gmail.com>
Date:   Sat, 8 Oct 2022 08:40:06 -0400
From:   Brian Gerst <brgerst@...il.com>
To:     "Li, Xin3" <xin3.li@...el.com>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "x86@...nel.org" <x86@...nel.org>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "bp@...en8.de" <bp@...en8.de>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        "hpa@...or.com" <hpa@...or.com>
Subject: Re: [PATCH 6/6] x86/gsseg: use the LKGS instruction if available for load_gs_index()

On Sat, Oct 8, 2022 at 1:40 AM Li, Xin3 <xin3.li@...el.com> wrote:
>
> > > +       alternative_io("1: call asm_load_gs_index\n"
> > > +                      ".pushsection \".fixup\",\"ax\"\n"
> > > +                      "2:      xorl %k[sel], %k[sel]\n"
> > > +                      "        jmp 1b\n"
> > > +                      ".popsection\n"
> > > +                      _ASM_EXTABLE(1b, 2b),
> > > +                      _ASM_BYTES(0x3e) LKGS_DI,
> > > +                      X86_FEATURE_LKGS,
> > > +                      ASM_OUTPUT2([sel] "+D" (sel), ASM_CALL_CONSTRAINT),
> > > +                      ASM_NO_INPUT_CLOBBER(_ASM_AX));
> > >  }
> > >
> > >  #endif /* CONFIG_X86_64 */
> > > --
> > > 2.34.1
> >
> > There are not that many call sites, so using something like this (incorporating
> > Peter Z's suggestion for the exception handler) would be better from a code
> > readability perspective vs. a tiny increase in code size.
>
> The existing approach patches the binary code thus we don't need to check it at runtime.

static_cpu_has() uses alternatives to patch the branch, so there is no
runtime check after early boot.

--
Brian Gerst

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ