On Tue, Aug 30, 2022 at 5:06 PM Christophe Leroy <christophe.leroy@xxxxxxxxxx> 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@xxxxxxxxxx> > > --- > > 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