2011-04-22 22:26:35

by J Freyensee

[permalink] [raw]
Subject: [PATCH] export kernel call get_task_comm().

From: J Freyensee <[email protected]>

This allows drivers who call this function to be compiled modularly.
Otherwise, a driver who is interested in this type of functionality
has to implement their own get_task_comm() call, causing code
duplication in the Linux source tree.

Signed-off-by: J Freyensee <[email protected]>
---
fs/exec.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 8328beb..e1ac338 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1004,6 +1004,7 @@ char *get_task_comm(char *buf, struct task_struct *tsk)
task_unlock(tsk);
return buf;
}
+EXPORT_SYMBOL_GPL(get_task_comm);

void set_task_comm(struct task_struct *tsk, char *buf)
{
--
1.7.2.3


2011-04-22 22:36:11

by David Rientjes

[permalink] [raw]
Subject: Re: [PATCH] export kernel call get_task_comm().

On Fri, 22 Apr 2011, [email protected] wrote:

> From: J Freyensee <[email protected]>
>
> This allows drivers who call this function to be compiled modularly.
> Otherwise, a driver who is interested in this type of functionality
> has to implement their own get_task_comm() call, causing code
> duplication in the Linux source tree.
>
> Signed-off-by: J Freyensee <[email protected]>

Acked-by: David Rientjes <[email protected]>

I still suggest that we implement finer-grained protection for tsk->comm
through get_task_comm(), though, because it's going to be difficult to
know whether task_lock(tsk) is held in all contexts we'll want to call it;
task_lock(tsk) is used to protect many members of task_struct.

2011-04-22 22:44:17

by J Freyensee

[permalink] [raw]
Subject: Re: [PATCH] export kernel call get_task_comm().

On Fri, 2011-04-22 at 15:35 -0700, David Rientjes wrote:
> On Fri, 22 Apr 2011, [email protected] wrote:
>
> > From: J Freyensee <[email protected]>
> >
> > This allows drivers who call this function to be compiled modularly.
> > Otherwise, a driver who is interested in this type of functionality
> > has to implement their own get_task_comm() call, causing code
> > duplication in the Linux source tree.
> >
> > Signed-off-by: J Freyensee <[email protected]>
>
> Acked-by: David Rientjes <[email protected]>
>
> I still suggest that we implement finer-grained protection for tsk->comm
> through get_task_comm(), though, because it's going to be difficult to
> know whether task_lock(tsk) is held in all contexts we'll want to call it;
> task_lock(tsk) is used to protect many members of task_struct.

Okay, but how about accepting this as step 1, then investigate a finer
grained lock structure as step 2?