From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC4B1ECAAD5 for ; Mon, 29 Aug 2022 14:58:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 36147940008; Mon, 29 Aug 2022 10:58:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 310A4940007; Mon, 29 Aug 2022 10:58:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D8F2940008; Mon, 29 Aug 2022 10:58:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0FF9D940007 for ; Mon, 29 Aug 2022 10:58:10 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CEC031209D2 for ; Mon, 29 Aug 2022 14:58:09 +0000 (UTC) X-FDA: 79852935498.07.099BB54 Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by imf30.hostedemail.com (Postfix) with ESMTP id 87F5C8000F for ; Mon, 29 Aug 2022 14:58:09 +0000 (UTC) Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-33dc345ad78so202223127b3.3 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=cwuGRiWR6PfzyDbm/7efxaeGUEzOdWA4uPJJQiTOAzRae3Y/vR0yuw1KpEdtXumfXo sSzlc13DgCC7wMexLozUC1fzjMdVP4MetUxmaMo1nvZK5pbvWuTL6dylassaAunDiX8j f7ovJxFtUGdFtdOtLenqJwSAVkTygubhTOkQ+xGUjAnqGtAK+IqG5F7IiRuEqESV9Z71 58gOXC/ebKtvSlR9s9Ozt034YElt9Nn3UtkRaGpPN4E7QPX3TbhDqCH3eKzHLkfYCGSE lKiWEI1tRYEv1yrU+wBya7vbpJYA6z7WN2Gs36mKut7kJsDgzsJ1LxNaqK7T1aF+Ivm7 R3pg== X-Gm-Message-State: ACgBeo0asyYWP2LVkjILkS2vTdy1zf06HI0MhWE1VCu3psKIIXImIQNs pE1RVqLQ9PRMPR3mP7PYY2GO4SZr+ZuCAEG9MbYc3Q== X-Google-Smtp-Source: AA6agR5mmCyZc+bx/GJcaJ2M15hFLmoQSQdVojOAReBVIxBPIuK06EfnXzBQa/1JVFnFAiIHR+JBBUgib19jDvUn/E8= 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661785089; a=rsa-sha256; cv=none; b=flzi6iTTuGX+SLJTwx9EJSjmI8RY3az2V5qQDZNaT4RqVibQYuOHTbWalwJhgbYSEXr3li b6Tc2jU4vcBjh7eS17eB+HWn5dECvrdIVLz6LRlH89erhiqdSoIbC+Fgl+cCrqYH0e3BvU DAiBApPblewq4vCa8VAQBg0LmkuW5EU= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=nGGmFoI9; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of glider@google.com designates 209.85.128.177 as permitted sender) smtp.mailfrom=glider@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661785089; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/oXossRp5gmk91oxr3O2OqpJJYrYzHF/cnO4ugwp7xo=; b=KOl/L6C6t/X41mWYN6l4jLk6Y62mds9X3NhIWRZF55/0WAVov3ju6QO/qTf3PO1u2C78W4 1pbbfqDcqT95aROiQm6R9snyXnmz6oxHBqW45ySEsjGH0GuHw5kXCRjySs+mRFfJFcMm1O KcwjskPVoEKSFh9ke95gullbmgNbmLk= Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=nGGmFoI9; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of glider@google.com designates 209.85.128.177 as permitted sender) smtp.mailfrom=glider@google.com X-Rspam-User: X-Rspamd-Server: rspam10 X-Stat-Signature: m335nwuwp683brx6w7b7xm9hxdgugka6 X-Rspamd-Queue-Id: 87F5C8000F X-HE-Tag: 1661785089-229644 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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