From patchwork Wed Aug 28 22:55:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172500 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1396003ily; Wed, 28 Aug 2019 15:56:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3OBC3pl7ODF+I4914H0AOyO0bXvfDMTRDjcYI7hml/+UAx3EDzPPK1GKVCkQRQ6SYaLAx X-Received: by 2002:aa7:938d:: with SMTP id t13mr7297724pfe.180.1567032990577; Wed, 28 Aug 2019 15:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032990; cv=none; d=google.com; s=arc-20160816; b=LHCza8lMIW0JZGjjlKKX9txXD1A5kUOEqAqKwK9FPbaiaNzMCV7hjKdrQxG4jNYvuQ GXkLdTs/2MiS/NHE5XrBTJgC/Cu8vcjqUzm2jERXb5HhjKIqcxaFFhW0ukH6cOAfK/8p 9mkJOXS/ioyVlG/0dW/LjqRzS7pnN/tMPF+WY6iCrOwZVHKGlqwNJeD99jRPTNUTqYP0 PdlrsY7MT0VlxLz99K66n+I7YhnSPTGkyV39XYT6zOy4yxq1XYFirVcj7qst8Oi41Gk4 CXu9O54d4CehOnDrO22qMBF25K0yD9/+UPKlofBeDSzCPaL0SFtsybjnxyEr9YlePj5W +CWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=WH4YcJNGldw8lGialETJ/aKYammbyIUszQaJj27lQ9U=; b=auktp7YUGRcZ+YsaeUZ+/7uAw4k6yGrzVdT9XFsm761Zlp1v6po0NrZPTfmfyKXWNP co4tQ74tOK/qBLV0kxHGTT7SejYZ/p3EbJGe+8lOeFRUOaW5kuwGD8YkZAwteDy05Nf1 KcpGZf53fYohoaSO4Oivxyf9WAKzXlXpad6+WCJ1XG7BAi6ZbQRY3WHZnZ9V/b4usQlx x4dWitfsVRXcWnRDBHQ6xhcWELRVCW0sVbaNTSfzuX1s7S76lG4VvL24eFdl9Z5W1Htn z3N10DSl2wDNXKdNf7Hi+SAn5YmSErLruhYHisgMj+9OvSKnfmXtwefHduswNevAS/vI cb0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=R04ttarl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 29si360394pgk.306.2019.08.28.15.56.30; Wed, 28 Aug 2019 15:56:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=R04ttarl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727519AbfH1W43 (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:29 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:50237 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727483AbfH1W41 (ORCPT ); Wed, 28 Aug 2019 18:56:27 -0400 Received: by mail-pf1-f202.google.com with SMTP id b21so845175pfb.17 for ; Wed, 28 Aug 2019 15:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=WH4YcJNGldw8lGialETJ/aKYammbyIUszQaJj27lQ9U=; b=R04ttarliq3AU5HEMs+PgjVrPHYJ9wCLxu6WOLrSANpSN/Ghx9wW3fAyo7ejGQCptx PADhzXyMrmVT3btp0uzstj7JM7DzYHXL50hQhMHKO/EZ6HJUWCGDl0DCmav6f2SDQeGv LuFj0sCNJeIvOfGQQ99FrUalx6sy5DbVqj1l/1uiZo1rsewBVYp1wsnsR3kRuiJnRfCL AZWVSWZQsS+E7WmswnOjvygHYBkH0RqxQvQzs6XXcdBHeZ7E3W28gCOmXUGTRYrMfO6p nLOvhDo1nQeTbjJ1SBraZQwONtehxUlKs/Z9CXM2s+o9PNi/xcrDRjSXA0DgNciCCqDG z6qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=WH4YcJNGldw8lGialETJ/aKYammbyIUszQaJj27lQ9U=; b=VUiGQAx5Wt6tu663ERSD0PV9VzGqrLEn3Mxlg0PyhkrhB8d6ntaikeG1q+fYdBGPkT pIN2lDgvr9SXwuoNvsmVGJrOnwDmSprdpt1KCByEgOB6r0e9dhq61mFnHhVRbMgzPLZ3 xJHoP3a6vDQImXk3+2sMgcvogsK+jQB2F9IGTIRoaduVWJUPTX03inbmQIo0Lv0BZyBT NmHMpAE2beGX+pta+TyM3wHRbwkX6IKF+wwrgK0U9n9m0RyIMSdLYR6eP1yR5tIxNS1+ 6wnsK9/l5xLs5yn14qlPqnXQp07eDea5zVXUbrtyfybkOJd5lrnDtLeNuw0tQCANTTPE zQlg== X-Gm-Message-State: APjAAAWlDKkxNij3jL3ZiTVEAcoFd8ZdechJcxeJgM0yyFtvqLnXE47Q pwjVqQLSWdOzHsRLkPC8zGppsSi7oHXCNB5rdpQ= X-Received: by 2002:a63:3dcd:: with SMTP id k196mr5589110pga.45.1567032986002; Wed, 28 Aug 2019 15:56:26 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:32 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-12-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190828225535.49592-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v3 11/14] include/asm-generic: prefer __section from compiler_attributes.h From: Nick Desaulniers To: miguel.ojeda.sandonis@gmail.com Cc: sedat.dilek@gmail.com, will@kernel.org, jpoimboe@redhat.com, naveen.n.rao@linux.vnet.ibm.com, davem@davemloft.net, paul.burton@mips.com, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org, Nick Desaulniers Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org GCC unescapes escaped string section names while Clang does not. Because __section uses the `#` stringification operator for the section name, it doesn't need to be escaped. Instead, we should: 1. Prefer __section(.section_name_no_quotes). 2. Only use __attribute__((__section__(".section"))) when creating the section name via C preprocessor (see the definition of __define_initcall in arch/um/include/shared/init.h). This antipattern was found with: $ grep -e __section\(\" -e __section__\(\" -r See the discussions in: Link: https://bugs.llvm.org/show_bug.cgi?id=42950 Link: https://marc.info/?l=linux-netdev&m=156412960619946&w=2 Link: https://github.com/ClangBuiltLinux/linux/issues/619 Acked-by: Naveen N. Rao Reported-by: Sedat Dilek Suggested-by: Josh Poimboeuf Tested-by: Sedat Dilek Signed-off-by: Nick Desaulniers --- include/asm-generic/error-injection.h | 2 +- include/asm-generic/kprobes.h | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/include/asm-generic/error-injection.h b/include/asm-generic/error-injection.h index 95a159a4137f..a593a50b33e3 100644 --- a/include/asm-generic/error-injection.h +++ b/include/asm-generic/error-injection.h @@ -23,7 +23,7 @@ struct error_injection_entry { */ #define ALLOW_ERROR_INJECTION(fname, _etype) \ static struct error_injection_entry __used \ - __attribute__((__section__("_error_injection_whitelist"))) \ + __section(_error_injection_whitelist) \ _eil_addr_##fname = { \ .addr = (unsigned long)fname, \ .etype = EI_ETYPE_##_etype, \ diff --git a/include/asm-generic/kprobes.h b/include/asm-generic/kprobes.h index 4a982089c95c..20d69719270f 100644 --- a/include/asm-generic/kprobes.h +++ b/include/asm-generic/kprobes.h @@ -9,12 +9,11 @@ * by using this macro. */ # define __NOKPROBE_SYMBOL(fname) \ -static unsigned long __used \ - __attribute__((__section__("_kprobe_blacklist"))) \ +static unsigned long __used __section(_kprobe_blacklist) \ _kbl_addr_##fname = (unsigned long)fname; # define NOKPROBE_SYMBOL(fname) __NOKPROBE_SYMBOL(fname) /* Use this to forbid a kprobes attach on very low level functions */ -# define __kprobes __attribute__((__section__(".kprobes.text"))) +# define __kprobes __section(.kprobes.text) # define nokprobe_inline __always_inline #else # define NOKPROBE_SYMBOL(fname)