Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4234180pxu; Wed, 9 Dec 2020 11:36:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCGABhA3peALAe/QnDAgt/JswsSKSwG7kuziLXqJi+ce1pFAeCYp30J2JQDwRuyHbvqedW X-Received: by 2002:a17:906:a4b:: with SMTP id x11mr3378704ejf.11.1607542616046; Wed, 09 Dec 2020 11:36:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607542616; cv=none; d=google.com; s=arc-20160816; b=JngV7YJriBgc7gzylFAUayDxdhFlbh2qxBgBbw/9QyHo1yU4Ba/hlavFEL4NxbChmf 7ro94NTeTwTfqjA2TyO1L7BRwPaDcR4oU9TH7xrAoZ7HNVNOtrL4lLyi4ic9ulBTB8jr C4eTkrtWnsfqV5g+7VbeZjB0rGkJqcYBul15DJAK7Ls2UBl862w3TJ/Dyl4CKHKckUeG MRV/rVNASv5Z7gpSgYQlhcFWxAuywo4Iu2aR5a5bfw83+i7L2iGQUWIOWG03kFJ073cy ORS+QLlS1QEQTiZC0ewiNBqYwaklXS3/Di2bqBe7lrJL6yP6kPjMvL4m++jAN36N/7DA sWgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+5z+13xz88XeLJl7OiuxcCFkjcYyny+A4YZW2csEjQM=; b=qzA7zgKbKoXUw+UAdAEQzI8jeGiXDAZaU1JkV6OirJami3ya1/25/fU4BdnbRqa8qi yALK3622l0/FYyGhmVdRPJgiMtyQ/1egf93I1lapZ2ZrzYWvczO7xjc99lu817Obm/Ne /PC7jkSAz+nuLQ5tpLrKY2PbmEbKsE9xwOiYaAjPLIH0Y8tGzOqeBK8k5qBhTwO3m560 0azk8n4NQ0fzV8XDWO3fMpEHHaqW2DP+XdL2JUrnMwHOcXfirx20E1hRSlQVwUf5IMg0 sztvlKubWgnsgmmZOjCpvIYsrOoI96+q5VgPf13lY+21NoKACXsyzlaV61QLCOaU+GDe Ev7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MjKkDaOW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs23si1316156ejc.239.2020.12.09.11.36.30; Wed, 09 Dec 2020 11:36:56 -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=@google.com header.s=20161025 header.b=MjKkDaOW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728971AbgLIKHR (ORCPT + 99 others); Wed, 9 Dec 2020 05:07:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728613AbgLIKHR (ORCPT ); Wed, 9 Dec 2020 05:07:17 -0500 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FA37C0613CF for ; Wed, 9 Dec 2020 02:06:35 -0800 (PST) Received: by mail-qk1-x742.google.com with SMTP id d14so15299qkc.13 for ; Wed, 09 Dec 2020 02:06:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+5z+13xz88XeLJl7OiuxcCFkjcYyny+A4YZW2csEjQM=; b=MjKkDaOW537I+/uuMPqInrP1I/DggVkNKmpO+t1e6A8j/iSjwSLUYsN04jYCiFpi6U YYcnAyjE0Ulu+KMvpw2Fm8Kkg6klKqXGDtIObVl2ZI53PIBwF8LZWYRD72DvyqsrSDCJ 3iQ1E4HGE1JKCijwoeCIgyVmS4jF4esV3YCYZydKy0VL20MUuziI0jr3El29UtqXCT9K QSiczrOWplf4gJ9HMR6Wf1nc4tzW++ErrkQhvt1Lacmc3EQBOsGJReS4Ab9yX3ifuNm+ CuFCw3f8gJ1qkOI8pdGVS2VeZZIQ4CeqvO7pAuUXRWwzmwFHsUP/2Y2oe8gKeN1/TlZY FSNw== 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=+5z+13xz88XeLJl7OiuxcCFkjcYyny+A4YZW2csEjQM=; b=LxbBlapgbEa/IR+mnYCMNwi8i3nmRaIhKjkHBhkS3JChIu23PmsKp3yzaGdkd9OlJg DLIwkW9KE/Ev8Bvq8zjLB3IrLz/oILX3VKRONi9rD0NARB1GWLK406djIJk4ZjqA2TT1 pLLy8YCyJYWwwpKo2WzFPX0znMxPL5lZmvc6Krcpo71QQXxEZVQtS5o8BgJmb8NhlceJ brqou5HTx+7lJYCD0AnLOjrf/uO4r1+SZO8e5IN0eNenvr55DOyoUewOY4A4Gp5VBNn+ i0sEsnFaQ/FVZuHG47Ewt0OMjgw9r2foLE4ccz4QzOSCBO8SkHX/1yjH4VIDFNO5PNXu rlpA== X-Gm-Message-State: AOAM531Z8HJCkbAYSfrt3ocXL+EultxDjCbawUJlbRxrn4rbiZxl0UhD /nKJ7ZHZpluKMVF/UdB+AM2ZvM5YWHXZ90+1EMjPjQ== X-Received: by 2002:a37:56c6:: with SMTP id k189mr1948333qkb.501.1607508394588; Wed, 09 Dec 2020 02:06:34 -0800 (PST) MIME-Version: 1.0 References: <20201204210000.660293c6@canb.auug.org.au> <20201204211923.a88aa12dc06b61780282dd1b@linux-foundation.org> In-Reply-To: From: Dmitry Vyukov Date: Wed, 9 Dec 2020 11:06:22 +0100 Message-ID: Subject: Re: linux-next: build warning after merge of the akpm tree To: Marco Elver Cc: Andrew Morton , Stephen Rothwell , Linux Kernel Mailing List , Linux Next Mailing List , Alexander Potapenko , Andrey Konovalov , kasan-dev , Kees Cook Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 7, 2020 at 1:52 PM Marco Elver wrote: > > On Mon, 7 Dec 2020 at 13:38, 'Dmitry Vyukov' via kasan-dev > wrote: > > On Mon, Dec 7, 2020 at 1:08 PM Dmitry Vyukov wrote: > > > > > Hi all, > > > > > > > > > > After merging the akpm tree, today's linux-next build (powerpc > > > > > allyesconfig) produced warnings like this: > > > > > > > > > > kernel/kcov.c:296:14: warning: conflicting types for built-in function '__sanitizer_cov_trace_switch'; expected 'void(long unsigned int, void *)' [-Wbuiltin-declaration-mismatch] > > > > > 296 | void notrace __sanitizer_cov_trace_switch(u64 val, u64 *cases) > > > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > > > Odd. clang wants that signature, according to > > > > https://clang.llvm.org/docs/SanitizerCoverage.html. But gcc seems to > > > > want a different signature. Beats me - best I can do is to cc various > > > > likely culprits ;) > > > > > > > > Which gcc version? Did you recently update gcc? > > > > > > > > > ld: warning: orphan section `.data..Lubsan_data177' from `arch/powerpc/oprofile/op_model_pa6t.o' being placed in section `.data..Lubsan_data177' > > > > > > > > > > (lots of these latter ones) > > > > > > > > > > I don't know what produced these, but it is in the akpm-current or > > > > > akpm trees. > > > > > > I can reproduce this in x86_64 build as well but only if I enable > > > UBSAN as well. There were some recent UBSAN changes by Kees, so maybe > > > that's what affected the warning. > > > Though, the warning itself looks legit and unrelated to UBSAN. In > > > fact, if the compiler expects long and we accept u64, it may be broken > > > on 32-bit arches... > > > > No, I think it works, the argument should be uint64. > > > > I think both gcc and clang signatures are correct and both want > > uint64_t. The question is just how uint64_t is defined :) The old > > printf joke that one can't write portable format specifier for > > uint64_t. > > > > What I know so far: > > clang 11 does not produce this warning even with obviously wrong > > signatures (e.g. short). > > I wasn't able to trigger it with gcc on 32-bits at all. KCOV is not > > supported on i386 and on arm I got no warnings even with obviously > > wrong signatures (e.g. short). > > Using "(unsigned long val, void *cases)" fixes the warning on x86_64. > > > > I am still puzzled why gcc considers this as a builtin because we > > don't enable -fsanitizer-coverage on this file. I am also puzzled how > > UBSAN affects things. > > It might be some check-for-builtins check gone wrong if it enables any > one of the sanitizers. That would be confirmed if it works with > > UBSAN_SANITIZE_kcov.o := n Yes, it "fixes" the warning. Initially I thought it's not a good solution because we want to detect UBSAN bugs in KCOV. But on second thought, if UBSAN detects a bug in KCOV, it may lead to infinite recursion. We already disable all other sanitizers on KCOV for this reason, so it's reasonable to disable UBSAN as well. And as a side effect it "resolves" the warning as well. I mailed: https://lore.kernel.org/lkml/20201209100152.2492072-1-dvyukov@google.com/T/#u Thanks > > We could change the signature to long, but it feels wrong/dangerous > > because the variable should really be 64-bits (long is broken on > > 32-bits). > > Or we could introduce a typedef that is long on 64-bits and 'long > > long' on 32-bits.