Thread (37 messages) flat view 37 messages, 2 authors, 5d ago

Re: [PATCH v4 15/22] objtool: Prevent kCFI hashes from being decoded as instructions

From: Song Liu <song@kernel.org>
Date: 2026-08-11 23:58:31
Also in: linux-arm-kernel, lkml

On Sat, Aug 8, 2026 at 4:18 PM Josh Poimboeuf [off-list ref] wrote:
[...]
+/*
+ * ARM64 mapping symbols ($d, $x, $a, __pi_$d, etc) which mark transitions
+ * between code and data.
+ */
+static inline bool is_mapping_sym(struct symbol *sym)
+{
+       return is_notype_sym(sym) && strchr(sym->name, '$');
+}
+
+static inline bool is_data_mapping_sym(struct symbol *sym)
+{
+       const char *dollar;
+
+       if (!is_mapping_sym(sym))
+               return false;
+
+       dollar = strchr(sym->name, '$');
+       return dollar && dollar[1] == 'd';
nit: is_data_mapping_sym() calls strchr() twice. Maybe we can
optimize it by eliminating a strchr()?

Thanks,
Song
quoted hunk ↗ jump to hunk
+}
+
 static inline bool is_global_sym(struct symbol *sym)
 {
        return sym->bind == STB_GLOBAL;
@@ -508,6 +528,9 @@ static inline void set_sym_next_reloc(struct reloc *reloc, struct reloc *next)
 #define sec_for_each_sym(sec, sym)                                     \
        list_for_each_entry(sym, &sec->symbol_list, list)

+#define sec_for_each_sym_from(sec, sym)                                        \
+       list_for_each_entry_from(sym, &sec->symbol_list, list)
+
 #define sec_prev_sym(sym)                                              \
        sym->sec && sym->list.prev != &sym->sec->symbol_list ?          \
        list_prev_entry(sym, list) : NULL
--
2.54.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help