diff options
author | Alexei Starovoitov <ast@plumgrid.com> | 2014-07-30 23:34:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-02 18:02:38 -0400 |
commit | 8fb575ca396bc31d9fa99c26336e2432b41d1bfc (patch) | |
tree | c2d8bc40cd5313e1e7aa710c9f73d7a56edd9b8c | |
parent | 4df95ff488eb796aab9566652c250330179def17 (diff) |
net: filter: rename sk_convert_filter() -> bpf_convert_filter()
to indicate that this function is converting classic BPF into eBPF
and not related to sockets
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/x86/net/bpf_jit_comp.c | 2 | ||||
-rw-r--r-- | include/linux/filter.h | 4 | ||||
-rw-r--r-- | kernel/bpf/core.c | 2 | ||||
-rw-r--r-- | kernel/seccomp.c | 4 | ||||
-rw-r--r-- | net/core/filter.c | 16 |
5 files changed, 14 insertions, 14 deletions
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 71737a83f022..e2ecc1380b3d 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c | |||
@@ -235,7 +235,7 @@ static int do_jit(struct sk_filter *bpf_prog, int *addrs, u8 *image, | |||
235 | /* mov qword ptr [rbp-X],rbx */ | 235 | /* mov qword ptr [rbp-X],rbx */ |
236 | EMIT3_off32(0x48, 0x89, 0x9D, -stacksize); | 236 | EMIT3_off32(0x48, 0x89, 0x9D, -stacksize); |
237 | 237 | ||
238 | /* sk_convert_filter() maps classic BPF register X to R7 and uses R8 | 238 | /* bpf_convert_filter() maps classic BPF register X to R7 and uses R8 |
239 | * as temporary, so all tcpdump filters need to spill/fill R7(r13) and | 239 | * as temporary, so all tcpdump filters need to spill/fill R7(r13) and |
240 | * R8(r14). R9(r15) spill could be made conditional, but there is only | 240 | * R8(r14). R9(r15) spill could be made conditional, but there is only |
241 | * one 'bpf_error' return path out of helper functions inside bpf_jit.S | 241 | * one 'bpf_error' return path out of helper functions inside bpf_jit.S |
diff --git a/include/linux/filter.h b/include/linux/filter.h index c4d0be4c5e75..7cb9b40e9a2f 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
@@ -351,8 +351,8 @@ int sk_filter(struct sock *sk, struct sk_buff *skb); | |||
351 | void sk_filter_select_runtime(struct sk_filter *fp); | 351 | void sk_filter_select_runtime(struct sk_filter *fp); |
352 | void sk_filter_free(struct sk_filter *fp); | 352 | void sk_filter_free(struct sk_filter *fp); |
353 | 353 | ||
354 | int sk_convert_filter(struct sock_filter *prog, int len, | 354 | int bpf_convert_filter(struct sock_filter *prog, int len, |
355 | struct bpf_insn *new_prog, int *new_len); | 355 | struct bpf_insn *new_prog, int *new_len); |
356 | 356 | ||
357 | int sk_unattached_filter_create(struct sk_filter **pfp, | 357 | int sk_unattached_filter_create(struct sk_filter **pfp, |
358 | struct sock_fprog_kern *fprog); | 358 | struct sock_fprog_kern *fprog); |
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index b479807ec383..188ac5ba3900 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c | |||
@@ -446,7 +446,7 @@ load_word: | |||
446 | /* BPF_LD + BPD_ABS and BPF_LD + BPF_IND insns are | 446 | /* BPF_LD + BPD_ABS and BPF_LD + BPF_IND insns are |
447 | * only appearing in the programs where ctx == | 447 | * only appearing in the programs where ctx == |
448 | * skb. All programs keep 'ctx' in regs[BPF_REG_CTX] | 448 | * skb. All programs keep 'ctx' in regs[BPF_REG_CTX] |
449 | * == BPF_R6, sk_convert_filter() saves it in BPF_R6, | 449 | * == BPF_R6, bpf_convert_filter() saves it in BPF_R6, |
450 | * internal BPF verifier will check that BPF_R6 == | 450 | * internal BPF verifier will check that BPF_R6 == |
451 | * ctx. | 451 | * ctx. |
452 | * | 452 | * |
diff --git a/kernel/seccomp.c b/kernel/seccomp.c index f4a77d23f209..33a3a97e2b58 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c | |||
@@ -249,7 +249,7 @@ static long seccomp_attach_filter(struct sock_fprog *fprog) | |||
249 | goto free_prog; | 249 | goto free_prog; |
250 | 250 | ||
251 | /* Convert 'sock_filter' insns to 'bpf_insn' insns */ | 251 | /* Convert 'sock_filter' insns to 'bpf_insn' insns */ |
252 | ret = sk_convert_filter(fp, fprog->len, NULL, &new_len); | 252 | ret = bpf_convert_filter(fp, fprog->len, NULL, &new_len); |
253 | if (ret) | 253 | if (ret) |
254 | goto free_prog; | 254 | goto free_prog; |
255 | 255 | ||
@@ -265,7 +265,7 @@ static long seccomp_attach_filter(struct sock_fprog *fprog) | |||
265 | if (!filter->prog) | 265 | if (!filter->prog) |
266 | goto free_filter; | 266 | goto free_filter; |
267 | 267 | ||
268 | ret = sk_convert_filter(fp, fprog->len, filter->prog->insnsi, &new_len); | 268 | ret = bpf_convert_filter(fp, fprog->len, filter->prog->insnsi, &new_len); |
269 | if (ret) | 269 | if (ret) |
270 | goto free_filter_prog; | 270 | goto free_filter_prog; |
271 | kfree(fp); | 271 | kfree(fp); |
diff --git a/net/core/filter.c b/net/core/filter.c index 5740ea08a3ad..6ac901613bee 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -312,7 +312,7 @@ static bool convert_bpf_extensions(struct sock_filter *fp, | |||
312 | } | 312 | } |
313 | 313 | ||
314 | /** | 314 | /** |
315 | * sk_convert_filter - convert filter program | 315 | * bpf_convert_filter - convert filter program |
316 | * @prog: the user passed filter program | 316 | * @prog: the user passed filter program |
317 | * @len: the length of the user passed filter program | 317 | * @len: the length of the user passed filter program |
318 | * @new_prog: buffer where converted program will be stored | 318 | * @new_prog: buffer where converted program will be stored |
@@ -322,12 +322,12 @@ static bool convert_bpf_extensions(struct sock_filter *fp, | |||
322 | * Conversion workflow: | 322 | * Conversion workflow: |
323 | * | 323 | * |
324 | * 1) First pass for calculating the new program length: | 324 | * 1) First pass for calculating the new program length: |
325 | * sk_convert_filter(old_prog, old_len, NULL, &new_len) | 325 | * bpf_convert_filter(old_prog, old_len, NULL, &new_len) |
326 | * | 326 | * |
327 | * 2) 2nd pass to remap in two passes: 1st pass finds new | 327 | * 2) 2nd pass to remap in two passes: 1st pass finds new |
328 | * jump offsets, 2nd pass remapping: | 328 | * jump offsets, 2nd pass remapping: |
329 | * new_prog = kmalloc(sizeof(struct bpf_insn) * new_len); | 329 | * new_prog = kmalloc(sizeof(struct bpf_insn) * new_len); |
330 | * sk_convert_filter(old_prog, old_len, new_prog, &new_len); | 330 | * bpf_convert_filter(old_prog, old_len, new_prog, &new_len); |
331 | * | 331 | * |
332 | * User BPF's register A is mapped to our BPF register 6, user BPF | 332 | * User BPF's register A is mapped to our BPF register 6, user BPF |
333 | * register X is mapped to BPF register 7; frame pointer is always | 333 | * register X is mapped to BPF register 7; frame pointer is always |
@@ -335,8 +335,8 @@ static bool convert_bpf_extensions(struct sock_filter *fp, | |||
335 | * for socket filters: ctx == 'struct sk_buff *', for seccomp: | 335 | * for socket filters: ctx == 'struct sk_buff *', for seccomp: |
336 | * ctx == 'struct seccomp_data *'. | 336 | * ctx == 'struct seccomp_data *'. |
337 | */ | 337 | */ |
338 | int sk_convert_filter(struct sock_filter *prog, int len, | 338 | int bpf_convert_filter(struct sock_filter *prog, int len, |
339 | struct bpf_insn *new_prog, int *new_len) | 339 | struct bpf_insn *new_prog, int *new_len) |
340 | { | 340 | { |
341 | int new_flen = 0, pass = 0, target, i; | 341 | int new_flen = 0, pass = 0, target, i; |
342 | struct bpf_insn *new_insn; | 342 | struct bpf_insn *new_insn; |
@@ -921,7 +921,7 @@ static struct sk_filter *__sk_migrate_filter(struct sk_filter *fp) | |||
921 | } | 921 | } |
922 | 922 | ||
923 | /* 1st pass: calculate the new program length. */ | 923 | /* 1st pass: calculate the new program length. */ |
924 | err = sk_convert_filter(old_prog, old_len, NULL, &new_len); | 924 | err = bpf_convert_filter(old_prog, old_len, NULL, &new_len); |
925 | if (err) | 925 | if (err) |
926 | goto out_err_free; | 926 | goto out_err_free; |
927 | 927 | ||
@@ -940,9 +940,9 @@ static struct sk_filter *__sk_migrate_filter(struct sk_filter *fp) | |||
940 | fp->len = new_len; | 940 | fp->len = new_len; |
941 | 941 | ||
942 | /* 2nd pass: remap sock_filter insns into bpf_insn insns. */ | 942 | /* 2nd pass: remap sock_filter insns into bpf_insn insns. */ |
943 | err = sk_convert_filter(old_prog, old_len, fp->insnsi, &new_len); | 943 | err = bpf_convert_filter(old_prog, old_len, fp->insnsi, &new_len); |
944 | if (err) | 944 | if (err) |
945 | /* 2nd sk_convert_filter() can fail only if it fails | 945 | /* 2nd bpf_convert_filter() can fail only if it fails |
946 | * to allocate memory, remapping must succeed. Note, | 946 | * to allocate memory, remapping must succeed. Note, |
947 | * that at this time old_fp has already been released | 947 | * that at this time old_fp has already been released |
948 | * by krealloc(). | 948 | * by krealloc(). |