Re: [PATCH bpf-next v4 1/5] bpf: Introduce cgroup_{common,current}_func_proto

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 22, 2022 at 12:45:09PM -0700, Stanislav Fomichev wrote:
> diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
> index 59b7eb60d5b4..1c8ac13fe208 100644
> --- a/kernel/bpf/cgroup.c
> +++ b/kernel/bpf/cgroup.c
> @@ -18,6 +18,7 @@
>  #include <linux/bpf_verifier.h>
>  #include <net/sock.h>
>  #include <net/bpf_sk_storage.h>
> +#include <net/cls_cgroup.h>
This include is no longer needed.
bpf_get_cgroup_classid_curr_proto is not moved to here.

> +const struct bpf_func_proto bpf_get_current_cgroup_id_proto __weak;
There is one already in kernel/bpf/core.c.
CGROUP_BPF depends on BPF_SYSCALL also, so this should not be needed.

[ ... ]

> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index 3c1b9bbcf971..dd20e2dc6ea6 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -427,40 +427,7 @@ const struct bpf_func_proto bpf_get_current_ancestor_cgroup_id_proto = {
>  	.ret_type	= RET_INTEGER,
>  	.arg1_type	= ARG_ANYTHING,
>  };
> -
> -#ifdef CONFIG_CGROUP_BPF
> -
> -BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags)
> -{
> -	/* flags argument is not used now,
> -	 * but provides an ability to extend the API.
> -	 * verifier checks that its value is correct.
> -	 */
> -	enum bpf_cgroup_storage_type stype = cgroup_storage_type(map);
> -	struct bpf_cgroup_storage *storage;
> -	struct bpf_cg_run_ctx *ctx;
> -	void *ptr;
> -
> -	/* get current cgroup storage from BPF run context */
> -	ctx = container_of(current->bpf_ctx, struct bpf_cg_run_ctx, run_ctx);
> -	storage = ctx->prog_item->cgroup_storage[stype];
> -
> -	if (stype == BPF_CGROUP_STORAGE_SHARED)
> -		ptr = &READ_ONCE(storage->buf)->data[0];
> -	else
> -		ptr = this_cpu_ptr(storage->percpu_buf);
> -
> -	return (unsigned long)ptr;
> -}
> -
> -const struct bpf_func_proto bpf_get_local_storage_proto = {
> -	.func		= bpf_get_local_storage,
> -	.gpl_only	= false,
> -	.ret_type	= RET_PTR_TO_MAP_VALUE,
> -	.arg1_type	= ARG_CONST_MAP_PTR,
> -	.arg2_type	= ARG_ANYTHING,
> -};
> -#endif
> +#endif /* CONFIG_CGROUPS */
>  
>  #define BPF_STRTOX_BASE_MASK 0x1F
>  
> @@ -589,7 +556,6 @@ const struct bpf_func_proto bpf_strtoul_proto = {
>  	.arg3_type	= ARG_ANYTHING,
>  	.arg4_type	= ARG_PTR_TO_LONG,
>  };
> -#endif
This 'endif' change belongs to patch 3.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux