From patchwork Tue Aug 27 20:40:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172302 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308716ily; Tue, 27 Aug 2019 13:41:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiuzhZWEwvmDypkKy4x5i0Z7k7DrFangVe8D/Mf/tS0HyUuGXC75HoKd3Ee04qHPl7lImk X-Received: by 2002:a65:638c:: with SMTP id h12mr281907pgv.436.1566938462967; Tue, 27 Aug 2019 13:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938462; cv=none; d=google.com; s=arc-20160816; b=aX7Nyy/UfaQScXxB0r6TEKNMoIDfDZN/70o1f3dkWr55ex1caMm9uSpU4YALfwOeZo WVe4oHAwYFsjBFPXNkfpYn4+fRLR8yZJcDROu2ae65YrZWm+/DA/JIUf6KH9cIizICDt clKHJKw7B6exymK0gR2/ai4fUMtUT+0LVsDQ54BXRKe9NXdRLEvIV+NmjqxgXBLpHxTt LS9QF5+RgR5jKdJwii0CEBLSBP4lg+DUnIKyMnbYvjd47K9N+cATw6p065BxxIumJECl CcIEpV04XBnYQYtZDBPuTPMgdvg9DCBfLCMh5K7VfRztNTiW2tEti66Ne6WjkGPl3Qcg YSOg== 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=/29bjCjTbbl+cLbTxIw0tiWmYrpTAoAKv+ZcK1v+ox8=; b=NgWeiyJhq57rbAp5H/OSvkaSWIuMFPCBicJZE12JWBMMg0bejyjmDOU8NIbK9YAFSo MsHhQXOYtpBi8X01/SlS9AZ6UV7OysoXMkADTYf2DwsXfIdffKNuF0Jquq6UiONomK4P IbdKgnVhlVBk0Kc+ASipO/bD0qESqCaFpwGvv4tTa5yGV9EzVRP+vX99nNwoqSuzo8uV vY2RtHa6zY+5806paqnQWU1hz60EHUARdD/QJPR2Hz2rL5DW0LBOHGm8gZOogpAImAbb C5zSM6YGzLGNo/jwogHLvpTW3Snf3AQx9srFhJsSgpqCS2drFDcBXVSPpsXsdSdNtSEc b64A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=c21KIJW5; 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 136si331058pgg.354.2019.08.27.13.41.02; Tue, 27 Aug 2019 13:41:02 -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=c21KIJW5; 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 S1730824AbfH0UlC (ORCPT + 28 others); Tue, 27 Aug 2019 16:41:02 -0400 Received: from mail-pg1-f201.google.com ([209.85.215.201]:51136 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730760AbfH0Uk7 (ORCPT ); Tue, 27 Aug 2019 16:40:59 -0400 Received: by mail-pg1-f201.google.com with SMTP id q9so214730pgv.17 for ; Tue, 27 Aug 2019 13:40:58 -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=/29bjCjTbbl+cLbTxIw0tiWmYrpTAoAKv+ZcK1v+ox8=; b=c21KIJW5g4MvXBOS7sME+t0QDUpjgdIeAAj4Dp8ElLl69ZEoixqIhZ+fwaw+wn7eL7 D6/4lnvdM+kKaI4kTkpi9vlsbviFugLjZgcvgVrDVeotJA4dDdzTebuHj3Z9l9tEh/JW +lEUV++D/HbJ+fYgyCwuLobZemlmdv7epF1ZSYGCG/pakcXO33SnFgZZHEIIrnm5+/Gs e0FUU/YtFcx1N0xsk2TOXo7UhtkUeLNis39W+2MdQFq1RFeeTbcRLJLSAHd6BNqAsgQN bCrq6X0Te9hQI9XwHv33OlzZc5rZ5dptuS18x9F7Iz7djaOR+NK/I/nY/STfG/lUNVry 6+hQ== 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=/29bjCjTbbl+cLbTxIw0tiWmYrpTAoAKv+ZcK1v+ox8=; b=OfGd/uCxNgJMPULN4Yd9sDx9JZfU6CaGBciDu3Qjcw8S+zNkGNuHuacbx0harMv6hN NmDJMic7Ti9FKUN+zSVZ2jHIrPUX5NQdMLTxJbrkixQGdDr3EjnuJsYmTT9mOp5wg3cF ig0OQBaUM/wKryOZtyaTzbUoqoFweETdhehDh43tZpayrCd6rV6O0HJ39FBk2LaTf868 hu3RFzzWpQMuPXCAqTP0leQM1Zvg2M8yB2wSlAvWAgICl6+GE4qhe/XOs3LSVp14LRCZ OWASzQqnYGFNl6TWYJp8uafqapWD2Ss1n0V6Q3QlzM9tkpWkuNNhck6RxwR4TgS9JAnH V8Ug== X-Gm-Message-State: APjAAAXxj8qMdKnR0nByTNoyjElBmlsSBpWEFH4C0LOawrr2JdzmTSxh KApj3DgwU3FP4LCx+j+Nw+dhwMtIy9s85FVEOIs= X-Received: by 2002:a63:a346:: with SMTP id v6mr281349pgn.57.1566938457832; Tue, 27 Aug 2019 13:40:57 -0700 (PDT) Date: Tue, 27 Aug 2019 13:40:04 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-12-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 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)