pmaports/device/testing/linux-samsung-j7eltetmo/03-Removed-knox.patch

82 lines
2.8 KiB
Diff
Raw Normal View History

Based on ../linux-samsung-a5y17lte/disable_knox.patch
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index c39199a9..fa44c276 100755
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -440,64 +440,6 @@ out_rcu_unlock:
goto out;
}
-/** The function is used to check if the ncm feature is enabled or not; if enabled then collect the socket meta-data information; **/
-static void knox_collect_metadata(struct socket *sock) {
- if(check_ncm_flag()) {
- struct knox_socket_metadata* ksm = kzalloc(sizeof(struct knox_socket_metadata),GFP_KERNEL);
-
- struct sock *sk = sock->sk;
- struct inet_sock *inet = inet_sk(sk);
-
- struct pid *pid_struct;
- struct task_struct *task;
-
- struct pid *parent_pid_struct;
- struct task_struct *parent_task;
-
- struct timespec close_timespec;
-
- if(ksm == NULL) return;
-
- if((sock->ops->family == AF_INET) && (sk->inet_src_masq != 0)) {
- pid_struct = find_get_pid(current->tgid);
- task = pid_task(pid_struct,PIDTYPE_PID);
- if(task != NULL) {
- memcpy(ksm->process_name,task->comm, sizeof(task->comm));
- if(task->parent != NULL) {
- parent_pid_struct = find_get_pid(task->parent->tgid);
- parent_task = pid_task(parent_pid_struct,PIDTYPE_PID);
- if(parent_task != NULL) {
- memcpy(ksm->parent_process_name,parent_task->comm,sizeof(ksm->parent_process_name));
- ksm->knox_puid = parent_task->cred->uid;
- }
- }
- }
-
- ksm->srcport = ntohs(inet->inet_sport);
- ksm->dstport = ntohs(inet->inet_dport);
-
- sprintf(ksm->srcaddr,"%pI4",(void *)&sk->inet_src_masq);
- sprintf(ksm->dstaddr,"%pI4",(void *)&inet->inet_daddr);
-
- ksm->knox_sent = sock->knox_sent;
- ksm->knox_recv = sock->knox_recv;
- ksm->knox_uid = sk->knox_uid;
- ksm->knox_pid = sk->knox_pid;
- ksm->trans_proto = sk->sk_protocol;
-
- memcpy(ksm->domain_name,sk->domain_name,sizeof(ksm->domain_name)-1);
-
- ksm->open_time = sk->open_time;
-
- close_timespec = current_kernel_time();
- ksm->close_time = close_timespec.tv_sec;
-
- insert_data_kfifo_kthread(ksm);
- } else {
- kfree(ksm);
- }
- }
-}
/*
* The peer socket should always be NULL (or else). When we call this
@@ -527,7 +469,6 @@ int inet_release(struct socket *sock)
if (sock_flag(sk, SOCK_LINGER) &&
!(current->flags & PF_EXITING))
timeout = sk->sk_lingertime;
- knox_collect_metadata(sock);
sock->sk = NULL;
sk->sk_prot->close(sk, timeout);
}
--
2.32.0