mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 02:36:02 +00:00
tools, bpf_asm: Hard error on out of range jumps
Per discussion at [0] this was originally introduced as a warning due to concerns about breaking existing code, but a hard error probably makes more sense, especially given that concerns about breakage were only speculation. [0] https://lore.kernel.org/bpf/c964892195a6b91d20a67691448567ef528ffa6d.camel@linux.ibm.com/T/#t Signed-off-by: Ian Denhardt <ian@zenhack.net> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com> Link: https://lore.kernel.org/bpf/a6b6c7516f5d559049d669968e953b4a8d7adea3.1614201868.git.ian@zenhack.net
This commit is contained in:
parent
cc0f835309
commit
04883a0799
@ -549,9 +549,11 @@ static uint8_t bpf_encode_jt_jf_offset(int off, int i)
|
|||||||
{
|
{
|
||||||
int delta = off - i - 1;
|
int delta = off - i - 1;
|
||||||
|
|
||||||
if (delta < 0 || delta > 255)
|
if (delta < 0 || delta > 255) {
|
||||||
fprintf(stderr, "warning: insn #%d jumps to insn #%d, "
|
fprintf(stderr, "error: insn #%d jumps to insn #%d, "
|
||||||
"which is out of range\n", i, off);
|
"which is out of range\n", i, off);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
return (uint8_t) delta;
|
return (uint8_t) delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user