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=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 00BABC433FE for ; Wed, 9 Dec 2020 18:55:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B37782312E for ; Wed, 9 Dec 2020 18:55:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387528AbgLISz0 (ORCPT ); Wed, 9 Dec 2020 13:55:26 -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-Google-Smtp-Source: ABdhPJwwvwTi17NFslAusMjt8S/vlWSt6gsHPux53PRLMtr1AO4Xg672fCr3Z6ZLeeqyK/4dymrCCg== 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