Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71189fa9 authored by Alexei Starovoitov's avatar Alexei Starovoitov Committed by David S. Miller
Browse files

bpf: free up BPF_JMP | BPF_CALL | BPF_X opcode



free up BPF_JMP | BPF_CALL | BPF_X opcode to be used by actual
indirect call by register and use kernel internal opcode to
mark call instruction into bpf_tail_call() helper.

Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d2e0ef49
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -586,7 +586,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)
		break;
	}
	/* tail call */
	case BPF_JMP | BPF_CALL | BPF_X:
	case BPF_JMP | BPF_TAIL_CALL:
		if (emit_bpf_tail_call(ctx))
			return -EFAULT;
		break;
+1 −1
Original line number Diff line number Diff line
@@ -938,7 +938,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
		/*
		 * Tail call
		 */
		case BPF_JMP | BPF_CALL | BPF_X:
		case BPF_JMP | BPF_TAIL_CALL:
			ctx->seen |= SEEN_TAILCALL;
			bpf_jit_emit_tail_call(image, ctx, addrs[i + 1]);
			break;
+1 −1
Original line number Diff line number Diff line
@@ -991,7 +991,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
		}
		break;
	}
	case BPF_JMP | BPF_CALL | BPF_X:
	case BPF_JMP | BPF_TAIL_CALL:
		/*
		 * Implicit input:
		 *  B1: pointer to ctx
+1 −1
Original line number Diff line number Diff line
@@ -1217,7 +1217,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)
	}

	/* tail call */
	case BPF_JMP | BPF_CALL |BPF_X:
	case BPF_JMP | BPF_TAIL_CALL:
		emit_tail_call(ctx);
		break;

+1 −1
Original line number Diff line number Diff line
@@ -877,7 +877,7 @@ xadd: if (is_imm8(insn->off))
			}
			break;

		case BPF_JMP | BPF_CALL | BPF_X:
		case BPF_JMP | BPF_TAIL_CALL:
			emit_bpf_tail_call(&prog);
			break;

Loading