linux/net/core/bpf_sk_storage.c

// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2019 Facebook  */
#include <linux/rculist.h>
#include <linux/list.h>
#include <linux/hash.h>
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/bpf.h>
#include <linux/btf.h>
#include <linux/btf_ids.h>
#include <linux/bpf_local_storage.h>
#include <net/bpf_sk_storage.h>
#include <net/sock.h>
#include <uapi/linux/sock_diag.h>
#include <uapi/linux/btf.h>
#include <linux/rcupdate_trace.h>

DEFINE_BPF_STORAGE_CACHE();

static struct bpf_local_storage_data *
bpf_sk_storage_lookup(struct sock *sk, struct bpf_map *map, bool cacheit_lockit)
{}

static int bpf_sk_storage_del(struct sock *sk, struct bpf_map *map)
{}

/* Called by __sk_destruct() & bpf_sk_storage_clone() */
void bpf_sk_storage_free(struct sock *sk)
{}

static void bpf_sk_storage_map_free(struct bpf_map *map)
{}

static struct bpf_map *bpf_sk_storage_map_alloc(union bpf_attr *attr)
{}

static int notsupp_get_next_key(struct bpf_map *map, void *key,
				void *next_key)
{}

static void *bpf_fd_sk_storage_lookup_elem(struct bpf_map *map, void *key)
{}

static long bpf_fd_sk_storage_update_elem(struct bpf_map *map, void *key,
					  void *value, u64 map_flags)
{}

static long bpf_fd_sk_storage_delete_elem(struct bpf_map *map, void *key)
{}

static struct bpf_local_storage_elem *
bpf_sk_storage_clone_elem(struct sock *newsk,
			  struct bpf_local_storage_map *smap,
			  struct bpf_local_storage_elem *selem)
{}

int bpf_sk_storage_clone(const struct sock *sk, struct sock *newsk)
{}

/* *gfp_flags* is a hidden argument provided by the verifier */
BPF_CALL_5(bpf_sk_storage_get, struct bpf_map *, map, struct sock *, sk,
	   void *, value, u64, flags, gfp_t, gfp_flags)
{}

BPF_CALL_2(bpf_sk_storage_delete, struct bpf_map *, map, struct sock *, sk)
{}

static int bpf_sk_storage_charge(struct bpf_local_storage_map *smap,
				 void *owner, u32 size)
{}

static void bpf_sk_storage_uncharge(struct bpf_local_storage_map *smap,
				    void *owner, u32 size)
{}

static struct bpf_local_storage __rcu **
bpf_sk_storage_ptr(void *owner)
{}

const struct bpf_map_ops sk_storage_map_ops =;

const struct bpf_func_proto bpf_sk_storage_get_proto =;

const struct bpf_func_proto bpf_sk_storage_get_cg_sock_proto =;

const struct bpf_func_proto bpf_sk_storage_delete_proto =;

static bool bpf_sk_storage_tracing_allowed(const struct bpf_prog *prog)
{}

/* *gfp_flags* is a hidden argument provided by the verifier */
BPF_CALL_5(bpf_sk_storage_get_tracing, struct bpf_map *, map, struct sock *, sk,
	   void *, value, u64, flags, gfp_t, gfp_flags)
{}

BPF_CALL_2(bpf_sk_storage_delete_tracing, struct bpf_map *, map,
	   struct sock *, sk)
{}

const struct bpf_func_proto bpf_sk_storage_get_tracing_proto =;

const struct bpf_func_proto bpf_sk_storage_delete_tracing_proto =;

struct bpf_sk_storage_diag {};

/* The reply will be like:
 * INET_DIAG_BPF_SK_STORAGES (nla_nest)
 *	SK_DIAG_BPF_STORAGE (nla_nest)
 *		SK_DIAG_BPF_STORAGE_MAP_ID (nla_put_u32)
 *		SK_DIAG_BPF_STORAGE_MAP_VALUE (nla_reserve_64bit)
 *	SK_DIAG_BPF_STORAGE (nla_nest)
 *		SK_DIAG_BPF_STORAGE_MAP_ID (nla_put_u32)
 *		SK_DIAG_BPF_STORAGE_MAP_VALUE (nla_reserve_64bit)
 *	....
 */
static int nla_value_size(u32 value_size)
{}

void bpf_sk_storage_diag_free(struct bpf_sk_storage_diag *diag)
{}
EXPORT_SYMBOL_GPL();

static bool diag_check_dup(const struct bpf_sk_storage_diag *diag,
			   const struct bpf_map *map)
{}

struct bpf_sk_storage_diag *
bpf_sk_storage_diag_alloc(const struct nlattr *nla_stgs)
{}
EXPORT_SYMBOL_GPL();

static int diag_get(struct bpf_local_storage_data *sdata, struct sk_buff *skb)
{}

static int bpf_sk_storage_diag_put_all(struct sock *sk, struct sk_buff *skb,
				       int stg_array_type,
				       unsigned int *res_diag_size)
{}

int bpf_sk_storage_diag_put(struct bpf_sk_storage_diag *diag,
			    struct sock *sk, struct sk_buff *skb,
			    int stg_array_type,
			    unsigned int *res_diag_size)
{}
EXPORT_SYMBOL_GPL();

struct bpf_iter_seq_sk_storage_map_info {};

static struct bpf_local_storage_elem *
bpf_sk_storage_map_seq_find_next(struct bpf_iter_seq_sk_storage_map_info *info,
				 struct bpf_local_storage_elem *prev_selem)
	__acquires(RCU) __releases(RCU)
{}

static void *bpf_sk_storage_map_seq_start(struct seq_file *seq, loff_t *pos)
{}

static void *bpf_sk_storage_map_seq_next(struct seq_file *seq, void *v,
					 loff_t *pos)
{}

struct bpf_iter__bpf_sk_storage_map {};

DEFINE_BPF_ITER_FUNC(bpf_sk_storage_map, struct bpf_iter_meta *meta,
		     struct bpf_map *map, struct sock *sk,
		     void *value)

static int __bpf_sk_storage_map_seq_show(struct seq_file *seq,
					 struct bpf_local_storage_elem *selem)
{}

static int bpf_sk_storage_map_seq_show(struct seq_file *seq, void *v)
{}

static void bpf_sk_storage_map_seq_stop(struct seq_file *seq, void *v)
	__releases(RCU)
{}

static int bpf_iter_init_sk_storage_map(void *priv_data,
					struct bpf_iter_aux_info *aux)
{}

static void bpf_iter_fini_sk_storage_map(void *priv_data)
{}

static int bpf_iter_attach_map(struct bpf_prog *prog,
			       union bpf_iter_link_info *linfo,
			       struct bpf_iter_aux_info *aux)
{}

static void bpf_iter_detach_map(struct bpf_iter_aux_info *aux)
{}

static const struct seq_operations bpf_sk_storage_map_seq_ops =;

static const struct bpf_iter_seq_info iter_seq_info =;

static struct bpf_iter_reg bpf_sk_storage_map_reg_info =;

static int __init bpf_sk_storage_map_iter_init(void)
{}
late_initcall(bpf_sk_storage_map_iter_init);