Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp586455rdb; Tue, 5 Dec 2023 13:51:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGb4jb1ZtMc7D9a0nmagJu2C3M7ey3AyHzaBa8hXgLlui4wfkaC2it17XfWGlYgahGeAi/W X-Received: by 2002:a17:90b:480b:b0:286:ab98:ea56 with SMTP id kn11-20020a17090b480b00b00286ab98ea56mr1949424pjb.82.1701813100340; Tue, 05 Dec 2023 13:51:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701813100; cv=none; d=google.com; s=arc-20160816; b=nH1dnOIOhQwbwdY20efvQmpU3qENr/vljPf+qNNqbjyEMwbib7kfFFUykgJ7bEEWFD QMcwj958h0AxQT9jmvrmJnSUsrElFDmuyAA5i5HtWbxTe9m1fNeSfJl8OFZgR+qW6VKM C8OSnfLVJubH7HStQ0OUvM3f4DigQSdmYnJ3l90/3qWIFf/z3QznsLznRYPh1+Ci4xPN 7NBtHsFeBSjMLezI8hsUOLMw2MoO1ksFNqPTZKmpZY0ZR69TDqFHKHToE4SLNGBZSsir 2ArFlDxIVLjOaSXL383VrOyzfbeBxkb7ibC5GKTuW0S4aP/H21HuHfY8L3co8y55eBqL 5wkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=tWvJtgJjO5YUTGvzn9ntJuWrPBTqvXSdfxI0wQvK8zk=; fh=jIKbeFKdkiY37aW3gP1E2e09b2tV4zNSyhZPCv8M6+o=; b=iAyTdmuc52UdOTCQKkRVisb3z/w7tZR+eyiJEcAk4DBINMZa2CMnM2/79KGj7XyF/E cWrJVEpUzlPYJMTTUSy2TWoztrYdI8gjmBKKOYxuB871ogEDIPJh7fOrn3+updPkC4/3 s3rFFb4HtlwIBPLIeJ/k/aQ7VCnYYC8wUUy2g1ib+gOR8lsgzyF87roECmYDX9Tbrz23 w+dzSJ0UvZjnWqSOTeStYvbv7e4gln3F0eaJ46KlBx4RNaKgn5DEtGH/P3TtMnneVL1v Pm2/4u76cQY80NJlxjiAfpuJnAQ/TEME9eTVtzJw3qVErYFj0FbjSRvu06X5gOihek0Q wRog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="4dC/J/EE"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id n4-20020a1709026a8400b001cfd24c7b73si9939527plk.2.2023.12.05.13.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 13:51:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="4dC/J/EE"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 856D3804A606; Tue, 5 Dec 2023 13:51:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231352AbjLEVvS (ORCPT + 99 others); Tue, 5 Dec 2023 16:51:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbjLEVvR (ORCPT ); Tue, 5 Dec 2023 16:51:17 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B33F1A5 for ; Tue, 5 Dec 2023 13:51:23 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3333074512bso63080f8f.1 for ; Tue, 05 Dec 2023 13:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701813081; x=1702417881; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tWvJtgJjO5YUTGvzn9ntJuWrPBTqvXSdfxI0wQvK8zk=; b=4dC/J/EEUIFyO+S78o1CgIIqdN23rNQZmJfDXpqcAmevHvxjIN00i5dnwAKZCUfrf5 bkjZCo50G8XVubwjmiSpR0vz6OxnrOLjdFN6XDMAXNhkgKi1VQTSgb8kL6DIf2QDETv7 TEoNBqA6LObrJLfjZHzT24yPd2/ixKWwN1de1hVCryHUF/UE0Uv0oAtsCw2qxYkBf83B i64G/zqrjCTY0CNipb91VTP/e7NpvTtIdr0/lsMuSF4f6yBtJFc8g2EkPo3zi7GIO5YS 9z22On/fgtz+LH5tT0X+bZQ9nekQBb2U7xkCTSakVErQRixhCs7ahVj8P0hGVNVmFsso 95rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701813081; x=1702417881; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tWvJtgJjO5YUTGvzn9ntJuWrPBTqvXSdfxI0wQvK8zk=; b=h4gB8+FasToNC6VVQhbh6oejynTtnjz90UawFkE0Zvqlj3CP11IgVZBPFsG9BF2pW3 yOTi/l6LjO+23SLCR9WYKAjTFDbsIOUK1QyfRERsfyR0ECJ7vAHl6+Yx2MHQB2qsrzAk RjpKODHKRTrxqyCgX4y7bNbYCkkf8SxZh8ELgnbxXTpBfnUc8+fOS6Sca7TUKcdrI0vo GrD10s8WmLhSU/l+xnWYBiZg2WLXssN+oVSMKgi8Nm8jQh8CAx48zCxV1cIzjxEL9W/C 85pt2alanHROD4jJg9Sd3UXWXY0XZNNBTld+huHz0/Xssw+uW8XB0t3+iIqivyKCnRCH 76RQ== X-Gm-Message-State: AOJu0YwzFGrAh7Hi6fYulIWXCQrQ0o/xko/JM0mArGcWmnmdEUjdVWNx u0lvudDMtENdK+bEsBRErKywt8hnbRCbkgTtIIg5BQ== X-Received: by 2002:a05:600c:1c01:b0:407:4126:f71c with SMTP id j1-20020a05600c1c0100b004074126f71cmr975537wms.6.1701813081506; Tue, 05 Dec 2023 13:51:21 -0800 (PST) MIME-Version: 1.0 References: <20231205-libstringheader-v1-1-7f9c573053a7@gmail.com> <20231205213807.GE1674809@ZenIV> In-Reply-To: <20231205213807.GE1674809@ZenIV> From: Nick Desaulniers Date: Tue, 5 Dec 2023 13:51:10 -0800 Message-ID: Subject: Re: [PATCH] lib/string: shrink lib/string.i via IWYU To: Al Viro Cc: 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Tue, 05 Dec 2023 13:51:35 -0800 (PST) On Tue, Dec 5, 2023 at 1:38=E2=80=AFPM Al Viro wr= ote: > > On Tue, Dec 05, 2023 at 08:58:53PM +0000, tanzirh@google.com wrote: > > This diff uses an open source tool include-what-you-use (IWYU) to modif= y > > the include list changing indirect includes to direct includes. > > How does it account for arch- and config-dependent indirect includes? > > In particular, on sh this patch breaks, since there word-at-a-time.h does= not > contain an include of kernel.h, even though it uses REPEAT_BYTE. This is > a very simple case (they really ought to include kernel.h, same as all ot= her > instances of word-at-a-time.h), but I would expect arseloads of more subt= le > breakage in anything less trivial. > > And I'm not at all sure that there's no config-dependent breakage as well= - > this had been caught by quick make allmodconfig + make lib/string.o on > a bunch of architectures; the graph of indirects includes (as well as the > set of symbols needed for given header) is very much config-dependent. We're sending these to Kees to stage in branch flowing into linux-next in order for the patches to get soak time in linux-next; it's not possible to test every possible randconfig, but with enough soak time and the bots chewing on linux-next, I think we can get to a certain level of confidence. We'll ramp up the amount of testing we're doing locally as well. (I did quite a few randconfigs locally in a loop; didn't test all architectures) We can probably fetch the kernel.org toolchains for very extensive testing. https://mirrors.edge.kernel.org/pub/tools/crosstool/ > > > IWYU is implemented using the IWYUScripts github repository which is a = tool that is > > currently undergoing development. These changes seek to improve build t= imes. > > > > This change to lib/string.c resulted in a preprocessed size of > > lib/string.i from 26371 lines to 5232 lines (-80%). > > 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. It's not clear to me when it's ok to #include . Is there a convention here that I'm missing? > > > If there are any problems with the output of the tool please raise an > > issue on the github. > > Sorry, no. Your tool, your workflow, of course, but I don't do github is= sues. > You are welcome to the contents of this reply, but I'm not using browser-= based > UI without very strong reasons; this one isn't. No problem; Tanzir, please drop that part of the commit message in future patches. --=20 Thanks, ~Nick Desaulniers