ANDROID: GKI: net: add vendor hook to get the correct classid for net cls
android_vh_receive_sock -- The sock classid will be modified by current task via SCM_RIGHTS, despite the sock's owning process having been assigned to a specified cgroup, so we restore the classid with the original process's classid. android_vh_task_get_classid -- In cases where packet transmission involves non-serving softirq, execution may occur within the Wi-Fi driver's RX thread context. This requires retrieving the classid from the sock associated with the sk_buff structure rather than deriving it from the task context. _trace_android_vh_task_get_classid() -- trace_android_vh_task_get_classid called in include/net/cls_cgroup.h will result to build error and visibility issue of some struct. So we create wrapper func:_trace_android_vh_task_get_classid for include/net/cls_cgroup.h to call. Bug: 404485061 Change-Id: I519bcece243f271133bcae2b71e66d54446ebde2 Signed-off-by: Chenghao Zhao <zhaochenghao@honor.com>
This commit is contained in:
committed by
Carlos Llamas
parent
38e16e87bf
commit
17b3b0979f
@@ -349,6 +349,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tcp_select_window);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tcp_update_rtt);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sk_alloc);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sk_free);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_receive_sock);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_task_get_classid);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_genl_check);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_thermal_pm_notify_suspend);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_entry);
|
||||
|
||||
@@ -20,6 +20,8 @@ struct cgroup_cls_state {
|
||||
u32 classid;
|
||||
};
|
||||
|
||||
void _trace_android_vh_task_get_classid(const struct sk_buff *skb, u32 *classid);
|
||||
|
||||
struct cgroup_cls_state *task_cls_state(struct task_struct *p);
|
||||
|
||||
static inline u32 task_cls_classid(struct task_struct *p)
|
||||
@@ -73,6 +75,8 @@ static inline u32 task_get_classid(const struct sk_buff *skb)
|
||||
classid = sock_cgroup_classid(&sk->sk_cgrp_data);
|
||||
}
|
||||
|
||||
_trace_android_vh_task_get_classid(skb, &classid);
|
||||
|
||||
return classid;
|
||||
}
|
||||
#else /* !CONFIG_CGROUP_NET_CLASSID */
|
||||
|
||||
@@ -82,6 +82,10 @@ DECLARE_HOOK(android_vh_tcp_rcv_established_fast_path,
|
||||
TP_PROTO(struct sock *sk), TP_ARGS(sk));
|
||||
DECLARE_HOOK(android_vh_tcp_rcv_established_slow_path,
|
||||
TP_PROTO(struct sock *sk), TP_ARGS(sk));
|
||||
DECLARE_HOOK(android_vh_receive_sock,
|
||||
TP_PROTO(struct sock *sk), TP_ARGS(sk));
|
||||
DECLARE_HOOK(android_vh_task_get_classid,
|
||||
TP_PROTO(const struct sk_buff *skb, u32 *classid), TP_ARGS(skb, classid));
|
||||
struct net_device;
|
||||
DECLARE_HOOK(android_vh_dc_send_copy,
|
||||
TP_PROTO(struct sk_buff *skb, struct net_device *dev), TP_ARGS(skb, dev));
|
||||
|
||||
@@ -12,6 +12,13 @@
|
||||
|
||||
#include <net/cls_cgroup.h>
|
||||
#include <net/sock.h>
|
||||
#include <trace/hooks/net.h>
|
||||
|
||||
void _trace_android_vh_task_get_classid(const struct sk_buff *skb, u32 *classid)
|
||||
{
|
||||
trace_android_vh_task_get_classid(skb, classid);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(_trace_android_vh_task_get_classid);
|
||||
|
||||
static inline struct cgroup_cls_state *css_cls_state(struct cgroup_subsys_state *css)
|
||||
{
|
||||
|
||||
@@ -3414,6 +3414,7 @@ void __receive_sock(struct file *file)
|
||||
if (sock) {
|
||||
sock_update_netprioidx(&sock->sk->sk_cgrp_data);
|
||||
sock_update_classid(&sock->sk->sk_cgrp_data);
|
||||
trace_android_vh_receive_sock(sock->sk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user