Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2417912imm; Thu, 20 Sep 2018 12:53:29 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZSJ1G0hvhTrL4xgOT7c4y1rfSPLOm6eGiP1ahGeEzWSzq4FSQwR1b4ApL9U+zL+urGU1AO X-Received: by 2002:a63:ea49:: with SMTP id l9-v6mr38214553pgk.427.1537473209273; Thu, 20 Sep 2018 12:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537473209; cv=none; d=google.com; s=arc-20160816; b=xEYJjErEfsSwT0a7oIZxJg6Ps8seDDiGuA0/pZJbrmWSh6Bez0NBjvC5IEkRySVkZf NI1an3kD2Yk/GiYUBMiDMn73K+Sp13Uou3n4A/THigV2a50jEJKUKLd3LRE4AuNmzGzn fU2FxqjVeDAuOPZ1R9mPsSNBiKFpa4DFpaqpnmfWZIVzzTcCOtlL52wd5Xwz6x1UwnDr YLC2wqdC+yKNBIaKdWqEezwhI+NmoodrkJRp2bS8rSBekSHuHE1jf63EEChwgnjEumOv +MZ5d8QsTSdI4/hmpoL9clnUs/ZDJYHgRU2ef90g3jcKyGQgHMu212ShEs/LRiOWLjIj vW2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=BDdK5dFa0GPHKQm4ROhmvYUVaw/KLMEFxVHY7XLMKg8=; b=dMSJdamFLijtXNtKb1OwbvVZS65pLNggIIbgfBAlHaFwOkxZeCNI3v8tpEKHSXZx08 cw8i+vzrB8JottW0MhewVWt+pQQCneK6J60qo9EaUb68kePY4j/LvKxOQkIhPxoBzLr+ yFMTfebP0gV6KIj0UAkWlW9bDTL2BF8AXK7v8EN4TJt8+Bfw/SYKt+dc3gtR+Go3q8V1 pqOSMHlHJPlXs1WzIXO6ndQUCBnW05AYf12ho9aA8r1ZbtWFiKVHC1pWExqZn3z4QRXa WsrYnNgEIR1p/YlBUx7Hm029lgSucvMsKitCNP7cLQPkNWFs81HGHzhmJ7njRzgNnGIs GpXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=IdhdYQfy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c12-v6si22101917plr.32.2018.09.20.12.53.09; Thu, 20 Sep 2018 12:53:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=IdhdYQfy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388044AbeIUBiJ (ORCPT + 99 others); Thu, 20 Sep 2018 21:38:09 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:34952 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726582AbeIUBiJ (ORCPT ); Thu, 20 Sep 2018 21:38:09 -0400 Received: by mail-yw1-f66.google.com with SMTP id 14-v6so4268639ywe.2 for ; Thu, 20 Sep 2018 12:53:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BDdK5dFa0GPHKQm4ROhmvYUVaw/KLMEFxVHY7XLMKg8=; b=IdhdYQfyQqVgTfBjhJwz9ISgdv9PjnYE5AEVk/tOP7YYKoOEAIpWRZ07wp/U8hQsZD 54+E47tEL7C6vgkZPDs19Nog5b3MYrVcm8Ilu0lJr5ncBPd2JpYjtCKr1ZZrW9LdbZhF 4bnTVgEPymHjaOMpB5BqIajngAvHBpmrqsnVw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BDdK5dFa0GPHKQm4ROhmvYUVaw/KLMEFxVHY7XLMKg8=; b=qI6r8iUT1Flg0RKActW76WOY9S0KrlGOMuspf9R9GfOxI0h5l7AZ6IrZOV9MJRoBwS kCIJtLe/0Co8ayNG1mfpH+NFQYhpcfhOM4PPHkWMjfM/W5CR5R1hCrsD0rwen7fkC0cP dPHhBOUJOK9d3gdmehWQgih0bYLzsB9c2QBkDsZgjxw/emVVLvDIkIObtSPPdduMdLgF Q15Niv7vA+T6s/qSDouKh26TEgHVtqpKqCIcZi1wTmMDjBbx5ULX5UVdd5AoewEZneMT 1LMnsKj00V78d4bFW5DqLayMNkuxMjh7G+uCcrQJ6y466qQzbmPr1VJ+ApC9Jh2R+JOZ 0Z5A== X-Gm-Message-State: APzg51B36mrhvXll1XoeNbZqvUTVE0dwVNAJA/JB4guF+VzK+rCHgUf5 Ijs9DDQqjsxg9zvckPe+TcbiKz0JiiM= X-Received: by 2002:a81:3c13:: with SMTP id j19-v6mr18338934ywa.448.1537473182028; Thu, 20 Sep 2018 12:53:02 -0700 (PDT) Received: from mail-yw1-f52.google.com (mail-yw1-f52.google.com. [209.85.161.52]) by smtp.gmail.com with ESMTPSA id f82-v6sm5419067ywf.58.2018.09.20.12.52.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Sep 2018 12:52:59 -0700 (PDT) Received: by mail-yw1-f52.google.com with SMTP id 14-v6so4268551ywe.2 for ; Thu, 20 Sep 2018 12:52:58 -0700 (PDT) X-Received: by 2002:a81:2288:: with SMTP id i130-v6mr3004918ywi.288.1537473178439; Thu, 20 Sep 2018 12:52:58 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:5f04:0:0:0:0:0 with HTTP; Thu, 20 Sep 2018 12:52:57 -0700 (PDT) In-Reply-To: <20180920172301.21868-14-miguel.ojeda.sandonis@gmail.com> References: <20180920172301.21868-1-miguel.ojeda.sandonis@gmail.com> <20180920172301.21868-14-miguel.ojeda.sandonis@gmail.com> From: Kees Cook Date: Thu, 20 Sep 2018 12:52:57 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 13/15] Compiler Attributes: enable -Wstringop-truncation on W=1 (gcc >= 8) To: Miguel Ojeda Cc: Greg Kroah-Hartman , LKML , Andreas Dilger , Masahiro Yamada , Michal Marek , Steven Rostedt , Mauro Carvalho Chehab , Olof Johansson , Konstantin Ryabitsev , "David S . Miller" , Andrey Ryabinin , Thomas Gleixner , Ingo Molnar , Paul Lawrence , Sandipan Das , Andrey Konovalov , David Woodhouse , Will Deacon , Philippe Ombredanne , Paul Burton , David Rientjes , Willy Tarreau , Martin Sebor , Christopher Li , Jonathan Corbet , "Theodore Ts'o" , Geert Uytterhoeven , Rasmus Villemoes , Joe Perches , Arnd Bergmann , Dominique Martinet , Stefan Agner , Luc Van Oostenryck , Nick Desaulniers , Andrew Morton , Linus Torvalds , "open list:DOCUMENTATION" , Ext4 Developers List , Sparse Mailing-list , linux-kbuild Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 20, 2018 at 10:22 AM, Miguel Ojeda wrote: > Commit 217c3e019675 ("disable stringop truncation warnings for now") > disabled -Wstringop-truncation since it was too noisy. > > Having __nonstring available allows us to let GCC know that a string > is not meant to be NUL-terminated, which helps suppressing some > -Wstringop-truncation warnings. > > Note that using __nonstring actually triggers other warnings > (-Wstringop-overflow, which is on by default) which may be real > problems. Therefore, cleaning up -Wstringop-truncation warnings > also buys us the ability to uncover further potential problems. > > To encourage the use of __nonstring, we put the warning back at W=1. > In the future, if we end up with a fairly warning-free tree, > we might want to enable it by default. > > Signed-off-by: Miguel Ojeda Yessss. :) Reviewed-by: Kees Cook -Kees > --- > scripts/Makefile.extrawarn | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn > index 8d5357053f86..b8f36f5f43f2 100644 > --- a/scripts/Makefile.extrawarn > +++ b/scripts/Makefile.extrawarn > @@ -29,6 +29,7 @@ warning-1 += $(call cc-option, -Wmissing-include-dirs) > warning-1 += $(call cc-option, -Wunused-but-set-variable) > warning-1 += $(call cc-option, -Wunused-const-variable) > warning-1 += $(call cc-option, -Wpacked-not-aligned) > +warning-1 += $(call cc-option, -Wstringop-truncation) > warning-1 += $(call cc-disable-warning, missing-field-initializers) > warning-1 += $(call cc-disable-warning, sign-compare) > > -- > 2.17.1 > -- Kees Cook Pixel Security