Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6955585rdb; Fri, 15 Dec 2023 13:04:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IH671Q/+1RyRWUzpqCeaOhPCSRnfE9jPgM/Tx/8DeTAA8oEKuBisecrl6k8YOktn2lUJekE X-Received: by 2002:a05:651c:198f:b0:2cb:2ae8:c4a9 with SMTP id bx15-20020a05651c198f00b002cb2ae8c4a9mr6152939ljb.1.1702674240435; Fri, 15 Dec 2023 13:04:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702674240; cv=none; d=google.com; s=arc-20160816; b=Hbblm/1Pji6HPLfwwGjyrIWjiwdjAcS/Oczie5V6AXo34jmgX7wpIw9Vo59vD0QW2w i8FiRZ5fip9oxRO0A9bW8yOfFI+CYqca5Wl0WdCo2u7C0MDpS8qeGls/wVrvGoCAQ4y3 8BkkXYa7S4Cb0NbGIY2P7MNRYpU9dGpMqPfocZPdsMN1vlGYJYoj3m4dO929l8noRz0S mGdJI5A2eO1lCrvW6DJlFfPfX51yapyyV4HFPlt8+Vsv4ufO0T7J7CEFiGfSxHtRsTds oN28Hr2fMuT/ahoQWlTzJ7AFgz+rOicZVYlKYXpmMcgtr2r/rrj2W/uraSX/XxqYdQuS IqVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=3sddRRvwk/fTKF7doym0HPnBmsg/UatU52NDddZvLeM=; fh=Bn+dNc76c52z0y0i4AgMMBNkkaBE/SaonuxRzZuZRZc=; b=TuoGFdqqY187V1QIpouVzsrYsz/vI188DNPnudsPZm2ocV75QvSvtq0Rjjx5w8NKti 3cDfElWe+wut8aadn/3tsPAdJeZNeYnw8kr2g5xNp12HHuD0JvtE5QX5QPOZG1Ro3s2D C5eZ+U2tIAiW18hmfzdUijaIpzyL1HK+iy5TPpV0Pv/1gHSHXsl6XALSi0rP+lZbIY6S SjJql69GLZkyGeuvP9Rqjhp+FyI1XE6kSuXwqTiA2VHgJv1u/b4bvnf5VO7Hmosj0OBb MO3vlR0yF8JdxHPTuU+pJCUag3VT5mkQIBOAgUag7QORbc8dWWnUkAv/vByafHkyw2m6 1gkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=RSHEuCkD; spf=pass (google.com: domain of linux-kernel+bounces-1651-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1651-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id df11-20020a05640230ab00b0055296330a49si1206199edb.691.2023.12.15.13.04.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 13:04:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1651-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=RSHEuCkD; spf=pass (google.com: domain of linux-kernel+bounces-1651-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1651-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2B5AA1F24CC3 for ; Fri, 15 Dec 2023 21:04:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8461747F5B; Fri, 15 Dec 2023 21:03:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="RSHEuCkD" X-Original-To: linux-kernel@vger.kernel.org Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 838FE4777D; Fri, 15 Dec 2023 21:03:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk 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=3sddRRvwk/fTKF7doym0HPnBmsg/UatU52NDddZvLeM=; b=RSHEuCkD54S7yVRnkkdRcJRhGB CCGEmrAERKHDC9A23+dPZdarY6qX1xEXD04Fd6FYVZ2haVIn4+aWT4QIFjld3w02jGzgMq+UXLQDG uB1rFook2rv0QRa21NRESCSJtqiU4skicVFf4JN/Z3SHmGp63xgpextFd2ddlJIoxsIcje2EDRlKi qLZL3dYhDnG1LkYaTy/ZPivcDvPAKMfuhgGQnW+nUZfmyimzpIEnv3dmIciv5FIvxBB7bkqL0KQgA RkNS86h1OL0o04t8ROx7kJP6ownxFmdArQXSB+7HnT/NsLrGq5KSFJ3v475DsRLOdCBama76TWRf1 junaDkpw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rEFLU-00D57W-27; Fri, 15 Dec 2023 21:03:44 +0000 Date: Fri, 15 Dec 2023 21:03:44 +0000 From: Al Viro To: Greg KH Cc: Nick Desaulniers , tanzirh@google.com, Kees Cook , Andy Shevchenko , 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: <20231215210344.GA3096493@ZenIV> References: <20231205-libstringheader-v1-1-7f9c573053a7@gmail.com> <20231205213807.GE1674809@ZenIV> <2023120608-ivy-snowdrop-890d@gregkh> <2023120657-henna-spongy-9ef6@gregkh> <20231206005542.GJ1674809@ZenIV> <20231206030047.GL1674809@ZenIV> <2023120650-faucet-palpable-f1a3@gregkh> <20231214210400.GR1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231214210400.GR1674809@ZenIV> Sender: Al Viro On Thu, Dec 14, 2023 at 09:04:00PM +0000, Al Viro wrote: > drivers/firmware/arm_scmi/shmem.c:13:#include Should just use linux/bug.h and be done with that. > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:10:#include Completely pointless; not to mention that none of the types defined there are used anywhere in that file, the previous line pulls their private header, which explicitly pulls linux/types.h. > lib/trace_readwrite.c:10:#include Yeccchhh... This is just plain wrong. What happens here is that hooks are added to writeb() et.al., to allow ftrace to play with those. By default these are empty inlines; with CONFIG_TRACE_MMIO_ACCESS they are real function calls, the functions living in lib/trace_readwrite.c asm-generic/io.h is pulled by all asm/io.h instances, so that's where the externs went. That would've made sense, except that asm-generic/io.h is used as a backstop for architectures that had not bothered to define e.g. readl() of their own. And *that* is where the calls of those hooks had gone. IOW, if architecture has readl()/writeb()/whatnot of its own, it won't get those hooks at all. It smells like a conversion in progress, stalled after the first (and only) architecture where that thing is selectable. In effect, it's arm64-specific. > net/sunrpc/xprtrdma/verbs.c:58:#include Bogus, same as the include of asm/bitops.h immediately before that line (the latter would've blown up if we hadn't already pulled linux/bitops.h - which needs asm/barrier.h and pulls it, TYVM). > rust/uapi/uapi_helper.h:9:#include To the rust crowd, that... It's wrong for e.g. powerpc - uapi/asm/ioctl.h in there does pull asm-generic/ioctl.h, but only after #define _IOC_SIZEBITS 13 #define _IOC_DIRBITS 3 #define _IOC_NONE 1U #define _IOC_READ 2U #define _IOC_WRITE 4U which means that trying to use asm-generic/ioctl.h directly will yield the wrong numbers out of _IOC() et.al. So... in arch headers (..../asm/.../*.h and similar): OK, that's what asm-generic is for in asm-generic headers themselves (..../asm-generic/.../*.h): OK in linker scripts (*/*.lds{,.S}): asm-generic/vmlinux.lds.h is fine in those (and nowhere else) in */*audit*.c: asm-generic/audit_*.h is OK there (ugly, but...) in drivers,fs,init,io_uring,ipc,kernel,mm,net,sound,virt and probably rust: 100% bollocks, not a single valid use in lib/trace_readwrite.c: asm-generic/io.h is an exception; complicated story. That leaves several instances in arch/, tools/ and include/linux, plus some oddities in makefiles, scripts, etc. And include/linux ones are also not obviously correct - e.g. linux/bug.h pulls asm/bug.h, then (under ifdef CONFIG_BUG) asm-generic/bug.h. AFAICS on all architectures we have asm/bug.h pulling asm-generic/bug.h (the ones that don't have asm/bug.h of their own get it generated with just such an include in it). So do we need that include in linux/bug.h these days?