diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2020-12-04 07:48:11 -0800 | 
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2020-12-04 07:48:12 -0800 | 
| commit | a1dd1d86973182458da7798a95f26cfcbea599b4 (patch) | |
| tree | 1adda22ea30ccfac7651a7eed7b7c90356f8243a /kernel/bpf/bpf_struct_ops.c | |
| parent | 55fd59b003f6e8fd88cf16590e79823d7ccf3026 (diff) | |
| parent | eceae70bdeaeb6b8ceb662983cf663ff352fbc96 (diff) | |
Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Alexei Starovoitov says:
====================
pull-request: bpf-next 2020-12-03
The main changes are:
1) Support BTF in kernel modules, from Andrii.
2) Introduce preferred busy-polling, from Björn.
3) bpf_ima_inode_hash() and bpf_bprm_opts_set() helpers, from KP Singh.
4) Memcg-based memory accounting for bpf objects, from Roman.
5) Allow bpf_{s,g}etsockopt from cgroup bind{4,6} hooks, from Stanislav.
* https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (118 commits)
  selftests/bpf: Fix invalid use of strncat in test_sockmap
  libbpf: Use memcpy instead of strncpy to please GCC
  selftests/bpf: Add fentry/fexit/fmod_ret selftest for kernel module
  selftests/bpf: Add tp_btf CO-RE reloc test for modules
  libbpf: Support attachment of BPF tracing programs to kernel modules
  libbpf: Factor out low-level BPF program loading helper
  bpf: Allow to specify kernel module BTFs when attaching BPF programs
  bpf: Remove hard-coded btf_vmlinux assumption from BPF verifier
  selftests/bpf: Add CO-RE relocs selftest relying on kernel module BTF
  selftests/bpf: Add support for marking sub-tests as skipped
  selftests/bpf: Add bpf_testmod kernel module for testing
  libbpf: Add kernel module BTF support for CO-RE relocations
  libbpf: Refactor CO-RE relocs to not assume a single BTF object
  libbpf: Add internal helper to load BTF data by FD
  bpf: Keep module's btf_data_size intact after load
  bpf: Fix bpf_put_raw_tracepoint()'s use of __module_address()
  selftests/bpf: Add Userspace tests for TCP_WINDOW_CLAMP
  bpf: Adds support for setting window clamp
  samples/bpf: Fix spelling mistake "recieving" -> "receiving"
  bpf: Fix cold build of test_progs-no_alu32
  ...
====================
Link: https://lore.kernel.org/r/20201204021936.85653-1-alexei.starovoitov@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'kernel/bpf/bpf_struct_ops.c')
| -rw-r--r-- | kernel/bpf/bpf_struct_ops.c | 19 | 
1 files changed, 3 insertions, 16 deletions
diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c index 4c3b543bb33b..1a666a975416 100644 --- a/kernel/bpf/bpf_struct_ops.c +++ b/kernel/bpf/bpf_struct_ops.c @@ -548,12 +548,10 @@ static int bpf_struct_ops_map_alloc_check(union bpf_attr *attr)  static struct bpf_map *bpf_struct_ops_map_alloc(union bpf_attr *attr)  {  	const struct bpf_struct_ops *st_ops; -	size_t map_total_size, st_map_size; +	size_t st_map_size;  	struct bpf_struct_ops_map *st_map;  	const struct btf_type *t, *vt; -	struct bpf_map_memory mem;  	struct bpf_map *map; -	int err;  	if (!bpf_capable())  		return ERR_PTR(-EPERM); @@ -573,20 +571,11 @@ static struct bpf_map *bpf_struct_ops_map_alloc(union bpf_attr *attr)  		 * struct bpf_struct_ops_tcp_congestions_ops  		 */  		(vt->size - sizeof(struct bpf_struct_ops_value)); -	map_total_size = st_map_size + -		/* uvalue */ -		sizeof(vt->size) + -		/* struct bpf_progs **progs */ -		 btf_type_vlen(t) * sizeof(struct bpf_prog *); -	err = bpf_map_charge_init(&mem, map_total_size); -	if (err < 0) -		return ERR_PTR(err);  	st_map = bpf_map_area_alloc(st_map_size, NUMA_NO_NODE); -	if (!st_map) { -		bpf_map_charge_finish(&mem); +	if (!st_map)  		return ERR_PTR(-ENOMEM); -	} +  	st_map->st_ops = st_ops;  	map = &st_map->map; @@ -597,14 +586,12 @@ static struct bpf_map *bpf_struct_ops_map_alloc(union bpf_attr *attr)  	st_map->image = bpf_jit_alloc_exec(PAGE_SIZE);  	if (!st_map->uvalue || !st_map->progs || !st_map->image) {  		bpf_struct_ops_map_free(map); -		bpf_map_charge_finish(&mem);  		return ERR_PTR(-ENOMEM);  	}  	mutex_init(&st_map->lock);  	set_vm_flush_reset_perms(st_map->image);  	bpf_map_init_from_attr(map, attr); -	bpf_map_charge_move(&map->memory, &mem);  	return map;  }  | 
