From mboxrd@z Thu Jan 1 00:00:00 1970 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 AA14C6FCD1 for ; Tue, 5 Dec 2023 21:57:35 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="qlh/FNeD" 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=4R8XorxoFVOpovwERfSrloKkn2fMEhR5jZoBji1BSzM=; b=qlh/FNeDT4RM5b8OO4gTtNwyyw Yj566rfENDUFrZyrSODB7/RDqkMAoxkYS6Kqmvz/6ib39OUcGVHBY2AdXtFHtOrWZMpAmntVEYmeq Q4ox4UkGCyDPct/YjeoqTVzAak1qLHfUSr9eHYzJgCGeaSv/ofdJavh6WHUxRUviF/KOMiAeXuHxx cjvhQlTkXKiQ53swhQP37deCDEWQT51eQYoWRVjm+ZboLMI1xvqJT8iHwcV73gQGDV35Gccz1AUGz LGYZmNwp1qXNNKD2M9l634UMZw0J2f7EEHy8VVTMz28+ht0YI6Xh6xz2sEm6PBrlsNsU6Kl7peIep 16Q8aXKQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rAdQ1-007Tjl-1a; Tue, 05 Dec 2023 21:57:29 +0000 Date: Tue, 5 Dec 2023 21:57:29 +0000 From: Al Viro To: tanzirh@google.com Cc: 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: <20231205215729.GG1674809@ZenIV> References: <20231205-libstringheader-v1-1-7f9c573053a7@gmail.com> <20231205213807.GE1674809@ZenIV> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231205213807.GE1674809@ZenIV> Sender: Al Viro On Tue, Dec 05, 2023 at 09:38:07PM +0000, Al Viro wrote: > It also breeds includes of asm/*.h, by the look of the output, which is > not a good thing in general ;-/ E.g. #include *anywhere* > outside of linux/uaccess.h is a bad idea. Let me elaborate a bit: Consider e.g. a situation when we have linux/foo.h pulling asm/foo.h; among the things declared there is foo_bar(), which is identical in 18 instances of asm/foo.h (out of current 21). At some point we notice that; the obvious approach would be to have 3 unusual architectures have their asm/foo.h define _ARCH_HAS_ODD_FOO_BAR and put the common variant in linux/foo.h under ifndef _ARCH_HAS_ODD_FOO_BAR. Except that any file that pulls asm/foo.h will get broken by that. And something like your tool might convert the users of linux/foo.h to asm/foo.h - all it takes is using only the primitives that currently happen to be in asm/foo.h on all architectures. This is not an artifical example, BTW - look at the history of uaccess.h and checksum.h...