Thread (38 messages) 38 messages, 7 authors, 2020-08-21

Re: [PATCH v4 08/17] arm64/mm: Remove needless section quotes

From: Arvind Sankar <hidden>
Date: 2020-06-29 20:55:03
Also in: linux-arch, linux-efi, lkml

On Mon, Jun 29, 2020 at 01:04:31PM -0700, Kees Cook wrote:
On Mon, Jun 29, 2020 at 12:53:47PM -0700, Nick Desaulniers wrote:
quoted
On Sun, Jun 28, 2020 at 11:18 PM Kees Cook [off-list ref] wrote:
quoted
Fix a case of needless quotes in __section(), which Clang doesn't like.

Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Kees Cook <redacted>
Yep, I remember bugs from this.  Probably should scan the kernel for
other instances of this.  +Joe for checkpatch.pl validation.
I think the others are safe because they're in macros:
Why does that make it safe -- the commit msg is a bit sparse, but I
assume the problem is that it generates
	__attribute__((__section__("\".foo\"")))
from
	__section(".foo")
after preprocessing, and clang keeps the quotes in the section name when
generating assembly, while gcc appears to strip them off.

It does that even if nested in another macro, no?
$ git grep -4 '__section("'
include/linux/compiler.h-# define KENTRY(sym)                                           \
Am I missing something, or is KENTRY unused in the tree?
include/linux/compiler.h-       extern typeof(sym) sym;                                 \
include/linux/compiler.h-       static const unsigned long __kentry_##sym               \
include/linux/compiler.h-       __used                                                  \
include/linux/compiler.h:       __section("___kentry" "+" #sym )                        \
include/linux/compiler.h-       = (unsigned long)&sym;
--
include/linux/export.h-#define __ksym_marker(sym)       \
include/linux/export.h: static int __ksym_marker_##sym[0] __section(".discard.ksym") __used
--
include/linux/srcutree.h-# define __DEFINE_SRCU(name, is_static)                                \
include/linux/srcutree.h-       is_static struct srcu_struct name;                              \
include/linux/srcutree.h-       struct srcu_struct * const __srcu_struct_##name                 \
include/linux/srcutree.h:               __section("___srcu_struct_ptrs") = &name

quoted
Reviewed-by: Nick Desaulniers <redacted>
Thanks!

-- 
Kees Cook
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help