Re: [PATCH v2 03/24] objtool: Handle __sanitize_cov*() tail calls

Steven Rostedt
2021-06-25T13:38:29Z

On Thu, 24 Jun 2021 11:41:02 +0200
Peter Zijlstra <peterz@infradead.org> wrote:

> +static void add_call_dest(struct objtool_file *file, struct instruction *insn,
> + struct symbol *dest, bool sibling)
> +{
> + struct reloc *reloc = insn_reloc(file, insn);
> +
> + insn->call_dest = dest;
> + if (!dest)
> + return;
> +
> + if (insn->call_dest->static_call_tramp) {
> + list_add_tail(&insn->call_node,
> + &file->static_call_list);
> + }
> +
> + if (insn->sec->noinstr &&
> + !strncmp(insn->call_dest->name, "__sanitizer_cov_", 16)) {
> + if (reloc) {
> + reloc->type = R_NONE;
> + elf_write_reloc(file->elf, reloc);
> + }
> +
> + elf_write_insn(file->elf, insn->sec,
> + insn->offset, insn->len,
> + sibling ? arch_ret_insn(insn->len)
> + : arch_nop_insn(insn->len));
> +
> + insn->type = sibling ? INSN_RETURN : INSN_NOP;
> + }
> +
> + if (mcount && !strcmp(insn->call_dest->name, "__fentry__")) {
> + if (sibling)
> + WARN_FUNC("Tail call to __fentry__ !?!?", insn->sec, insn->offset);

Have you ever triggered the above?

-- Steve

> +
> + if (reloc) {
> + reloc->type = R_NONE;
> + elf_write_reloc(file->elf, reloc);
> + }
> +