* [PATCH] bpf: reference may_access_skb() from __bpf_prog_run()
@ 2017-04-11 10:10 Johannes Berg
2017-04-11 10:15 ` Daniel Borkmann
2017-04-11 14:55 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Berg @ 2017-04-11 10:10 UTC (permalink / raw)
To: netdev; +Cc: Daniel Borkmann, Alexei Starovoitov, Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
It took me quite some time to figure out how this was linked,
so in order to save the next person the effort of finding it
add a comment in __bpf_prog_run() that indicates what exactly
determines that a program can access the ctx == skb.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
kernel/bpf/core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index f45827e205d3..b4f1cb0c5ac7 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -1162,12 +1162,12 @@ static unsigned int __bpf_prog_run(void *ctx, const struct bpf_insn *insn)
LD_ABS_W: /* BPF_R0 = ntohl(*(u32 *) (skb->data + imm32)) */
off = IMM;
load_word:
- /* BPF_LD + BPD_ABS and BPF_LD + BPF_IND insns are
- * only appearing in the programs where ctx ==
- * skb. All programs keep 'ctx' in regs[BPF_REG_CTX]
- * == BPF_R6, bpf_convert_filter() saves it in BPF_R6,
- * internal BPF verifier will check that BPF_R6 ==
- * ctx.
+ /* BPF_LD + BPD_ABS and BPF_LD + BPF_IND insns are only
+ * appearing in the programs where ctx == skb
+ * (see may_access_skb() in the verifier). All programs
+ * keep 'ctx' in regs[BPF_REG_CTX] == BPF_R6,
+ * bpf_convert_filter() saves it in BPF_R6, internal BPF
+ * verifier will check that BPF_R6 == ctx.
*
* BPF_ABS and BPF_IND are wrappers of function calls,
* so they scratch BPF_R1-BPF_R5 registers, preserve
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bpf: reference may_access_skb() from __bpf_prog_run()
2017-04-11 10:10 [PATCH] bpf: reference may_access_skb() from __bpf_prog_run() Johannes Berg
@ 2017-04-11 10:15 ` Daniel Borkmann
2017-04-11 14:55 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2017-04-11 10:15 UTC (permalink / raw)
To: Johannes Berg, netdev; +Cc: Alexei Starovoitov, Johannes Berg
On 04/11/2017 12:10 PM, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> It took me quite some time to figure out how this was linked,
> so in order to save the next person the effort of finding it
> add a comment in __bpf_prog_run() that indicates what exactly
> determines that a program can access the ctx == skb.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Makes sense, thanks!
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bpf: reference may_access_skb() from __bpf_prog_run()
2017-04-11 10:10 [PATCH] bpf: reference may_access_skb() from __bpf_prog_run() Johannes Berg
2017-04-11 10:15 ` Daniel Borkmann
@ 2017-04-11 14:55 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-04-11 14:55 UTC (permalink / raw)
To: johannes; +Cc: netdev, daniel, alexei.starovoitov, johannes.berg
From: Johannes Berg <johannes@sipsolutions.net>
Date: Tue, 11 Apr 2017 12:10:58 +0200
> From: Johannes Berg <johannes.berg@intel.com>
>
> It took me quite some time to figure out how this was linked,
> so in order to save the next person the effort of finding it
> add a comment in __bpf_prog_run() that indicates what exactly
> determines that a program can access the ctx == skb.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Applied, thanks Johannes.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-11 14:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11 10:10 [PATCH] bpf: reference may_access_skb() from __bpf_prog_run() Johannes Berg
2017-04-11 10:15 ` Daniel Borkmann
2017-04-11 14:55 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.