ANDROID: GKI: Add a hook for sock management.

This hook allows certain applications to clone a socket, after which
the vendor module performs additional operations on the new socket.
When the ANDROID_OEM_DATA of the new socket is a pointer rather than
a specific value, the ANDROID_OEM_DATA of the new socket will point
to the same address as the ANDROID_OEM_DATA of the old socket,
which may lead to a crash when the pointer is subsequently released.

Bug: 356733575
Change-Id: If4d98dd7c82e252eace49567e0385af3797beb29
Signed-off-by: jiangxinpei <huangdezhi@hihonor.com>
(cherry picked from commit 4bf30ef6b71a8f498cedcf70a1df750537eee496)
This commit is contained in:
jiangxinpei
2024-08-01 10:55:12 +08:00
committed by Jingui Zhao
parent e874bfd349
commit 333c956f8d
3 changed files with 4 additions and 0 deletions
+1
View File
@@ -246,6 +246,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sk_alloc);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sk_free);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_genl_check);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_entry);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sk_clone_lock);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_unref_folios_to_pcp_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_fail);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_vmalloc_node_bypass);
+2
View File
@@ -29,6 +29,8 @@ DECLARE_HOOK(android_vh_tcp_write_timeout_estab_retrans,
TP_PROTO(struct sock *sk), TP_ARGS(sk));
DECLARE_HOOK(android_vh_tcp_connect,
TP_PROTO(struct sk_buff *skb), TP_ARGS(skb));
DECLARE_HOOK(android_vh_sk_clone_lock,
TP_PROTO(struct sock *nsk), TP_ARGS(nsk));
struct request_sock;
DECLARE_HOOK(android_vh_inet_csk_clone_lock,
TP_PROTO(struct sock *newsk, const struct request_sock *req), TP_ARGS(newsk, req));
+1
View File
@@ -2388,6 +2388,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
goto out;
sock_copy(newsk, sk);
trace_android_vh_sk_clone_lock(newsk);
newsk->sk_prot_creator = prot;