Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp604870rdb; Tue, 5 Dec 2023 14:32:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9cR9I71Sp+jDKJtoczLZyHsZelHYRLs3skWrFWsJDE38oiw59OHhFk+ntgz6cx4byGPMd X-Received: by 2002:a17:90a:d990:b0:286:6cc1:7811 with SMTP id d16-20020a17090ad99000b002866cc17811mr1834759pjv.84.1701815541432; Tue, 05 Dec 2023 14:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701815541; cv=none; d=google.com; s=arc-20160816; b=b7jZj49FTjucckYfiEPi93fBpUOQBFG9heWCxsOVgx3p8h4w7z4xn6xWEnLC5v+8y/ uYSLS0/Dzc0UmpTSethXEbGzQ4xIqQMgl2jD7Z1ML9DF3inY23qWcav9vVcWeHH42pLm P8PO1RrNdt/sCwkpyIAwu3iSuv6EyAn/DB+wuoVbPKUzmDmEu6CFGc/HR1kKkljyVoGz KX14DVH31vS0skoegzyL4Pcc8d0i9gRTpn02hc7wWtdf153yhtkKvs7uhbnd7ogtFIr5 5rMs17MfOSrtt9kLbQFZf5KU6zQgj7dJnc5KCfE7tLtLto7CZAOu0Wft3bqJkVLjJoQp NwBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=OD1ItpAr/xwE+UpWJnM3+Hd/hQwe/hOCe/5jv7jdpPk=; fh=d/F3tlGYbBxwqiwYGnvFGVEOjF6htnM1QpfHongyVE4=; b=kOCnq8bu7fmLOva0BRqRlXE62Ij0GkgNF2JmeRO5PkWJdoxBZJKk6zxZ5S6eLJnOTZ Bup/vH3olPHNv1uoni+O67+1P1G/V1K0roz4JyuOOe8v32pB8NFiOV/rKmsbdv/U1UtL fw/69pfFcqQ/ymnDBd/Y7pjpVGI2Bz96QVqGGYeh9wosnxj0oLeoKfS3vU6mYq1uSTHY EZmPSoLrVzB6oMOQAL2ke4RBfO47M3InIMi7HHtxo9uzyfVFard7JG+AOeA2bC5UZffh q8tSmQG4HFypi8DvX8w4YRZTOVoeyzKyhK7IA+yJuqxETmzNiKGmOdeJM2q4W4WjUWqw nxrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=o3XjrazS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id y9-20020a170902b48900b001cfc685e87csi9939917plr.320.2023.12.05.14.32.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 14:32:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=o3XjrazS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8A1CE828082B; Tue, 5 Dec 2023 14:32:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346501AbjLEWcE (ORCPT + 99 others); Tue, 5 Dec 2023 17:32:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346449AbjLEWcD (ORCPT ); Tue, 5 Dec 2023 17:32:03 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF9651AA; Tue, 5 Dec 2023 14:32:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=OD1ItpAr/xwE+UpWJnM3+Hd/hQwe/hOCe/5jv7jdpPk=; b=o3XjrazSh2WGCShw9aY/0MdGor WF/MV/1Do8TzOamoGOVtnVRhVIgvJskn2l6UJWaEeZEmj+4dwxL76HA0H++pOcs6oN1rBP4G3TAGM O49edbXY/MAVM8YI8RYccB/BSkYD7R8cmfjcQQtbZdcHjpEeRBLvCfPy5/YBZVEs2EacTBwMiKz3F EFnMjJy4sugxWkBqyUfIyGI/ful9aw733BnaYxs+d37x6zDXx7ETTYk1vM68ZoVsBlqit646m6ZXZ jkfzHR7B6ixmSjlYeJA7jhB9clkviA6ryNnRG7gC3aushuA5OK3QKfv2wjAjor4svyZSR9LFbAhqu LI2H81eQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rAdxV-007UJ0-0T; Tue, 05 Dec 2023 22:32:05 +0000 Date: Tue, 5 Dec 2023 22:32:05 +0000 From: Al Viro To: Andy Shevchenko Cc: Nick Desaulniers , tanzirh@google.com, Kees Cook , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Nick DeSaulniers , Andrew Morton , llvm@lists.linux.dev Subject: Re: [PATCH] lib/string: shrink lib/string.i via IWYU Message-ID: <20231205223205.GI1674809@ZenIV> References: <20231205-libstringheader-v1-1-7f9c573053a7@gmail.com> <20231205213807.GE1674809@ZenIV> <20231205221521.GH1674809@ZenIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231205221521.GH1674809@ZenIV> Sender: Al Viro X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 05 Dec 2023 14:32:18 -0800 (PST) On Tue, Dec 05, 2023 at 10:15:21PM +0000, Al Viro wrote: > It would certainly be nice to have such information in the tree; > "where should I pick $SYMBOL from?" is something one needs to > find out often enough. To a large extent it's covered by "where > in include/*.h do we have it defined?", but that's not all there > is to it. E.g. "get_user() => use linux/uaccess.h". > > There's also stuff like "$SYMBOL should not be used outside of arch/* > and include/*, better use $OTHER_SYMBOL", etc. Speaking of... arch/arm64/include/asm/asm-prototypes.h:18:#include arch/powerpc/include/asm/inst.h:8:#include arch/powerpc/kvm/book3s_xive_native.c:16:#include arch/powerpc/mm/book3s64/radix_pgtable.c:31:#include arch/riscv/kernel/sys_riscv.c:15:#include arch/xtensa/include/asm/asm-prototypes.h:10:#include include/linux/uaccess.h:11:#include tools/testing/crypto/chacha20-s390/test-cipher.c:8:#include Only one of those is legitimate (linux/uaccess.h); asm-prototypes.h ones are borderline, but probably should be pulling linux/uaccess.h, everything in *.c is really wrong. Powerpc asm/inst.h is the really unpleasant one here - it's pulled by quite a few other places, including several asm/*.h. Hell knows; might be worth splitting the {__,}{get_user_instr,copy_inst_from_kernel_nofault}() off to a separate header (asm/inst-uaccess.h?), to be included only by the files that use any of those (that would be arch/powerpc/kernel/{align,hw_breakpoint_constraints,module_32,traps,vecemu}.c and arch/powerpc/kernel/trace/{ftrace,ftrace_64_pg}.c - not a single header among them). That header would pull linux/uaccess.h and asm/inst.h wouldn't need any uaccess at all; might spill into explicit includes of linux/uaccess.h in some of the places in arch/powerpc that pull asm/inst.h, directly or not...