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: <f61f4a54539c24cd108dbace89e6bc059e896937.camel@intel.com>
Date:   Tue, 21 Feb 2023 20:02:02 +0000
From:   "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To:     "david@...hat.com" <david@...hat.com>,
        "bsingharora@...il.com" <bsingharora@...il.com>,
        "hpa@...or.com" <hpa@...or.com>,
        "Syromiatnikov, Eugene" <esyr@...hat.com>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "rdunlap@...radead.org" <rdunlap@...radead.org>,
        "keescook@...omium.org" <keescook@...omium.org>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
        "Eranian, Stephane" <eranian@...gle.com>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "fweimer@...hat.com" <fweimer@...hat.com>,
        "nadav.amit@...il.com" <nadav.amit@...il.com>,
        "jannh@...gle.com" <jannh@...gle.com>,
        "dethoma@...rosoft.com" <dethoma@...rosoft.com>,
        "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
        "kcc@...gle.com" <kcc@...gle.com>, "pavel@....cz" <pavel@....cz>,
        "oleg@...hat.com" <oleg@...hat.com>,
        "hjl.tools@...il.com" <hjl.tools@...il.com>,
        "bp@...en8.de" <bp@...en8.de>,
        "Lutomirski, Andy" <luto@...nel.org>,
        "linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
        "arnd@...db.de" <arnd@...db.de>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "Schimpe, Christina" <christina.schimpe@...el.com>,
        "x86@...nel.org" <x86@...nel.org>,
        "mike.kravetz@...cle.com" <mike.kravetz@...cle.com>,
        "Yang, Weijiang" <weijiang.yang@...el.com>,
        "debug@...osinc.com" <debug@...osinc.com>,
        "jamorris@...ux.microsoft.com" <jamorris@...ux.microsoft.com>,
        "john.allen@....com" <john.allen@....com>,
        "rppt@...nel.org" <rppt@...nel.org>,
        "andrew.cooper3@...rix.com" <andrew.cooper3@...rix.com>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "corbet@....net" <corbet@....net>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-api@...r.kernel.org" <linux-api@...r.kernel.org>,
        "gorcunov@...il.com" <gorcunov@...il.com>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
CC:     "Yu, Yu-cheng" <yu-cheng.yu@...el.com>
Subject: Re: [PATCH v6 37/41] selftests/x86: Add shadow stack test

On Tue, 2023-02-21 at 09:48 +0100, David Hildenbrand wrote:
> On 18.02.23 22:14, Rick Edgecombe wrote:
> > Add a simple selftest for exercising some shadow stack behavior:
> >    - map_shadow_stack syscall and pivot
> >    - Faulting in shadow stack memory
> >    - Handling shadow stack violations
> >    - GUP of shadow stack memory
> >    - mprotect() of shadow stack memory
> >    - Userfaultfd on shadow stack memory
> > 
> > Since this test exercises a recently added syscall manually, it
> > needs
> > to find the automatically created __NR_foo defines. Per the
> > selftest
> > documentation, KHDR_INCLUDES can be used to help the selftest
> > Makefile's
> > find the headers from the kernel source. This way the new selftest
> > can
> > be built inside the kernel source tree without installing the
> > headers
> > to the system. So also add KHDR_INCLUDES as described in the
> > selftest
> > docs, to facilitate this.
> > 
> > Tested-by: Pengfei Xu <pengfei.xu@...el.com>
> > Tested-by: John Allen <john.allen@....com>
> > Co-developed-by: Yu-cheng Yu <yu-cheng.yu@...el.com>
> > Signed-off-by: Yu-cheng Yu <yu-cheng.yu@...el.com>
> > Signed-off-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
> > 
> > ---
> 
> 
> [...]
> 
> > +bool gup_write(void *ptr)
> > +{
> > +     unsigned long val;
> > +
> > +     lseek(fd, (unsigned long)ptr, SEEK_SET);
> > +     if (write(fd, &val, sizeof(val)) < 0)
> > +             return 1;
> 
> /proc/self/mem is for debug/ptrace access (FOLL_FORCE). I think you 
> might also want to add tests for ordinary GUP, checking that we fail
> to 
> obtain a write pin -- and call these tests "gup_ptrace_read" / 
> "gup_ptrace_write"

Yes, this only tests the FOLL_FORCE case, but it does exercise GUP.

> 
> An simple approach would be to trigger a read()/write() on a file
> opened 
> via O_DIRECT, using the shadow stack as buffer. While the write() 
> [reading from the page] is expected to work, a read() [writing to
> the 
> page] has to fail.

Hmm, good idea. This would be nice to add.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ