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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7CBCC433FE for ; Fri, 19 Nov 2021 20:32:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0CF1D6B006C; Fri, 19 Nov 2021 15:31:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 07E1B6B0071; Fri, 19 Nov 2021 15:31:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E39BF6B0073; Fri, 19 Nov 2021 15:31:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id D14836B006C for ; Fri, 19 Nov 2021 15:31:53 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 857FB82F7AA5 for ; Fri, 19 Nov 2021 20:31:43 +0000 (UTC) X-FDA: 78826825434.19.476D2DC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 8E6AA5092EEE for ; Fri, 19 Nov 2021 20:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637353902; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=P2sZkZbNWImGK5CgW7dFwBi8zGA25zK0xwbZ1WxQTIw=; b=a5BVsP7ax71OMAd5sXb8IGikIbDCvilB09m5KWI8ntkxRE3zmRnygJRfCm5SDvj0FRoGbi W/jHP0cQsqyMtmHKG76g0yrGeS4Ip7J1+CVXa5IsxEHwKP7FJC0wUIsdwHQU3Y6hAdqBqx jbg8VhMWfHmzOTO+4Phc3qM2nVI2HVU= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-525-pPETmtZdPxOafDw9eXW1oA-1; Fri, 19 Nov 2021 15:31:40 -0500 X-MC-Unique: pPETmtZdPxOafDw9eXW1oA-1 Received: by mail-qt1-f200.google.com with SMTP id 100-20020aed30ed000000b002a6b3dc6465so7796274qtf.13 for ; Fri, 19 Nov 2021 12:31:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=P2sZkZbNWImGK5CgW7dFwBi8zGA25zK0xwbZ1WxQTIw=; b=2EEmTJjypFscT8gCDT9TVb1XfUzeeNsFi38I6YszW6EyZuBl0u0plV/0kRSxTZUvGg wUAfIJ19J8vIb8nLVtL87RcssL0b0+figEgttD0ZUJeITShp4igX8krTbIOLQzMp/gYB N++vWQNM6zF2qd+2/R/vE/UHLOXDR3JawHY2lUA2b0Ai+f3fEB/FJcWH0pwEENO4VKch qLvUcP2bIcLNqcKAVYtVWb2w9vUFiAGExVI4UBdDf8uIs870E2UZ0VCViD3Jka6lEAkn RyxU6cuzuS3F5NBPNVXjcJH2GG64rK8DMw039jYfnsHIUUnBD+AmC2EL+G63n9vLWP+c y7xQ== X-Gm-Message-State: AOAM532eAfX1HkIuEjVllQ8u19JE1/FnyrjSRfLMCUR+uJooPWIbZRAi iZQ5jkDD8vn17EQza2IFdoWoB8rwBR2+uVGCHdvfC3g6avcB3WgTEiaobDF1fvgIcBVQRCNZgOb wNcN2I9oi5Bg= X-Received: by 2002:ac8:7f52:: with SMTP id g18mr9425064qtk.190.1637353900225; Fri, 19 Nov 2021 12:31:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxkAXs81p/9fcPnMbXqzRfyHNHU69K8pzzXpDVQagmkQJ2qJyjzDlmUAcOqpRVDqAvK3rgV/w== X-Received: by 2002:ac8:7f52:: with SMTP id g18mr9425020qtk.190.1637353899973; Fri, 19 Nov 2021 12:31:39 -0800 (PST) Received: from treble ([2600:1700:6e32:6c00::35]) by smtp.gmail.com with ESMTPSA id z13sm374393qkj.1.2021.11.19.12.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 12:31:39 -0800 (PST) Date: Fri, 19 Nov 2021 12:31:35 -0800 From: Josh Poimboeuf To: Marco Elver Cc: "Paul E. McKenney" , Alexander Potapenko , Boqun Feng , Borislav Petkov , Dmitry Vyukov , Ingo Molnar , Mark Rutland , Peter Zijlstra , Thomas Gleixner , Waiman Long , Will Deacon , kasan-dev@googlegroups.com, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org Subject: Re: [PATCH v2 23/23] objtool, kcsan: Remove memory barrier instrumentation from noinstr Message-ID: <20211119203135.clplwzh3hyo5xddg@treble> References: <20211118081027.3175699-1-elver@google.com> <20211118081027.3175699-24-elver@google.com> MIME-Version: 1.0 In-Reply-To: <20211118081027.3175699-24-elver@google.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 8E6AA5092EEE X-Stat-Signature: b5397u7od4aqke4hq4uktnp8rbt51h36 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=a5BVsP7a; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf05.hostedemail.com: domain of jpoimboe@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=jpoimboe@redhat.com X-HE-Tag: 1637353899-592213 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Nov 18, 2021 at 09:10:27AM +0100, Marco Elver wrote: > @@ -1071,12 +1071,7 @@ static void annotate_call_site(struct objtool_file *file, > return; > } > > - /* > - * Many compilers cannot disable KCOV with a function attribute > - * so they need a little help, NOP out any KCOV calls from noinstr > - * text. > - */ > - if (insn->sec->noinstr && sym->kcov) { > + if (insn->sec->noinstr && sym->removable_instr) { > if (reloc) { > reloc->type = R_NONE; > elf_write_reloc(file->elf, reloc); I'd love to have a clearer name than 'removable_instr', though I'm having trouble coming up with something. 'profiling_func'? Profiling isn't really accurate but maybe it gets the point across. I'm definitely open to other suggestions. Also, the above code isn't very self-evident so there still needs to be a comment there, like: /* * Many compilers cannot disable KCOV or sanitizer calls with a * function attribute so they need a little help, NOP out any * such calls from noinstr text. */ > @@ -1991,6 +1986,32 @@ static int read_intra_function_calls(struct objtool_file *file) > return 0; > } > > +static bool is_removable_instr(const char *name) > +{ > + /* > + * Many compilers cannot disable KCOV with a function attribute so they > + * need a little help, NOP out any KCOV calls from noinstr text. > + */ > + if (!strncmp(name, "__sanitizer_cov_", 16)) > + return true; A comment is good here, but the NOP-ing bit seems out of place. -- Josh