Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6265865rdb; Thu, 14 Dec 2023 13:04:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1MHP5Hvv9pJ8Qowr3XhKKMi+7CQmYP+nMqAcZCnozaRZX4XGG1AsbM0z8sKAzz8aF86og X-Received: by 2002:a17:90b:4f8b:b0:28b:9c2:749f with SMTP id qe11-20020a17090b4f8b00b0028b09c2749fmr794077pjb.39.1702587862220; Thu, 14 Dec 2023 13:04:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702587862; cv=none; d=google.com; s=arc-20160816; b=dmMvn1iB1tpgQrElr0vklwgw4kswNSoVPtkZhFQH6PTwFotTRxFpmsvH/8kstk5hZe TRIrp6Slp0cpPq7pN620BlzayFowFU4gWAZlHhszfdKCHzclSRAAfswPHyVi5INcowCP aKQnM1cu5F02LNJKKVZ+M1CuEw6t+7f7AYEs5CDStZi4SP5KfvY7kE5R039lR349N/hd T1Ibb8BhXuzTTRTamHbaGy8X/CRd0f+zFjAdfxH9KO4kml+Vy7FQCanatHpaCiXVTf1r bkpLGNvs+Kb3RLDQ3BIBb5gmz6RiUkkSoM5NrfsXG7YPDydfWLUr7p3IMwRNSxo1RdTA udSw== 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=7FrhxwWPxjd1nrVnDhmOIzmALWzUB7ji13bBSfV+Dm4=; fh=Bn+dNc76c52z0y0i4AgMMBNkkaBE/SaonuxRzZuZRZc=; b=P5D5cKIkeZWmZPyEPOHcxoHmJV2vIxDy0Pxumdf7TOjCIo8i8KRybvw6TDtDXG16nc EIBOI2P8WJ5eeBLs+wQt4bePvYxtiwTcjc20nrfKyRT5al0aLC63wrWtXBKWjiqDfYP8 6eXvdmkt9Adw+G8VbSjyEXk81Ph80IqAmBig3xUeoV/jAvpkbTB0EJGbd0mK9BtNSAWx ETIMO6dON2TdDZFi9m0tXesIUgKXjXrnQ9e0SeELFvuC8Kpsz+JZPRzBRqFu1O2J9BJs xPLj684lTnKP4vsYuQ8BBR8xqGsw3KnNN6l4kOFvVs2O9cfTXx35ppRc9Iky4MBO5NMW Qxog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=vHqwe+0C; spf=pass (google.com: domain of linux-kernel+bounces-103-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103-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 sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id pf6-20020a17090b1d8600b0028881bb2b5bsi13395425pjb.188.2023.12.14.13.04.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 13:04:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=vHqwe+0C; spf=pass (google.com: domain of linux-kernel+bounces-103-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0B6E8B218E0 for ; Thu, 14 Dec 2023 21:04:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B069838DE3; Thu, 14 Dec 2023 21:04:11 +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="vHqwe+0C" 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 D10897494; Thu, 14 Dec 2023 21:04:06 +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=7FrhxwWPxjd1nrVnDhmOIzmALWzUB7ji13bBSfV+Dm4=; b=vHqwe+0C8DVTzGY92KpnnNrZ61 9AjwcGxoG3Z+B6DxOIX8VQEGOmuosBI6oPZmY2zpXNULYfiyLkl8djZ+AEFgYzpt49vAy0GAniFJ4 5v9WbrwDHC97+uhc5/D/1PUPO2LYNKGAKJLMZgDVPQ754lKyl15E4c1FP5wSBXJZudT/yt5i6qp3n jv3eydn+WQiJ1sz6nQKrPf0OjctP6s90DUcXuzC6eD9aKqYJNiVlsX/6snjTx5Umg7anTdjOFQBYR GBSvFcFbH9466jNlUaKxsFV6HabQYMdWsSOiXmhYhq/qmoMnr8kVAmrjAPgPtA8VackjJOvkA/lzl vf07MJPA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rDssC-00CS2n-1P; Thu, 14 Dec 2023 21:04:00 +0000 Date: Thu, 14 Dec 2023 21:04:00 +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: <20231214210400.GR1674809@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> 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: <2023120650-faucet-palpable-f1a3@gregkh> Sender: Al Viro On Wed, Dec 06, 2023 at 12:09:17PM +0900, Greg KH wrote: > > slap #include "unaligned.h" into their traps.c and unaligned.c > > (callers and definitions resp.) and strip those from asm/unaligned.h? > > At that point we can remove arch/{arc,parisc}/asm/unaligned.h - everything > > will pick include/asm-generic/unaligned.h. > > > > Then the next cycle we ask Linus to run the following: > > for i in `git grep -l -w asm/unaligned.h`; do > > sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i > > done > > git mv include/asm-generic/unaligned.h include/linux/unaligned.h > > sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild > > right before releasing -rc1 and asm/unaligned.h is gone... > > Please do, it's really annoying and would be great to fix up. FWIW, turns out that we have several places in drivers/* that pull asm-generic/unaligned.h. IMO that's completely wrong - not just in this case (it's a matter of trivially adjusting the script), but I think that as a matter of policy we should *NOT* have includes of asm-generic/*.h anywhere in drivers/ fs/ io_uring/ kernel/ mm/ net/ sound/ Current situation (outside of arch, include, scripts and tools, with asm-generic/unaligned.h cases already taken out): drivers/android/binderfs.c:32:#include drivers/clk/microchip/clk-mpfs-ccc.c:7:#include "asm-generic/errno-base.h" drivers/firmware/arm_scmi/shmem.c:13:#include drivers/irqchip/irq-ti-sci-inta.c:24:#include drivers/mtd/nand/raw/ingenic/ingenic_ecc.h:9:#include drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:10:#include io_uring/uring_cmd.c:10:#include lib/trace_readwrite.c:10:#include mm/damon/vaddr.c:10:#include net/sunrpc/xprtrdma/verbs.c:58:#include rust/uapi/uapi_helper.h:9:#include That's it. asm-generic/errno-base.h cases - just use linux/errno.h and be done with it. Anyone who goes "I've got ENOENT and ENOMEM in my driver, but those two are covered by errno-base.h and I can be clever and use just that" is wrong. asm-generic/mman-common.h - and linux/mman.h would not serve why, exactly? uapi/linux/linux/mman.h, if one really feels like it... asm-generic/ioctls.h in io_uring - definitely wrong; SIOCINQ is what it's brought for, but that's in sockios.h. It expands to FIONREAD, which *is* in ioctls.h, but... arch/alpha/include/uapi/asm/ioctls.h:11:#define FIONREAD _IOR('f', 127, int) arch/mips/include/uapi/asm/ioctls.h:64:#define FIONREAD 0x467f arch/parisc/include/uapi/asm/ioctls.h:35:#define FIONREAD 0x541B arch/powerpc/include/uapi/asm/ioctls.h:11:#define FIONREAD _IOR('f', 127, int) arch/sh/include/uapi/asm/ioctls.h:11:#define FIONREAD _IOR('f', 127, int) arch/sparc/include/uapi/asm/ioctls.h:101:#define FIONREAD _IOR('f', 127, int) arch/xtensa/include/uapi/asm/ioctls.h:23:#define FIONREAD _IOR('f', 127, int) include/uapi/asm-generic/ioctls.h:46:#define FIONREAD 0x541B See the problem? On mips the value is not 0x541B - it's 0x467F; on alpha, powerpc and sparc it's 0x4004667F, on sh and xtensa - 0x8004667F (different expansions of _IOR). The only thing that has any business including asm-generic/ioctls.h is arch/*/include/uapi/asm/ioctls.h - if it feels like doing so. Anywhere else it ought to be asm/ioctls.h. asm-generic/msi.h - looks bogus; there's an include of linux/msi.h several lines above, and that pulls asm/msi.h. Which makes it either a no-op or a build bug (the latter - if that driver can be built on x86 with CONFIG_GENERIC_MSI_IRQ defined; typedef struct irq_alloc_info msi_alloc_info_t; in asm/msi.h vs. typedef struct msi_alloc_info { struct msi_desc *desc; irq_hw_number_t hwirq; unsigned long flags; union { unsigned long ul; void *ptr; } scratchpad[NUM_MSI_ALLOC_SCRATCHPAD_REGS]; } msi_alloc_info_t; in asm-generic/msi.h). Hell knows about the rest, but they all look very dubious...