Skip to content

Commit b2ca74d

Browse files
committed
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core fixes from Ingo Molnar: "A handful of objtool updates, plus a documentation addition for __ab_c_size()" * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool: Fix whitelist documentation typo objtool: Fix function fallthrough detection objtool: Don't use ignore flag for fake jumps overflow.h: Add comment documenting __ab_c_size()
2 parents 8c05f3b + 2decec4 commit b2ca74d

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

‎include/linux/overflow.h‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,15 @@ static inline __must_check size_t array3_size(size_t a, size_t b, size_t c)
284284
return bytes;
285285
}
286286

287-
static inline __must_check size_t __ab_c_size(size_t n, size_t size, size_t c)
287+
/*
288+
* Compute a*b+c, returning SIZE_MAX on overflow. Internal helper for
289+
* struct_size() below.
290+
*/
291+
static inline __must_check size_t __ab_c_size(size_t a, size_t b, size_t c)
288292
{
289293
size_t bytes;
290294

291-
if (check_mul_overflow(n, size, &bytes))
295+
if (check_mul_overflow(a, b, &bytes))
292296
return SIZE_MAX;
293297
if (check_add_overflow(bytes, c, &bytes))
294298
return SIZE_MAX;

‎tools/objtool/Documentation/stack-validation.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ ignore it:
306306

307307
- To skip validation of a file, add
308308

309-
OBJECT_FILES_NON_STANDARD_filename.o := n
309+
OBJECT_FILES_NON_STANDARD_filename.o := y
310310

311311
to the Makefile.
312312

‎tools/objtool/check.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <linux/hashtable.h>
2929
#include <linux/kernel.h>
3030

31+
#define FAKE_JUMP_OFFSET -1
32+
3133
struct alternative {
3234
struct list_head list;
3335
struct instruction *insn;
@@ -568,7 +570,7 @@ static int add_jump_destinations(struct objtool_file *file)
568570
insn->type != INSN_JUMP_UNCONDITIONAL)
569571
continue;
570572

571-
if (insn->ignore)
573+
if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET)
572574
continue;
573575

574576
rela = find_rela_by_dest_range(insn->sec, insn->offset,
@@ -745,10 +747,10 @@ static int handle_group_alt(struct objtool_file *file,
745747
clear_insn_state(&fake_jump->state);
746748

747749
fake_jump->sec = special_alt->new_sec;
748-
fake_jump->offset = -1;
750+
fake_jump->offset = FAKE_JUMP_OFFSET;
749751
fake_jump->type = INSN_JUMP_UNCONDITIONAL;
750752
fake_jump->jump_dest = list_next_entry(last_orig_insn, list);
751-
fake_jump->ignore = true;
753+
fake_jump->func = orig_insn->func;
752754
}
753755

754756
if (!special_alt->new_len) {
@@ -1957,7 +1959,8 @@ static int validate_branch(struct objtool_file *file, struct instruction *first,
19571959
return 1;
19581960
}
19591961

1960-
func = insn->func ? insn->func->pfunc : NULL;
1962+
if (insn->func)
1963+
func = insn->func->pfunc;
19611964

19621965
if (func && insn->ignore) {
19631966
WARN_FUNC("BUG: why am I validating an ignored function?",

0 commit comments

Comments
 (0)