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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no 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 02081C2B9F4 for ; Mon, 14 Jun 2021 18:06:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D04D0610A3 for ; Mon, 14 Jun 2021 18:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234949AbhFNSIJ (ORCPT ); Mon, 14 Jun 2021 14:08:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233455AbhFNSIG (ORCPT ); Mon, 14 Jun 2021 14:08:06 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2649CC061574 for ; Mon, 14 Jun 2021 11:05:49 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id z22so21336666ljh.8 for ; Mon, 14 Jun 2021 11:05:49 -0700 (PDT) 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=d5pPoPmj9czkJzeqD7niUpuqvNetFuH2gRB1nv/63Lg=; b=WulI38RKNnZlBBntcxUPt8JAxXnE3uJz5pzHXyWBRCRnTnG0Yu+ABA74Cgy+565IuD 6GKLQY0dbRxxfsP8xoZwSyknoEn29YNQ936sqO8H+6wb6ewjwQqYzQ/GIyrz3lK35gpm qDvYpFBB762tCwzj1T2osyCCoegBTHWpb8d4XdHogBgo1s6Tk8PaMItaSP46RE2G+lhA B0lTjFaUo5/PVXYCJvEXQIzG4HaaTso9UBEFqBnAqqHon/niuMFWoIJL4NTyPfYl/1iX X3srhtdMyPG+K3HCAaHDYJ45kSB4k6E4Kx0RQzQjERQ9aZSVTu5TgUALrI/iudoVkd5U Zl0Q== 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=d5pPoPmj9czkJzeqD7niUpuqvNetFuH2gRB1nv/63Lg=; b=pQ1diJ2KelAqK1Y+qED8boMdPPQdiUGwg59UhHbS0hYkx1KSPZDvS2iUmGXgoxLePN 7qqkT+vXUFbxi3wM5CzoXlg5NQNWddCPm/d0fzHvMotyB8uYJPnf2Os8nRGYIa0yRZnT sn7fjDK8fvVuGdXknJu7ft2zCDHZrbUEQY3PelMFFpL7oI8SRtxCYUE2NatvgSFGBJnS ePGic9ifLZRM9PraDVQ/lHZDkOTyBWAh9/fpUel+IesS8hvwUW+pGV/rLV7wAIR41PMC s+9E1/Uw6/xtpf3ioM31A/oxkQmwP8duLyaKUt9j++YErH4XPvDC6+gxxdysyhtZbJkT 3CHw== X-Gm-Message-State: AOAM531jsOM+NPmH8igWRmRBPVCRZFhwOzqjQ7CMmK/jIDc9YYUgtA9M n+OEpiBP4ha90nWUZykKghCQfxuFiEE0nrJWdlTACw== X-Google-Smtp-Source: ABdhPJxT6fGU9LBJjpuJtMAYqRljcpSX3hAlY6mPBfgyAlt3TlLFHY1dfeHOgj1XAYqFDW2MrEtfmZmk18/o8Zn7hNw= X-Received: by 2002:a2e:9990:: with SMTP id w16mr14391549lji.341.1623693947260; Mon, 14 Jun 2021 11:05:47 -0700 (PDT) MIME-Version: 1.0 References: <20210614162018.GD68749@worktop.programming.kicks-ass.net> In-Reply-To: <20210614162018.GD68749@worktop.programming.kicks-ass.net> From: Nick Desaulniers Date: Mon, 14 Jun 2021 11:05:35 -0700 Message-ID: Subject: Re: [PATCH] gcov,x86: Mark GCOV broken for x86 To: Peter Zijlstra Cc: "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Peter Oberparleiter , LKML , Johannes Berg , Nathan Chancellor , Kees Cook , Marco Elver , Mark Rutland Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 14, 2021 at 9:20 AM Peter Zijlstra wrote: > > On Mon, Jun 14, 2021 at 09:05:04AM -0700, Nick Desaulniers wrote: > > On Mon, Jun 14, 2021 at 3:17 AM Peter Zijlstra wrote: > > > > > > > > > As recently discovered, there is no function attribute to disable the > > > -fprofile-generate instrumentation. As such, GCOV is fundamentally > > > incompatible with architectures that rely on 'noinstr' for correctness. > > > > Is there context for comment, or is this patch meant as a joke? > > Only if you think recursion in exception entry code is funny. > > noinstr *MUST* disable any and all compiler generated instrumentation, > currently it that isn't the case for -fprofile-gnerate, nor > -fprofile-arc. > > Look for all the fun we had with KCOV back then. Luckily KCOV > instrumentation was trivial to patch out using objtool, so that's what > x86 is currently doing. > > Luckily both compilers grew a __no_sanitize_coverage recently and we no > longer have to rely on objtool fixing up the compiler output for much > longer. > > https://lkml.kernel.org/r/20210527194448.3470080-1-elver@google.com > > Now all we need is one more such attribute to kill -fprofile-* stuff. __attribute__((no_instrument_function)) is already wired to not emit calls to mcount()/fentry(). I think extending it to also apply to coverage (-fprofile-arcs) and instrumentation based profiling (-fprofile-generate) is reasonable. -- Thanks, ~Nick Desaulniers