--- zzzz-none-000/linux-4.9.279/include/net/sock.h 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/include/net/sock.h 2023-02-08 11:43:43.000000000 +0000 @@ -420,6 +420,7 @@ u32 sk_max_ack_backlog; __u32 sk_priority; __u32 sk_mark; + kuid_t sk_uid; struct pid *sk_peer_pid; const struct cred *sk_peer_cred; long sk_rcvtimeo; @@ -441,6 +442,9 @@ #ifdef CONFIG_SECURITY void *sk_security; #endif +#ifdef CONFIG_AVM_SK_TC_INDEX + unsigned long sk_tc_index; +#endif struct sock_cgroup_data sk_cgrp_data; struct mem_cgroup *sk_memcg; void (*sk_state_change)(struct sock *sk); @@ -452,8 +456,16 @@ void (*sk_destruct)(struct sock *sk); struct sock_reuseport __rcu *sk_reuseport_cb; struct rcu_head sk_rcu; + uint32_t acceleration_flag; +}; + +enum toe_acceleration_flag_set_act { + SOCKET_ALLOCATE, + SOCKET_RELEASE }; +extern int (*toe_acceleration_flag_set_hook)(struct sock *, struct pid *, enum toe_acceleration_flag_set_act); + #define __sk_user_data(sk) ((*((void __rcu **)&(sk)->sk_user_data))) #define rcu_dereference_sk_user_data(sk) rcu_dereference(__sk_user_data((sk))) @@ -1665,6 +1677,7 @@ sk->sk_wq = parent->wq; parent->sk = sk; sk_set_socket(sk, parent); + sk->sk_uid = SOCK_INODE(parent)->i_uid; security_sock_graft(sk, parent); write_unlock_bh(&sk->sk_callback_lock); } @@ -1672,6 +1685,11 @@ kuid_t sock_i_uid(struct sock *sk); unsigned long sock_i_ino(struct sock *sk); +static inline kuid_t sock_net_uid(const struct net *net, const struct sock *sk) +{ + return sk ? sk->sk_uid : make_kuid(net->user_ns, 0); +} + static inline u32 net_tx_rndhash(void) { u32 v = prandom_u32();