Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3268985rwe; Mon, 29 Aug 2022 08:34:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ojKB/Ire5vW9H5sAKMgLZigBAzB2io2AojrlMQj6aF05wq8y2QX+6D6b8U1T4bQ31qcSL X-Received: by 2002:a65:6b95:0:b0:420:2cb1:68e5 with SMTP id d21-20020a656b95000000b004202cb168e5mr14326395pgw.220.1661787242430; Mon, 29 Aug 2022 08:34:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661787242; cv=none; d=google.com; s=arc-20160816; b=Y3K7n2UaPX0YdFBgM0723WvEYmxMzsancbG9Ko7l3Q4Nlg7/jsaxKoV23m2oCwmrOk /gqV1TFZeJ/F015FIwiU3P4M1cQrKc3jJvkY5zL3Lw0dEocJ+Ojf7z1fOM8VVnzPjZYO +k4FVIoDi8dENFe9/U753ryXZRPWuFciuAVW191gtkK3V2JIZdHZqfEjizkeW7+VJp84 IoXG7Eg6CF4Bga8Y2IaBiO0SejK1/9FkOShzDMZ+3JjehblcnBDqMy13glFMjAwxhXu9 W/BoeZ7Qh05PzMfn8HI/ShWVC5rbT5SpYOBIvAhLZ1j9T9WxXF0Yu803hcZoDw/AEUEw StDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=/oXossRp5gmk91oxr3O2OqpJJYrYzHF/cnO4ugwp7xo=; b=i2mk1nKuUXK5rRQ6QXZcFFSNvjNGobNqi0Hgwnr15/SaLHaClhw8x75xQsaShJ7xks K2jaO3Hmy7Ev01MD3eYtMMvyCgAyZkG1ZsZny60BsMUWfh/gijYbVaRCsYs77B/i3hnH T6IT/d3OmhvJmr1Nu03szGXGP2P4BHcZTl+UmtHl2EoWD3dMeu0R/ZAEjrs4s+3DEV44 4eyB8/CuWIM2d6iaL0kISxdthgIy7L7wd2YU79SJ0K75/HcZSt5JVdu353u40DjBfS8f rqCG5sk+KS4h7sBuAlfyPgx5g2jW+vozQvdGWAeykskK85n+euNi2FBoEbrACLqrKgKV pXzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=nGGmFoI9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h11-20020a056a00218b00b0053700ada3b5si10841741pfi.359.2022.08.29.08.33.49; Mon, 29 Aug 2022 08:34:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=nGGmFoI9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229684AbiH2O6M (ORCPT + 99 others); Mon, 29 Aug 2022 10:58:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiH2O6K (ORCPT ); Mon, 29 Aug 2022 10:58:10 -0400 Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D1B883F21 for ; Mon, 29 Aug 2022 07:58:09 -0700 (PDT) Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-324ec5a9e97so201906047b3.7 for ; Mon, 29 Aug 2022 07:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc; bh=/oXossRp5gmk91oxr3O2OqpJJYrYzHF/cnO4ugwp7xo=; b=nGGmFoI9UliEJbzlc2zbQNhXBHme0qkBgWGshv+bWBaLHZpUeQMOVvvUrGWdOdsv2s z5Ehp7oMbRTdg+fVQRiSMK/zovc/4PZxJygGY6fYt1LZQrfMxU72O1YtezQhX/fnxzkC hmwVjlv/xKQo9DHfnd32ZDWEPqc152dFOYaB2PyLHyNyMJety1bDK/EIVt0/JqQbR5XV qdFEYni5N+tQ2+b3v0Dx5IVr02NabMS/3gg+JSkAURNZ9r88RywUcuZzF+eHthf3Q0XR 67tO7fg4mTyO+KE7/f/lfZsV8urY1AIDELRGlFKb052EpzQj6KOeJMaWZfchAtOzoL5W H8jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc; bh=/oXossRp5gmk91oxr3O2OqpJJYrYzHF/cnO4ugwp7xo=; b=eoEp6+yoTzXQxuM9j0lDg1i7jJfcAXY4y70KOJ+wPR0FF1n9fG93z6WJfaE3m2A3vJ 7eqhBPf0Ur9jM6oznJjfuNzfkKF9mfUwkEYD4qnQ01mPcULQ3jNMKnIJOIb2yqu+OB7w xJY1JgEZGqKlAMGes55Sm1oDq03OaGCo65qIa/Ewx9vMTOYTgvAMrHxXOPaAEGihB4PI EbGjsBdEOYdbVHqx474Yrbv5MHUeFILj2JSLICbwcvDts74IKdwhOpeTmHD6cV8LRS1F k/2Clq70sTOrO4updxUUnizkmIKIlwGMJWH3Sx8qb7ygPuaQqKaujGWnfJyNNrGiTKur RLWg== X-Gm-Message-State: ACgBeo1SoFE7jvRprAyHo/30KJD2RtrfryyrUFEeW4eksTIhO/TE7LTB 6RmuvhgcT+XPbvlIWrrrAZFg3thGvcR81FpPAYKDrQ== X-Received: by 2002:a25:bc3:0:b0:673:bc78:c095 with SMTP id 186-20020a250bc3000000b00673bc78c095mr8579874ybl.376.1661785088326; Mon, 29 Aug 2022 07:58:08 -0700 (PDT) MIME-Version: 1.0 References: <20220826150807.723137-1-glider@google.com> <20220826150807.723137-5-glider@google.com> <20220826211729.e65d52e7919fee5c34d22efc@linux-foundation.org> In-Reply-To: <20220826211729.e65d52e7919fee5c34d22efc@linux-foundation.org> From: Alexander Potapenko Date: Mon, 29 Aug 2022 16:57:31 +0200 Message-ID: Subject: Re: [PATCH v5 04/44] x86: asm: instrument usercopy in get_user() and put_user() To: Andrew Morton Cc: Alexander Viro , Alexei Starovoitov , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Marco Elver , Mark Rutland , Matthew Wilcox , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Steven Rostedt , Thomas Gleixner , Vasily Gorbik , Vegard Nossum , Vlastimil Babka , kasan-dev , Linux Memory Management List , Linux-Arch , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 27, 2022 at 6:17 AM Andrew Morton w= rote: > > On Fri, 26 Aug 2022 17:07:27 +0200 Alexander Potapenko wrote: > > > Use hooks from instrumented.h to notify bug detection tools about > > usercopy events in variations of get_user() and put_user(). > > And this one blows up x86_64 allmodconfig builds. How do I reproduce this? I tried running `make mrproper; make allmodconfig; make -j64` (or allyesconfig, allnoconfig) on both KMSAN tree (https://github.com/google/kmsan/commit/ac3859c02d7f40f59992737d63afcacda0a= 972ec, which is Linux v6.0-rc2 plus the 44 KMSAN patches) and linux-mm/mm-stable @ec6624452e36158d0813758d837f7a2263a4109d with KMSAN patches applied on top of it. All builds were successful. I then tried to cherry-pick just the first 4 commits to mm-stable and see if allmodconfig works - it resulted in numerous "implicit declaration of function =E2=80=98instrument_get_user=E2=80=99" errors (quit= e silly of me), but nothing looking like the errors you posted. I'll try to build-test every patch in the series after fixing the missing declarations, but so far I don't see other problems. Could you share the mmotm commit id which resulted in the failures? > > --- a/arch/x86/include/asm/uaccess.h > > +++ b/arch/x86/include/asm/uaccess.h > > @@ -5,6 +5,7 @@ > > * User space memory access functions > > */ > > #include > > +#include > > #include > > #include > > #include > > instrumented.h looks like a higher-level thing than uaccess.h, so this > inclusion is an inappropriate layering. Or maybe not. > > In file included from ./include/linux/kernel.h:22, > from ./arch/x86/include/asm/percpu.h:27, > from ./arch/x86/include/asm/nospec-branch.h:14, > from ./arch/x86/include/asm/paravirt_types.h:40, > from ./arch/x86/include/asm/ptrace.h:97, > from ./arch/x86/include/asm/math_emu.h:5, > from ./arch/x86/include/asm/processor.h:13, > from ./arch/x86/include/asm/timex.h:5, > from ./include/linux/timex.h:67, > from ./include/linux/time32.h:13, > from ./include/linux/time.h:60, > from ./include/linux/stat.h:19, > from ./include/linux/module.h:13, > from init/do_mounts.c:2: > ./include/linux/page-flags.h: In function 'page_fixed_fake_head': > ./include/linux/page-flags.h:226:36: error: invalid use of undefined type= 'const struct page' > 226 | test_bit(PG_head, &page->flags)) { > | ^~ > > [25000 lines snipped] > > > And kmsan-add-kmsan-runtime-core.patch introduces additional build > errors with x86_64 allmodconfig. > > This is all with CONFIG_KMSAN=3Dn > > I'll disable the patch series. Please do much more compilation testing > - multiple architectures, allnoconfig, allmodconfig, allyesconfig, > defconfig, randconfig, etc. Good luck, it looks ugly :( > -- Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Stra=C3=9Fe, 33 80636 M=C3=BCnchen Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Liana Sebastian Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg