History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf

Alexei Starovoitov says: ==================== pull-request: bpf 2020-03-12 The following pull-request contains BPF updates for your *net* tree. We've added 12 non-merge commits during the last 8 day(s) which contain a total of 12 files changed, 161 insertions(+), 15 deletions(-). The main changes are: 1) Andrii fixed two bugs in cgroup-bpf. 2) John fixed sockmap. 3) Luke fixed x32 jit. 4) Martin fixed two issues in struct_ops. 5) Yonghong fixed bpf_send_signal. 6) Yoshiki fixed BTF enum. ====================

David S. Miller committed 6 years ago

Commit 242a6df2 parents 0d81a3f 90db6d712 files · +161 −15Browse files

Showing the changes to kernel (5 of 12 files). Show all

Unified · Split

5 files
  1. kernel/bpf/bpf_struct_ops.c +11 −3
  2. kernel/bpf/btf.c +1 −1
  3. kernel/bpf/cgroup.c +5 −2
  4. kernel/bpf/syscall.c +5 −0
  5. kernel/trace/bpf_trace.c +1 −1
kernel/bpf/bpf_struct_ops.c+11−3
@@ -482,13 +482,21 @@ static int bpf_struct_ops_map_delete_elem(struct bpf_map *map, void *key) · 481 unmodified lines
482482 prev_state = cmpxchg(&st_map->kvalue.state,
483483 BPF_STRUCT_OPS_STATE_INUSE,
484484 BPF_STRUCT_OPS_STATE_TOBEFREE);
485− if (prev_state == BPF_STRUCT_OPS_STATE_INUSE) {
485+ switch (prev_state) {
486+ case BPF_STRUCT_OPS_STATE_INUSE:
486487 st_map->st_ops->unreg(&st_map->kvalue.data);
487488 if (refcount_dec_and_test(&st_map->kvalue.refcnt))
488489 bpf_map_put(map);
490+ return 0;
491+ case BPF_STRUCT_OPS_STATE_TOBEFREE:
492+ return -EINPROGRESS;
493+ case BPF_STRUCT_OPS_STATE_INIT:
494+ return -ENOENT;
495+ default:
496+ WARN_ON_ONCE(1);
497+ /* Should never happen. Treat it as not found. */
498+ return -ENOENT;
489499 }
490−
491− return 0;
492500 }
493501
494502 static void bpf_struct_ops_map_seq_show_elem(struct bpf_map *map, void *key,
kernel/bpf/btf.c+1−1
@@ -2418,7 +2418,7 @@ static int btf_enum_check_member(struct btf_verifier_env *env, · 2417 unmodified lines
24182418
24192419 struct_size = struct_type->size;
24202420 bytes_offset = BITS_ROUNDDOWN_BYTES(struct_bits_off);
2421− if (struct_size - bytes_offset < sizeof(int)) {
2421+ if (struct_size - bytes_offset < member_type->size) {
24222422 btf_verifier_log_member(env, struct_type, member,
24232423 "Member exceeds struct_size");
24242424 return -EINVAL;
kernel/bpf/cgroup.c+5−2
@@ -227,6 +227,9 @@ cleanup: · 226 unmodified lines
227227 for (i = 0; i < NR; i++)
228228 bpf_prog_array_free(arrays[i]);
229229
230+ for (p = cgroup_parent(cgrp); p; p = cgroup_parent(p))
231+ cgroup_bpf_put(p);
232+
230233 percpu_ref_exit(&cgrp->bpf.refcnt);
231234
232235 return -ENOMEM;
@@ -302,8 +305,8 @@ int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, · 69 unmodified lines
302305 u32 saved_flags = (flags & (BPF_F_ALLOW_OVERRIDE | BPF_F_ALLOW_MULTI));
303306 struct list_head *progs = &cgrp->bpf.progs[type];
304307 struct bpf_prog *old_prog = NULL;
305− struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE],
306− *old_storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {NULL};
308+ struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {};
309+ struct bpf_cgroup_storage *old_storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {};
307310 struct bpf_prog_list *pl, *replace_pl = NULL;
308311 enum bpf_cgroup_storage_type stype;
309312 int err;
kernel/bpf/syscall.c+5−0
@@ -1510,6 +1510,11 @@ static int map_freeze(const union bpf_attr *attr) · 1509 unmodified lines
15101510 if (IS_ERR(map))
15111511 return PTR_ERR(map);
15121512
1513+ if (map->map_type == BPF_MAP_TYPE_STRUCT_OPS) {
1514+ fdput(f);
1515+ return -ENOTSUPP;
1516+ }
1517+
15131518 mutex_lock(&map->freeze_mutex);
15141519
15151520 if (map->writecnt) {
kernel/trace/bpf_trace.c+1−1
@@ -732,7 +732,7 @@ static int bpf_send_signal_common(u32 sig, enum pid_type type) · 731 unmodified lines
732732 if (unlikely(!nmi_uaccess_okay()))
733733 return -EPERM;
734734
735− if (in_nmi()) {
735+ if (irqs_disabled()) {
736736 /* Do an early check on signal validity. Otherwise,
737737 * the error is lost in deferred irq_work.
738738 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t