From patchwork Wed Aug 28 22:55:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172492 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1395775ily; Wed, 28 Aug 2019 15:56:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRzg25AiigVRLVVnBapNFYrqOqTFUgmLfu2laCO2PgZt8m9kdZgrLWLzdA0WB+jSHC5U1X X-Received: by 2002:a63:f926:: with SMTP id h38mr5556999pgi.80.1567032971339; Wed, 28 Aug 2019 15:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032971; cv=none; d=google.com; s=arc-20160816; b=xJP8opajufmBiBhDhusqB2t4LbqFZcT9ky0oOP7g1wLFQjYVlsKbPTDInrtBx9Abi+ PTx55DQLXXr0tFUiq14qOUsnB6+vuh/5CEC1c92EoKgOqMpS/diUcd1o/kryB5xQCPBe B/hzULH5+aIUJrkMv9HasiWVbCBCfeeW4p/kTtan0xRMxRWfX60H9LouEvJ20lSOO8rB NmIixShiQMD06CQ5npJnnufwKrtlRoWXOLQn6hTjlgD2XrlMqJ+vu/ChtrAiwA0Av6lt rwedwyvw0ICwgyrSGAiYaSCEtAK+fX9dT4IgfkxK0OFD9fej6nJlwCqPsx0EpzpBbQQ7 ewhw== 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=ni9Z15V4bpyiJCDFN/QunD1NK4akeOXTvBvWzMWvbaw=; b=dyk4VagzE6LaTj/M80i9XKCNKp31p9r88FZKMwMPIUbmAQ4BdJyu9Z9BjsRh8f+pqI 9AByodf637iUJNTPpTfXtdir7hQDWGjUaEmP4Y7wFX/nLQs7WgH4wLuf3KsSyyAkRWd0 4TOnTaL1gInR3B+Y75L0q8aAx2HqhJM7omUE0enMjqLygaHUvEvdzb//CqxwsI6+lows E0ulru41VP1HZ/f3yFxzNzMBnVinwCTsmREJmMhhn7UAVSjcZCpEo8NntDw5HTc7KABL 0h0JV1hFE+8qyNfDjrHnVNivzxm9WzLxKHWZYFUdtk3r61jWRG7+HsokG7sxsIHRt1uZ alow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="j/b3RioC"; 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 g13si363254pgk.369.2019.08.28.15.56.11; Wed, 28 Aug 2019 15:56:11 -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="j/b3RioC"; 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 S1727222AbfH1W4J (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:09 -0400 Received: from mail-vs1-f73.google.com ([209.85.217.73]:51187 "EHLO mail-vs1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726896AbfH1W4E (ORCPT ); Wed, 28 Aug 2019 18:56:04 -0400 Received: by mail-vs1-f73.google.com with SMTP id w12so69822vsl.17 for ; Wed, 28 Aug 2019 15:56:03 -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=ni9Z15V4bpyiJCDFN/QunD1NK4akeOXTvBvWzMWvbaw=; b=j/b3RioCgNl03gmcLdV5uQhb7+drpE5z7RZ5TEe94ITp7f0ZSQ4JkcmQ/bl4t2ehVf 1wi3GM2h9kFt7L68RWO88p6Q5PtIhnV3HCEfc3LPPZHsosgTEj5jdefFk+Qyf2J5e6wX oli9igakxc1XLUbPINMnqOOTRlDdZfdgIga5IOpmMjEEm6q9/nPA7ACW3VbO1fsKndci PpdZSC+1lJBhNMFvjfTeVijKwOGvauVZdHsjMOSHBhqDSGRMjwNgeh7cM/Khj1UQsXdy n1yXgLmzOozfiRk67eV8hA7vlZpElNeuEoVLxQFdHmJlWeASzaL63zyNETJ5IBUtnJ5N UqiQ== 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=ni9Z15V4bpyiJCDFN/QunD1NK4akeOXTvBvWzMWvbaw=; b=cnwmnnvGneTWsXCGrbyPntaH9LEiCsmeG5NwjNA553Oq6SL7fUE/oZFnKyMC0eVvQM qk6PwliMVncofAiN862QbOAZ/UJ7kCn/VfpKQfEec6NbE2pzjf91hjcgQxBVXOhU21TY Lj9sfa6+qnyoc4eslsfPHJdFfZm4uU5ml0g4VW+nfy0xgkn8LJg53Fy2NoEiY4GOgA7l 06Px7z9XD1mDxA93IryOrwPFmK0ed9sevswK/2Hl+/WSY8GYLnWAJw87CjAIRLMgGmo0 5VSKYwzdX4ZfqL5FtHWLekpvSYopfLhVmQ4SoGrSpJkGNT8dhvNdS+qCEO3RX/OBmq1c QPYQ== X-Gm-Message-State: APjAAAWJ842UteWphDPOds0/Is0s5/5Dncf7mBTv/IokEMMIv+tp+lhC v64/nR2wYLNxsmV08DzAE4gnfoK1U+QB/v1ix+c= X-Received: by 2002:a1f:880c:: with SMTP id k12mr3650843vkd.71.1567032962908; Wed, 28 Aug 2019 15:56:02 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:23 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-3-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 02/14] include/linux/compiler.h: 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. This fixes an Oops observed in distro's that use systemd and not net.core.bpf_jit_enable=1, when their kernels are compiled with Clang. 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: Will Deacon Reported-by: Sedat Dilek Suggested-by: Josh Poimboeuf Tested-by: Sedat Dilek Signed-off-by: Nick Desaulniers --- include/linux/compiler.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/include/linux/compiler.h b/include/linux/compiler.h index f0fd5636fddb..5e88e7e33abe 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -24,7 +24,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, long ______r; \ static struct ftrace_likely_data \ __aligned(4) \ - __section("_ftrace_annotated_branch") \ + __section(_ftrace_annotated_branch) \ ______f = { \ .data.func = __func__, \ .data.file = __FILE__, \ @@ -60,7 +60,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, #define __trace_if_value(cond) ({ \ static struct ftrace_branch_data \ __aligned(4) \ - __section("_ftrace_branch") \ + __section(_ftrace_branch) \ __if_trace = { \ .func = __func__, \ .file = __FILE__, \ @@ -118,7 +118,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, ".popsection\n\t" /* Annotate a C jump table to allow objtool to follow the code flow */ -#define __annotate_jump_table __section(".rodata..c_jump_table") +#define __annotate_jump_table __section(.rodata..c_jump_table) #else #define annotate_reachable() @@ -298,7 +298,7 @@ unsigned long read_word_at_a_time(const void *addr) * visible to the compiler. */ #define __ADDRESSABLE(sym) \ - static void * __section(".discard.addressable") __used \ + static void * __section(.discard.addressable) __used \ __PASTE(__addressable_##sym, __LINE__) = (void *)&sym; /**