From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 566A4C4361B for ; Wed, 16 Dec 2020 07:26:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A18E22313F for ; Wed, 16 Dec 2020 07:26:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A18E22313F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8BF1F6B0036; Wed, 16 Dec 2020 02:26:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 86D8C6B005D; Wed, 16 Dec 2020 02:26:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75C9B6B0068; Wed, 16 Dec 2020 02:26:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0153.hostedemail.com [216.40.44.153]) by kanga.kvack.org (Postfix) with ESMTP id 5C9366B0036 for ; Wed, 16 Dec 2020 02:26:37 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D0CB3362C for ; Wed, 16 Dec 2020 07:26:36 +0000 (UTC) X-FDA: 77598312792.11.coat15_4c0817f2742a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id B41A5180F8B80 for ; Wed, 16 Dec 2020 07:26:36 +0000 (UTC) X-HE-Tag: coat15_4c0817f2742a X-Filterd-Recvd-Size: 4643 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Dec 2020 07:26:36 +0000 (UTC) Received: by mail-lf1-f45.google.com with SMTP id x20so26321109lfe.12 for ; Tue, 15 Dec 2020 23:26:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Dq56PI1RpyZpC/WnCE3DqZtwapEa6Hc/yZMjBY7XqHo=; b=TyY0++k7un8kdA2Uaf8jGaA5HOodlctoLp8riSlKqeipfZAVmL/gTYnPLUzS/g+5QD AeEUv4+WeTLI8dIkL3oFscOYaiW9HG15mDGLSpYf7kOHktxaKHyDxFOggGXTJcaTULkZ 8eaOg526ElK6yGhHPjVLHXaE6TMq2w0Q0kx/4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Dq56PI1RpyZpC/WnCE3DqZtwapEa6Hc/yZMjBY7XqHo=; b=auXBYbrkMK//sDFAVou31u7hD4/A92n34tyWMpuGxgHyJ2J/uQe0CjfcU68weQQnep PRoic0z6Oi5VnucjVoxi/tPLF3sMCQQv+yymXG5phPyqd5m55qjFmrFBT5+pds1Ramc7 b3hoBfPSDBd4wkxhzn/bZ9Pul7/tIMw6zXaQnDTHSqPaJt/pIXBdA3Y3+iaN58moPREF vlWOR0pg0kn46gKPqJG9Rb/G1L30Uxt5Fe1tUu++VHlxqusB/5EwYa29PxLyQiduB+9E aI+9wGl/AWKuVVmV6QXy77W3xi5EmLr28F0vqzZpFMDkNBn4juFX8iF52gWGoIVuhZ5H B5kg== X-Gm-Message-State: AOAM53202O1qG3/w/usmjReI3GvsxybSKDuIwj+Td77Z819KNcieyLk6 I8sGGI/QDwh/PvNN8e7V73oiiipLtWQPEA== X-Google-Smtp-Source: ABdhPJzGtR2uoJcARiKBFQS0ZCu0ezzEnXvWiQd5ngh0JEdNDb6D/05bOy7NFxQHDqN3iZwKMcM2ig== X-Received: by 2002:a2e:7011:: with SMTP id l17mr13403045ljc.181.1608103593675; Tue, 15 Dec 2020 23:26:33 -0800 (PST) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com. [209.85.167.44]) by smtp.gmail.com with ESMTPSA id a4sm178121ljp.14.2020.12.15.23.26.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Dec 2020 23:26:32 -0800 (PST) Received: by mail-lf1-f44.google.com with SMTP id o13so22658603lfr.3 for ; Tue, 15 Dec 2020 23:26:32 -0800 (PST) X-Received: by 2002:a19:8557:: with SMTP id h84mr11735594lfd.201.1608103591993; Tue, 15 Dec 2020 23:26:31 -0800 (PST) MIME-Version: 1.0 References: <20201215204156.f05ec694b907845bcfab5c44@linux-foundation.org> <20201216044350.TKAL6BULW%akpm@linux-foundation.org> In-Reply-To: <20201216044350.TKAL6BULW%akpm@linux-foundation.org> From: Linus Torvalds Date: Tue, 15 Dec 2020 23:26:16 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 28/95] string.h: add FORTIFY coverage for strscpy() To: Andrew Morton Cc: Daniel Micay , Daniel Axtens , Kees Cook , laniel_francis@privacyrequired.com, Linux-MM , mm-commits@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Dec 15, 2020 at 8:43 PM Andrew Morton wrote: > > From: Francis Laniel > Subject: string.h: add FORTIFY coverage for strscpy() > > The fortified version of strscpy ensures the following [..] So I've taken this, because it follows the pattern of what we already have, but I have to say that the "fortify" stuff is now about half of string.h. I think it should probably be split out into its own header file, and then string.h could just do #if !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && defined(CONFIG_FORTIFY_SOURCE) #include #endif or similar. That won't help my merge window build times (I build with allmodconfig, so I'll have CONFIG_FORTIFY_SOURCE=y and so my poor compiler will end up always going off and seeing all that every time somebody glances at string.h), but I think it would be a cleanup regardless. And people who _don't_ build with FORTIFY_SOURCE wouldn't have to read and parse that big chunk every time gets included. (And yes, just reading the source file and tokenizing it - even if it's all inside an #ifdef that turns off all the other phases - is actually quite noticeable overhead in a C compiler. Surprisingly so) Linus