Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4698457rwe; Tue, 30 Aug 2022 15:22:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR7HIJvhOmTB+7dKz7Y4Ha41s6NvQcuCkHbwFfdmamGPLE+uXRvMQn1gpdf7vwkmOuSe5qh7 X-Received: by 2002:a17:902:74c9:b0:174:e7dc:1dfb with SMTP id f9-20020a17090274c900b00174e7dc1dfbmr9018868plt.1.1661898140367; Tue, 30 Aug 2022 15:22:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661898140; cv=none; d=google.com; s=arc-20160816; b=cFqtur/gHrhCKjbsogyVJrxBoselHv692pDGUYShrMa26J3oj0Tr28G0h67whEIMFd hfCG4algmFgBCwg1c05n85144g0EXBAvgBTSRnp/rIx4o0EHLfV/j+VNsjzAvwEIvNGz VJ/jWB51s9OvrsM85huZDXrosZumiUJOKukBeqZOgzf5uNtz5AgKbqi1Ypv3GLlyivK+ 1uEZ0B2zB4fJ1uDjhtON63KedWn21Tp9d9iF5JEW8PADBnvbft2vRBChjrvDfHBYbzh6 uSFs/8qBhE2TRZn9MJTJLyhAqwLKrgFNX4EfxwMEeNRsthSfHny9zzPDtqJioMA3NAKv 085A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=EsbLKIYTJSreJOGprEFnEf3JNlSaWAcAhph4+iue+0g=; b=aCGhqQNEciRgrWqJ9jrW7pCTBorvQkJC9v9MlpcnLvHqSoTuvOG3ygG9Aiin8BYMXe v3QwaZiT5stWcZFq0t/bm0TUjQ4ebqAdT3+PN/Ark2Q0/2XClW5ZMdSdz/6rijELJeYe oerPv4YwKfAa+5L+IiTc0UM72Ia9/zJN8V3HTDERp2BjA43Ym1Gcn5VjhngjaJfrlR5L Pm/qEUzFXsMOxDKOqB8BuLrBQ/ECyG3dglt17IPmH0i3mOv8kNrKs7UnB7EJzf7DXMtE /fC2lHj2+B83uYDr0vawPTlrLxS5JiBlnosAlL7b2EHj3gcemSims0DaJuPwuO/81GG2 dYYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=zdXxZEBC; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u12-20020a63600c000000b0041c30d5db34si1412453pgb.640.2022.08.30.15.22.01; Tue, 30 Aug 2022 15:22:20 -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=@linux-foundation.org header.s=korg header.b=zdXxZEBC; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231547AbiH3WGC (ORCPT + 99 others); Tue, 30 Aug 2022 18:06:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230255AbiH3WFz (ORCPT ); Tue, 30 Aug 2022 18:05:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6513963F26; Tue, 30 Aug 2022 15:05:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1C3E4B81E28; Tue, 30 Aug 2022 22:05:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82260C433C1; Tue, 30 Aug 2022 22:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1661897151; bh=WOPgq+Z/r2IfhVRD2klqGuqRjEDudKtBpcud8vKpYyk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=zdXxZEBCZRcSQbBODbQg04Xw1/vZ3ciEnmFehxiWEF9sP0bmdQi+HvP5hDPG6qpEG Aciuz/LdL6sL1fVQF+PrbGmgBwvb4MeIaVKdSjmfxM0J8XNXZtEjXvXATt6jdJvOmb gZvO0kFonCFekXOatC4xxsTJqBFa894ckXQui73o= Date: Tue, 30 Aug 2022 15:05:49 -0700 From: Andrew Morton To: Alexander Potapenko , Yu Zhao Cc: Marco Elver , 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 , 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 Subject: Re: [PATCH v5 04/44] x86: asm: instrument usercopy in get_user() and put_user() Message-Id: <20220830150549.afa67340c2f5eb33ff9615f4@linux-foundation.org> In-Reply-To: References: <20220826150807.723137-1-glider@google.com> <20220826150807.723137-5-glider@google.com> <20220826211729.e65d52e7919fee5c34d22efc@linux-foundation.org> <20220829122452.cce41f2754c4e063f3ae8b75@linux-foundation.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Tue, 30 Aug 2022 16:23:44 +0200 Alexander Potapenko wrote: > > 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)) { > > | ^~ > > ./include/linux/bitops.h:50:44: note: in definition of macro ‘bitop’ > > 50 | __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \ > > | ^~~~ > > ./include/linux/page-flags.h:226:13: note: in expansion of macro ‘test_bit’ > > 226 | test_bit(PG_head, &page->flags)) { > > | ^~~~~~~~ > > ... > > Gotcha, this is a circular dependency: mm_types.h -> sched.h -> > kmsan.h -> gfp.h -> mmzone.h -> page-flags.h -> mm_types.h, where the > inclusion of sched.h into mm_types.h was only introduced in "mm: > multi-gen LRU: support page table walks" - that's why the problem was > missing in other trees. Ah, thanks for digging that out. Yu, that inclusion is regrettable. I don't think mm_types.h is an appropriate site for implementing lru_gen_use_mm() anyway. Adding a new header is always the right fix for these things. I'd suggest adding a new mglru.h (or whatever) and putting most/all of the mglru material in there. Also, the addition to kernel/sched/core.c wasn't clearly changelogged, is uncommented and I doubt if the sched developers know about it, let alone reviewed it. Please give them a heads-up. The addition looks fairly benign, but core context_switch() is the sort of thing which people get rather defensive about and putting mm-specific stuff in there might be challenged. Some quantitative justification of this optimization would be appropriate. > In fact sched.h only needs the definitions of `struct > kmsan_context_state` and `struct kmsan_ctx` from kmsan.h, so I am > splitting them off into kmsan_types.h to break this circle. > Doing so also helped catch a couple of missing/incorrect inclusions of > KMSAN headers in subsystems.