Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp32264pxu; Mon, 5 Oct 2020 23:05:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykEqpKgn3p63U+GI7AX0RHQwAbkDQqVTmLetYlaPU2IyeIhDF4+JUVKMfofJIEydYeIfjm X-Received: by 2002:a17:906:3e17:: with SMTP id k23mr3574199eji.414.1601964315041; Mon, 05 Oct 2020 23:05:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601964315; cv=none; d=google.com; s=arc-20160816; b=dS4F68c63D8rnOTiKZopXGb8lG1u8u3W7mTBUpoeX462WUuGIylQrYx/hdzXuPUJda gXNqwwh/fypHT1Zi06g0tW7u7YyKUthr4ZFGWFXy7+R01/eaIltH++TAZVQvVS52afII gEc01Ds2JwqSapksYo06AHhevw0v1Eoz/nx2WLhVIawR2Qy15OQCfxFaX+u1dsZDQyLO iISbUZOh10WqcVKUQ5k27crMZekP8OxVIWerr5hh3+YoEDfSbdQNACORZkAu1gXpmC6f C/CgCH0RM1f/rsleT7tQAcIlVScXRHPIkY3wbMcBcdK0C3CevV1KnQj0VpcDJYzwgmFj Uhjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BXyFah0M1LT/tl5rtZLB+bxtBhQm6vlhUicSg4mgrDQ=; b=eNzSM9VyF2Kdzwhj0YcbfgzFvk9ePQ353G6vU4CIX1nu8dS302i+n3Bb9yqF9bsuu3 1L+//XTcB3woawQyGuSJ2Cve3tMqwFatlWN7XV6vabjuZOviOo1rmg/+CwRFympYtx9h wqdKqGFHHPck5lrI0vSRL+Wnq5KVU2JM2H8ojaHi2+mKX+yddmpG2L0Jq3Vi7Pfz6HPj YCiUUleyTqu/D9sabptTSE2uCK3xxsm+86lFI1lfYPC8fF8MHwD60Hw5QuOxFpECeAgn WCqLHNkQ37Yy/qcsEejr+TO3yFcX3+ojSo3PVD031G0Ogu9BsL/OawLsINDeNdNrQloO LlXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=i7jY2Ub8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id r8si1706257edw.268.2020.10.05.23.04.52; Mon, 05 Oct 2020 23:05:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=i7jY2Ub8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726795AbgJFGBu (ORCPT + 99 others); Tue, 6 Oct 2020 02:01:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726588AbgJFGBt (ORCPT ); Tue, 6 Oct 2020 02:01:49 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25979C0613A8 for ; Mon, 5 Oct 2020 23:01:48 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id a17so1041339pju.1 for ; Mon, 05 Oct 2020 23:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=BXyFah0M1LT/tl5rtZLB+bxtBhQm6vlhUicSg4mgrDQ=; b=i7jY2Ub8O4E9K5Uy2G0aoxmbLQOHzuk/xBVomiMp12FFKTjg3+9qTj5PxCMyyYHXXX zwAw4LfEFBA71A9Zff5encg5+n1PCd1YRVUcCqKAGUvsg6eEBLYYvU1N5bxjwC6VCgmG 13Z8BICaPxVomWnc6imPzaYRvOfE+MM5x/CI0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BXyFah0M1LT/tl5rtZLB+bxtBhQm6vlhUicSg4mgrDQ=; b=Di8E0gakSZrm1qs6sfvQqc+vDOqd7qPJ1t8ADQHW0dn6QMC6Jy4YC858El+66ewQzt C13ceKr0QFBAQVo6l8Pf+i4SAp9xwRIb/QzxEVpX4osFv0n/qiyBw2u+5rYi9JWBoWf/ nlkzV9Z9ZWjgzIWpX1z8vwLQLIhEhpoP+H3l56CT0YntYArqCZ6JjT+Ru6uuzsb+PCCD iK31rTVkwMElrZkAsfGqSFXAg9Fvpwb2opXZAeNN2S8anCdUoxT4untd0EZUzB7v2+Su zhMW8lhCBw1cjT+zwBHBB2B8GcSbHGley8ka3Nqol0AZJfxbj/PKAEam+tl+a9cWrfIj nksw== X-Gm-Message-State: AOAM5300wvyJRKw/VgdiOhg4brY1u/gcuLqNA4cLIkL2nCntpyV2t872 is/JG8+4/rTzuh6SZv0aSgZ2gDMQyfiK4Tek X-Received: by 2002:a17:902:9008:b029:d3:b4d2:9a2 with SMTP id a8-20020a1709029008b02900d3b4d209a2mr1824586plp.15.1601964107582; Mon, 05 Oct 2020 23:01:47 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h2sm2060779pfk.90.2020.10.05.23.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 23:01:45 -0700 (PDT) Date: Mon, 5 Oct 2020 23:01:44 -0700 From: Kees Cook To: Nathan Chancellor Cc: Andrew Morton , Linus Torvalds , Ard Biesheuvel , Arnd Bergmann , Masahiro Yamada , Michal Marek , Nick Desaulniers , Marco Elver , Randy Dunlap , Dmitry Vyukov , George Popescu , Herbert Xu , Peter Oberparleiter , Andrey Ryabinin , clang-built-linux@googlegroups.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] ubsan: Move cc-option tests into Kconfig Message-ID: <202010052258.96765BC83@keescook> References: <20201002221527.177500-1-keescook@chromium.org> <20201002221527.177500-2-keescook@chromium.org> <20201004070847.GA1650@Ryzen-9-3900X.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201004070847.GA1650@Ryzen-9-3900X.localdomain> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 04, 2020 at 12:08:47AM -0700, Nathan Chancellor wrote: > On Fri, Oct 02, 2020 at 03:15:24PM -0700, Kees Cook wrote: > > Instead of doing if/endif blocks with cc-option calls in the UBSAN > > Makefile, move all the tests into Kconfig and use the Makefile to > > collect the results. > > > > Suggested-by: Linus Torvalds > > Signed-off-by: Kees Cook > > Link: https://lore.kernel.org/lkml/CAHk-=wjPasyJrDuwDnpHJS2TuQfExwe=px-SzLeN8GFMAQJPmQ@mail.gmail.com/ > > I tested menuconfig to make sure all the flags when CONFIG_UBSAN_MISC is > flipped. > > Reviewed-by: Nathan Chancellor > Tested-by: Nathan Chancellor Awesome, thank you! > One comment below. > > > [...] > > diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan > > index 9716dab06bc7..72862da47baf 100644 > > --- a/scripts/Makefile.ubsan > > +++ b/scripts/Makefile.ubsan > > @@ -1,37 +1,21 @@ > > # SPDX-License-Identifier: GPL-2.0 > > > > -export CFLAGS_UBSAN := > > +# -fsanitize=* options makes GCC less smart than usual and > > +# increases the number of 'maybe-uninitialized' false-positives. > > +ubsan-cflags-$(CONFIG_UBSAN) += $(call cc-disable-warning, maybe-uninitialized) > > Is this just to force -Wno-maybe-uninitialized even when W=2? > -Wmaybe-uninitialized is already disabled globally after > commit 78a5255ffb6a ("Stop the ad-hoc games with > -Wno-maybe-initialized"). I feel like it might be worth a comment in > case that changes in the future but maybe that is a bit much. > > > [...] > > - # -fsanitize=* options makes GCC less smart than usual and > > - # increase number of 'maybe-uninitialized false-positives > > - CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized) It's just a direct copying of the existing logic, but into the new "ubsan-cflags-y" style. But yes, AFAICT, that was the intent when it was added in commit a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning for "make W=1""). So for this patch, I kept the logic as it was. -- Kees Cook