Skip to content

Commit d0fd1f5

Browse files
committed
objtool: skip non-text sections when adding return-thunk sites
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2090231 CVE: CVE-2022-23816 CVE: CVE-2022-23825 CVE: CVE-2022-29900 CVE: CVE-2022-29901 Upstream Status: RHEL only The .discard.text section is added in order to reserve BRK, with a temporary function just so it can give it a size. This adds a relocation to the return thunk, which objtool will add to the .return_sites section. Linking will then fail as there are references to the .discard.text section. Do not add instructions from non-text sections to the list of return thunk calls, avoiding the reference to .discard.text. Originally-from: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Waiman Long <longman@redhat.com>
1 parent 343f3e3 commit d0fd1f5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/objtool/check.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,8 @@ static void add_return_call(struct objtool_file *file, struct instruction *insn,
12311231
insn->type = INSN_RETURN;
12321232
insn->retpoline_safe = true;
12331233

1234-
if (add)
1234+
/* Skip the non-text sections, specially .discard ones */
1235+
if (add && insn->sec->text)
12351236
list_add_tail(&insn->call_node, &file->return_thunk_list);
12361237
}
12371238

0 commit comments

Comments
 (0)