Commit d848952
bpf: Support bpf_setsockopt() for BPF_CGROUP_INET_SOCK_CREATE.
We will support flagging SK_MEMCG_EXCLUSIVE via bpf_setsockopt() at
the BPF_CGROUP_INET_SOCK_CREATE hook.
BPF_CGROUP_INET_SOCK_CREATE is invoked by __cgroup_bpf_run_filter_sk()
that passes a pointer to struct sock to the bpf prog as void *ctx.
But there are no bpf_func_proto for bpf_setsockopt() that receives
the ctx as a pointer to struct sock.
Also, bpf_getsockopt() will be necessary for a cgroup with multiple
bpf progs running.
Let's add new bpf_setsockopt() and bpf_getsockopt() variants for
BPF_CGROUP_INET_SOCK_CREATE.
Note that inet_create() is not under lock_sock() and has the same
semantics with bpf_lsm_unlocked_sockopt_hooks.
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>1 parent c5b8e8c commit d848952
1 file changed
+48
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5723 | 5723 | | |
5724 | 5724 | | |
5725 | 5725 | | |
| 5726 | + | |
| 5727 | + | |
| 5728 | + | |
| 5729 | + | |
| 5730 | + | |
| 5731 | + | |
| 5732 | + | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
| 5736 | + | |
| 5737 | + | |
| 5738 | + | |
| 5739 | + | |
| 5740 | + | |
| 5741 | + | |
| 5742 | + | |
| 5743 | + | |
| 5744 | + | |
| 5745 | + | |
| 5746 | + | |
| 5747 | + | |
| 5748 | + | |
| 5749 | + | |
| 5750 | + | |
| 5751 | + | |
| 5752 | + | |
| 5753 | + | |
| 5754 | + | |
| 5755 | + | |
| 5756 | + | |
| 5757 | + | |
| 5758 | + | |
| 5759 | + | |
5726 | 5760 | | |
5727 | 5761 | | |
5728 | 5762 | | |
| |||
8051 | 8085 | | |
8052 | 8086 | | |
8053 | 8087 | | |
| 8088 | + | |
| 8089 | + | |
| 8090 | + | |
| 8091 | + | |
| 8092 | + | |
| 8093 | + | |
| 8094 | + | |
| 8095 | + | |
| 8096 | + | |
| 8097 | + | |
| 8098 | + | |
| 8099 | + | |
| 8100 | + | |
| 8101 | + | |
8054 | 8102 | | |
8055 | 8103 | | |
8056 | 8104 | | |
| |||
0 commit comments