[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202405060831.089E820@keescook>
Date: Mon, 6 May 2024 08:51:13 -0700
From: Kees Cook <keescook@...omium.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Youling Tang <tangyouling@...ngson.cn>,
Jinyang He <hejinyang@...ngson.cn>,
Huacai Chen <chenhuacai@...nel.org>,
Tiezhu Yang <yangtiezhu@...ngson.cn>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] objtool: Provide origin hint for
elf_init_reloc_text_sym() errors
On Sat, May 04, 2024 at 03:24:02PM -0700, Josh Poimboeuf wrote:
> On Tue, Apr 30, 2024 at 04:51:07PM -0700, Kees Cook wrote:
> > @@ -891,8 +892,8 @@ struct reloc *elf_init_reloc_text_sym(struct elf *elf, struct section *sec,
> > int addend = insn_off;
> >
> > if (!(insn_sec->sh.sh_flags & SHF_EXECINSTR)) {
> > - WARN("bad call to %s() for data symbol %s",
> > - __func__, sym->name);
> > + WARN("bad call to %s() for %s symbol %s",
> > + __func__, origin, sym->name);
> > return NULL;
>
> Thanks for the patch.
>
> That warning was already phrased pretty awkwardly which was probably
> part of the confusion. It could be rephrased to make it a little
> clearer:
>
> Something like:
>
> .cfi_sites: unexpected reference to non-executable symbol 'execute_location'
>
> And ".cfi_sites" is already in 'sec->name', so you wouldn't need to add
> the new 'origin' arg.
What's so odd is that "execute_location" wasn't being reported at all.
Just ".rodata":
vmlinux.o: warning: objtool: bad call to elf_init_reloc_text_sym() for data symbol .rodata
But yes, sec->name has what I want, so I can do this easily:
- WARN("bad call to %s() for data symbol %s",
- __func__, sym->name);
+ WARN("bad call to %s() for %s symbol %s",
+ __func__, sec->name, sym->name);
vmlinux.o: warning: objtool: bad call to elf_init_reloc_text_sym() for .cfi_sites symbol .rodata
I think the symbol is missing because this is coming from
create_cfi_sections()/elf_create_section_pair().
Regardless, I'll send a v2...
Thanks!
--
Kees Cook
Powered by blists - more mailing lists