From: Kees Cook <keescook@chromium.org>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Youling Tang <tangyouling@loongson.cn>,
Jinyang He <hejinyang@loongson.cn>,
Huacai Chen <chenhuacai@kernel.org>,
Tiezhu Yang <yangtiezhu@loongson.cn>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] objtool: Provide origin hint for elf_init_reloc_text_sym() errors
Date: Mon, 6 May 2024 08:51:13 -0700 [thread overview]
Message-ID: <202405060831.089E820@keescook> (raw)
In-Reply-To: <20240504222402.p24zt6dc2zkyxqti@treble>
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
prev parent reply other threads:[~2024-05-06 15:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 23:51 [PATCH] objtool: Provide origin hint for elf_init_reloc_text_sym() errors Kees Cook
2024-05-04 22:24 ` Josh Poimboeuf
2024-05-06 15:51 ` Kees Cook [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202405060831.089E820@keescook \
--to=keescook@chromium.org \
--cc=chenhuacai@kernel.org \
--cc=hejinyang@loongson.cn \
--cc=jpoimboe@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tangyouling@loongson.cn \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.