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: <CAG_fn=V6aQZGkq0HdhzXFCm1Qbn6GHdQd0dYESBup4Lz7hXV5Q@mail.gmail.com>
Date:   Tue, 30 Aug 2022 17:21:14 +0200
From:   Alexander Potapenko <glider@...gle.com>
To:     Christophe Leroy <christophe.leroy@...roup.eu>
Cc:     Alexander Viro <viro@...iv.linux.org.uk>,
        Alexei Starovoitov <ast@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Andrey Konovalov <andreyknvl@...gle.com>,
        Andy Lutomirski <luto@...nel.org>,
        Arnd Bergmann <arnd@...db.de>, Borislav Petkov <bp@...en8.de>,
        Christoph Hellwig <hch@....de>,
        Christoph Lameter <cl@...ux.com>,
        David Rientjes <rientjes@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Ilya Leoshkevich <iii@...ux.ibm.com>,
        Ingo Molnar <mingo@...hat.com>, Jens Axboe <axboe@...nel.dk>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Kees Cook <keescook@...omium.org>,
        Marco Elver <elver@...gle.com>,
        Mark Rutland <mark.rutland@....com>,
        Matthew Wilcox <willy@...radead.org>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Pekka Enberg <penberg@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Petr Mladek <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Vasily Gorbik <gor@...ux.ibm.com>,
        Vegard Nossum <vegard.nossum@...cle.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        "kasan-dev@...glegroups.com" <kasan-dev@...glegroups.com>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 04/44] x86: asm: instrument usercopy in get_user() and put_user()

On Tue, Aug 30, 2022 at 5:06 PM Christophe Leroy
<christophe.leroy@...roup.eu> wrote:
>
>
>
> Le 26/08/2022 à 17:07, Alexander Potapenko a écrit :
> > Use hooks from instrumented.h to notify bug detection tools about
> > usercopy events in variations of get_user() and put_user().
> >
> > Signed-off-by: Alexander Potapenko <glider@...gle.com>
> > ---
> > v5:
> >   -- handle put_user(), make sure to not evaluate pointer/value twice
> >
> > Link: https://linux-review.googlesource.com/id/Ia9f12bfe5832623250e20f1859fdf5cc485a2fce
> > ---
> >   arch/x86/include/asm/uaccess.h | 22 +++++++++++++++-------
> >   1 file changed, 15 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
> > index 913e593a3b45f..c1b8982899eca 100644
> > --- a/arch/x86/include/asm/uaccess.h
> > +++ b/arch/x86/include/asm/uaccess.h
> > @@ -5,6 +5,7 @@
> >    * User space memory access functions
> >    */
> >   #include <linux/compiler.h>
> > +#include <linux/instrumented.h>
> >   #include <linux/kasan-checks.h>
> >   #include <linux/string.h>
> >   #include <asm/asm.h>
> > @@ -103,6 +104,7 @@ extern int __get_user_bad(void);
> >                    : "=a" (__ret_gu), "=r" (__val_gu),                \
> >                       ASM_CALL_CONSTRAINT                             \
> >                    : "0" (ptr), "i" (sizeof(*(ptr))));                \
> > +     instrument_get_user(__val_gu);                                  \
>
> Where is that instrument_get_user() defined ? I can't find it neither in
> v6.0-rc3 nor in linux-next.
>
> >       (x) = (__force __typeof__(*(ptr))) __val_gu;                    \
> >       __builtin_expect(__ret_gu, 0);                                  \
> >   })
>
> Christophe

Yeah, as mentioned above, I should've put an empty declaration of it
in include/linux/instrumented.h, but failed to. I'll fix this in v6.
The "real" implementation of instrument_get_user() will appear in
"instrumented.h: add KMSAN support"

-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Liana Sebastian
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ