Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4211859pxu; Wed, 9 Dec 2020 11:02:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBuD/vULtE26NKbhjjBlBRShHFmJfC9oZbKVPyxm2x0V0MzSFJp+hCBtbo5+6ruJV60yyH X-Received: by 2002:a05:6402:1d3b:: with SMTP id dh27mr3454057edb.238.1607540579291; Wed, 09 Dec 2020 11:02:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607540579; cv=none; d=google.com; s=arc-20160816; b=HdKBiEHyjG54Q7Wtv0l28MJa0MA1Y+hxUC5qd03sG3Y3BqYw8F5wQBsm3vand+ANKC 455wvXlnS/gpAVJs2PqiPqyv+5NUeyLvolBsIYv1OU8GT/pPPx+d0qP/R1FUv5H+5UVW PAj9HoiIMf5iDDswFIFY1QPmj3ZlKeHmam0o2RnsgEHTTnP6ggHW8XV1CJw7Am15FABv mYP1P+ZI/GmS3WuF8AGksWt8fa/SAS6jGR3byXgIrdAVpU6SNSFBlxVqdZDPvP65NAg9 69+07Bgl/tqEYKwYz6Tw00BixxkTPCQTRwVTN2nHgwmnMEXoC1ryzMSrC3sneCt8NMN8 xXAg== 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=6rcG5E2ND0M3zVFvR91c2KDlufplbmx+6aVT4b7pfH4=; b=CHTlWWlzkkY/GcKR3sCKxOmBmDeys9j/FLdIQupPyV6ZAQpmSbNr6K9vZO5moE4lhJ gtjDwYQlz8nIW3MrffTDh4Iz315btN35oQDW0tj8rmvkYT1KaSdPzm5OdpshlTLsNYca 06pIda+LFAQwQxBRekNk9ws7pdETLIEYXVf8ojI7n5LA5oo8Tt2XMtIiM5a/x/LmEWCP dsig2EU88+u8bs+UFcSVdddWgIJhj10X/RJcpe/0xWCawHZG2ms4JVdOSokkKeuFlsF4 MdCBmvJfDIWT7AZYIk05/p5PMKdtBabCH4hsTOKZn9riiZyLFlxOpk3LF16JeIw9bUbW A6ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=amGZUB2Q; 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 b20si1175667ejk.726.2020.12.09.11.02.35; Wed, 09 Dec 2020 11:02:59 -0800 (PST) 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=amGZUB2Q; 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 S2387524AbgLISzZ (ORCPT + 99 others); Wed, 9 Dec 2020 13:55:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387518AbgLISzV (ORCPT ); Wed, 9 Dec 2020 13:55:21 -0500 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 887B9C061793 for ; Wed, 9 Dec 2020 10:54:41 -0800 (PST) Received: by mail-pj1-x1041.google.com with SMTP id m5so1481027pjv.5 for ; Wed, 09 Dec 2020 10:54:41 -0800 (PST) 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=6rcG5E2ND0M3zVFvR91c2KDlufplbmx+6aVT4b7pfH4=; b=amGZUB2QmzFAhQXEDLL5G3+GDkgkdz/1yh0NULCac6CqNYJy00PQGkrBCQjOVzYUYn vBRd7xM6sq69QWZmLjDi27cAlrPIecWYqdxzzxluIN+YVwBBqEdWnl7RpmGaSqc6Vcwl gq4CBqRsDYvJ8E0xmaBh5UG4nnXiIkmDPo7EI= 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=6rcG5E2ND0M3zVFvR91c2KDlufplbmx+6aVT4b7pfH4=; b=FdfurRVXl++SJMFGWcXuoErAt8CKh/O9ZAzkastTNF0F30S1OQcsBxM+1HRbgccli8 bhXsMZU2i4LSX+amWUWirNrEzbF9MEI9J0WADYaHdkiimS27YZhZggkmAJrcUMxiDB55 SHgAqr/XqjjdqB/Ts8aH3Ctq1uWEoixYko/OKcv9xRoGsD0aG75d785E//z5f6jacKVn GWnZOGIchX50+CVITP/vseXlcO8EO9+ar8DL5Y2mYAMgpRIkOhOUr1QumMpuGHX3PkWl gteGGY5gqv/nK1auZjhiqN/hIdgFd42K94zLmQpGOjvmugDDZNu+vh/l4jGxL2LAEBFA grpA== X-Gm-Message-State: AOAM532fDQ9oCVgsfAUf8t8eBXZ2hrAFtoc0xGKctzNNRIYiabiGzjV2 AFtOuQH0y2YFyu1REcxdAHfCuA== X-Received: by 2002:a17:902:ee11:b029:db:c0d6:581a with SMTP id z17-20020a170902ee11b02900dbc0d6581amr3244470plb.54.1607540081165; Wed, 09 Dec 2020 10:54:41 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id v8sm2900365pjk.39.2020.12.09.10.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Dec 2020 10:54:40 -0800 (PST) Date: Wed, 9 Dec 2020 10:54:39 -0800 From: Kees Cook To: Dmitry Vyukov Cc: akpm@linux-foundation.org, andreyknvl@google.com, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Stephen Rothwell , Marco Elver Subject: Re: [PATCH] kcov: don't instrument with UBSAN Message-ID: <202012091054.08D70D4F@keescook> References: <20201209100152.2492072-1-dvyukov@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201209100152.2492072-1-dvyukov@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 09, 2020 at 11:01:52AM +0100, Dmitry Vyukov wrote: > Both KCOV and UBSAN use compiler instrumentation. If UBSAN detects a bug > in KCOV, it may cause infinite recursion via printk and other common > functions. We already don't instrument KCOV with KASAN/KCSAN for this > reason, don't instrument it with UBSAN as well. > > As a side effect this also resolves the following gcc warning: > > conflicting types for built-in function '__sanitizer_cov_trace_switch'; > expected 'void(long unsigned int, void *)' [-Wbuiltin-declaration-mismatch] > > It's only reported when kcov.c is compiled with any of the sanitizers > enabled. Size of the arguments is correct, it's just that gcc uses 'long' > on 64-bit arches and 'long long' on 32-bit arches, while kernel type is > always 'long long'. > > Reported-by: Stephen Rothwell > Suggested-by: Marco Elver > Signed-off-by: Dmitry Vyukov Reviewed-by: Kees Cook Thanks for chasing this down! Andrew, can you add this to the stack of ubsan patches you're carrying, please? -- Kees Cook