Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1318243rdd; Wed, 10 Jan 2024 16:09:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcXDYG5JM8r49Mhc9ro7gNdjv70fZHRnVXXWGMVu9auq4wP0OgJ4Yc/8eYKYPyZ+3QjP7Q X-Received: by 2002:a05:6a00:3d42:b0:6da:c739:11a1 with SMTP id lp2-20020a056a003d4200b006dac73911a1mr535000pfb.9.1704931743463; Wed, 10 Jan 2024 16:09:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704931743; cv=none; d=google.com; s=arc-20160816; b=tSYP7EDrdvecsF7MKyW3ZmBO/3ojm7JliEBmTwxGZgYGwJK/iHTzjm3McjV3p6ZAtn vPR08c4EzCTENIcUNgn8u0loJEkP8xnpB/K3ZoLskBYqN4YyJb+CJv5Lf/8ZB1LwC8yh 49WCOZN8CRPjxEbqIfuZeLW17GSgnslc4s2pu++pcWNsEzhDgvwtpn3Pv2CaEuZjCz6j WAuLcoHB8gDrG4prZJdBpQKy5XQicim45ic6P2E9AIxwEpK7X/AdwzApaqo/8q+VsGCV cveP3uhPa//DokKH+u8Sf60ke2Aafp5N1X0cMhInGyD8YergnMosSiBqj/bkJijoWoep qixA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=TShArdENafTOCTnI/LZrgLzX+BUXpRaca4Iuv2KbFTM=; fh=MweQEl9d9yOg+oBWw824NgtTCVVGZHoAhu2wA3b6Ge0=; b=iCYuOUziVPSokQpgM3BGeKbtBkcbXm2IJW3D4KdHt8mZtLGkbFHx9Gl8BF8HdRhBaV kWAFkJ6jeRPXB0HplGIz9fnN0gJgdOSLi3Gt2Anrg3uS1Rq9IDrKp4ZvvyeA0PjnJK2z OQya/cYn57d5R5oxggnfyJkSKABDtxoL7CKCsLzNO2fGDutTxBPd2AL84shZJUjP9knt b4x1pzjwSmhA9e0uhvBiSew+0sVSZBxAxF104F0GtwZTg+ZYhZu4eH3+LSQqAlRvOJa8 eFZLPFMudZKJOcAy+yeAz70e8Wc8Cby2AfvdXT1/7JPBSPiVzMOapVuRQd/8Z5ucdXBZ gDHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N86QjvFN; spf=pass (google.com: domain of linux-kernel+bounces-22905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id l130-20020a633e88000000b005ced2a6b89fsi4671452pga.74.2024.01.10.16.09.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 16:09:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N86QjvFN; spf=pass (google.com: domain of linux-kernel+bounces-22905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org 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 A9466B24B26 for ; Thu, 11 Jan 2024 00:07:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92660ED6; Thu, 11 Jan 2024 00:07:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="N86QjvFN" Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C079EBB for ; Thu, 11 Jan 2024 00:07:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3bc1414b48eso5250649b6e.2 for ; Wed, 10 Jan 2024 16:07:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704931662; x=1705536462; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TShArdENafTOCTnI/LZrgLzX+BUXpRaca4Iuv2KbFTM=; b=N86QjvFNOBl6smc2FKWY7Jbopu9SnKSwBRQT9yrd6EgOSx682/a1ohT6JVQfs4m4tH UfEcWeTW+VBbhtCc4UZMYKb6sahAcan6WPBcbc/hAsi772h5ch14EeDDP+m5V0wkZnFR HSRMDEXO6d7dQgStFx+PjhYMwW7UnJATPydKg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704931662; x=1705536462; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TShArdENafTOCTnI/LZrgLzX+BUXpRaca4Iuv2KbFTM=; b=ncqzplIp3l2jeHG1cPLT+oHH+MLFwGmBmP2So35z6dp7mSm0/5cgu4sa1Qzom5CpFP mq+zxVMJT8QhR9nbGL0uRQZ25IGfuXFJgjL8+EoipgTo9MHrTbCPiHrllE2U2fbwC17J idZ/ZlccRFmtYtRG1w7F6IHRIpa/LWMLGgkMjOF5syjUp1InFoovEpF4Y1Pew1gb1p8U 5gGjF+vZIdJPdla1oGG1Pnm6N7qSuRKhAUTwl4q1rckQj/3K4MZmABmu0ccQtpLAOtHn HmpvqVlk5f4PouJnaKnZxfeT3feqMCwipaQZkJqOEfHBmk9d9lXaXAaJRZMJoAwTU2B/ 64uQ== X-Gm-Message-State: AOJu0YxNNSeKf/NK8F/cQMmuRPJhM/jxeR2mW9me8DR8WJX75CMWURlL AcJGp4Gn3yKEq4fgYciG+6iemPIxR+Nk X-Received: by 2002:a05:6808:3605:b0:3bd:48a1:c49f with SMTP id ct5-20020a056808360500b003bd48a1c49fmr416053oib.27.1704931662499; Wed, 10 Jan 2024 16:07:42 -0800 (PST) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id g5-20020a62f945000000b006d997b5d009sm3997315pfm.69.2024.01.10.16.07.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 16:07:41 -0800 (PST) Date: Wed, 10 Jan 2024 16:07:41 -0800 From: Kees Cook To: Justin Stitt Cc: Tanzir Hasan , Andy Shevchenko , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Nick DeSaulniers , Andrew Morton , llvm@lists.linux.dev Subject: Re: [PATCH v2 2/2] lib/string: shrink lib/string.i via IWYU Message-ID: <202401101606.A31647E@keescook> References: <20231214-libstringheader-v2-0-0f195dcff204@google.com> <20231214-libstringheader-v2-2-0f195dcff204@google.com> <20240109214910.oeopqq5j2gyl33dc@google.com> 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: <20240109214910.oeopqq5j2gyl33dc@google.com> On Tue, Jan 09, 2024 at 09:49:10PM +0000, Justin Stitt wrote: > On Thu, Dec 14, 2023 at 09:06:13PM +0000, tanzirh@google.com wrote: > > This diff uses an open source tool include-what-you-use (IWYU) to modify > > the include list changing indirect includes to direct includes. > > IWYU is implemented using the IWYUScripts github repository which is a tool that is > > currently undergoing development. These changes seek to improve build times. > > > > This change to lib/string.c resulted in a preprocessed size of > > lib/string.i from 26371 lines to 5259 lines (-80%) for the x86 > > defconfig. > > > > Tanzir, I wonder if you could include some of the symbol names used for > some of these more esoteric headers. Let me describe what I mean: > > Andy talks about "why " and perhaps some comments (in your > patch message, not in the source itself) about which symbols are being > used from these headers would serve useful. I believe IWYU can generate > this information and should clear up some confusion or lead to better > suggestions from reviewers if we understand why a header is being > included. If there aren't any other objections, I'd like to pick this up in my tree after the merge window closes. > > At any rate, this builds for me doing randconfigs on x86_64 with these > KCONFIG_SEEDs > 1: 0x3DD9D136 > 2: 0xB4440EE4 > 3: 0x98778270 > 4: 0x8C237F26 > 5: 0x244F8A64 > 6: 0x5A5C5E5C > 7: 0xA77896BC > 8: 0x9B5FF0D5 > 9: 0x24F23F6A > 10: 0x35C0A107 > > I applied your patch on top of 5db8752c3b81bd33. > > Tested-by: Justin Stitt Thanks for the testing! -Kees > > Link: https://github.com/ClangBuiltLinux/IWYUScripts > > > > Signed-off-by: Tanzir Hasan > > --- > > lib/string.c | 14 +++++++------- > > 1 file changed, 7 insertions(+), 7 deletions(-) > > > > diff --git a/lib/string.c b/lib/string.c > > index be26623953d2..7fe1acefb1a1 100644 > > --- a/lib/string.c > > +++ b/lib/string.c > > @@ -16,16 +16,16 @@ > > > > #define __NO_FORTIFY > > #include > > -#include > > -#include > > -#include > > -#include > > +#include > > #include > > #include > > -#include > > - > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > #include > > -#include > > #include > > #include > > > > > > -- > > 2.43.0.472.g3155946c3a-goog > > > Thanks > Justin -- Kees Cook