diff options
author | chunx <chunx@nvidia.com> | 2013-07-05 11:42:05 +0800 |
---|---|---|
committer | Harry Hong <hhong@nvidia.com> | 2013-11-27 17:46:56 -0800 |
commit | 5df1d176b1f205956b5fa3a97aa2e8f79e78532f (patch) | |
tree | 67b373f6a7b132f0ca6a5e40c2f237ed8ba4bb2b /fs | |
parent | eac96cb2d67594da324b89c7ef1e27c88b58ee46 (diff) |
active-standby: add cmdline into /proc/net/
Add cmdline into /proc/net/{tcp,tcp6,udp,udp6} files.
Get process's cmdline from a sock's corresponding inode pointer,
so that cmdline can't be used by Android active-standby app
to find the corresponding package name.
Resolve "BUG: scheduling while atomic" issue when
sk_get_waiting_task is being called.
Bug 1185001
Bug 1342554
Change-Id: Idc8651e4bb85b8a152dfade9689a719f7d72687d
(cherry picked from commit 5dcfe4f561bd8d1767e0938dfd7565b2b7718478)
Change-Id: I1673d56751a8a95b988b325b3857c8a5fe4c78ce
(cherry picked from commit 4516e7c330bb4c5da5020df0d2cc1cb5e9274d9f)
Signed-off-by: Chun Xu <chunx@nvidia.com>
Reviewed-on: http://git-master/r/336174
Reviewed-by: Harry Hong <hhong@nvidia.com>
Tested-by: Harry Hong <hhong@nvidia.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/eventpoll.c | 35 | ||||
-rw-r--r-- | fs/proc/base.c | 4 | ||||
-rw-r--r-- | fs/select.c | 5 |
3 files changed, 41 insertions, 3 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 0863bab42c4d..205b31e10f6b 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -9,6 +9,8 @@ * * Davide Libenzi <davidel@xmailserver.org> * + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * */ #include <linux/init.h> @@ -893,7 +895,7 @@ static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd) * mechanism. It is called by the stored file descriptors when they * have events to report. */ -static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync, void *key) +int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync, void *key) { int pwake = 0; unsigned long flags; @@ -990,6 +992,7 @@ static void ep_ptable_queue_proc(struct file *file, wait_queue_head_t *whead, if (epi->nwait >= 0 && (pwq = kmem_cache_alloc(pwq_cache, GFP_KERNEL))) { init_waitqueue_func_entry(&pwq->wait, ep_poll_callback); + pwq->wait.private = get_thread_process(current); pwq->whead = whead; pwq->base = epi; add_wait_queue(whead, &pwq->wait); @@ -1201,6 +1204,7 @@ static int ep_insert(struct eventpoll *ep, struct epoll_event *event, spin_lock(&tfile->f_lock); list_add_tail(&epi->fllink, &tfile->f_ep_links); spin_unlock(&tfile->f_lock); + tfile->f_path.dentry->d_inode->i_private = get_thread_process(current); /* * Add the current item to the RB tree. All RB tree operations are @@ -1639,6 +1643,35 @@ static void clear_tfile_check_list(void) INIT_LIST_HEAD(&tfile_check_list); } +struct task_struct *get_epoll_file_task(struct file *file) +{ + struct list_head *lh; + struct epitem *epi = NULL; + struct eppoll_entry *pwq = NULL; + struct task_struct *task = NULL; + wait_queue_head_t *whead = NULL; + wait_queue_t *wq = NULL; + + lh = &file->f_ep_links; + if (!list_empty(lh)) { + lh = lh->next; + epi = list_entry(lh, struct epitem, fllink); + lh = &epi->pwqlist; + if (!list_empty(lh)) { + lh = lh->next; + pwq = list_entry(lh, struct eppoll_entry, llink); + lh = &pwq->whead->task_list; + if (!list_empty(lh)) { + lh = lh->next; + wq = list_entry(lh, wait_queue_t, task_list); + task = wq->private; + } + } + } + + return task; +} + /* * Open an eventpoll file descriptor. */ diff --git a/fs/proc/base.c b/fs/proc/base.c index c8cb15dcca08..68375ebe25c3 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -45,6 +45,8 @@ * * Paul Mundt <paul.mundt@nokia.com>: * Overall revision about smaps. + * + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. */ #include <asm/uaccess.h> @@ -209,7 +211,7 @@ struct mm_struct *mm_for_maps(struct task_struct *task) return mm_access(task, PTRACE_MODE_READ); } -static int proc_pid_cmdline(struct task_struct *task, char * buffer) +static int proc_pid_cmdline(struct task_struct *task, char *buffer) { int res = 0; unsigned int len; diff --git a/fs/select.c b/fs/select.c index 0baa0a351a1c..a010736dfe20 100644 --- a/fs/select.c +++ b/fs/select.c @@ -12,6 +12,8 @@ * 24 January 2000 * Changed sys_poll()/do_poll() to use PAGE_SIZE chunk-based allocation * of fds to overcome nfds < 16390 descriptors limit (Tigran Aivazian). + * + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. */ #include <linux/kernel.h> @@ -202,7 +204,7 @@ static int __pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key) return default_wake_function(&dummy_wait, mode, sync, key); } -static int pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key) +int pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key) { struct poll_table_entry *entry; @@ -211,6 +213,7 @@ static int pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key) return 0; return __pollwake(wait, mode, sync, key); } +EXPORT_SYMBOL(pollwake); /* Add a new entry */ static void __pollwait(struct file *filp, wait_queue_head_t *wait_address, |