* Is this racy?
@ 2002-10-07 20:51 Michal Jaegermann
2002-10-07 21:37 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: Michal Jaegermann @ 2002-10-07 20:51 UTC (permalink / raw)
To: linux-kernel
In fs/proc/array.c (2.4.20-pre9, 2.4.19 and likely many other
versions) in function 'proc_pid_stat()' there is a code like that:
......
read_lock(&tasklist_lock);
ppid = task->pid ? task->p_opptr->pid : 0;
read_unlock(&tasklist_lock);
res = sprintf(buffer,"<long format string>",
task->pid,
......
ppid,
......
So assignment to ppid is locked but other reads from fiels of 'task'
structure are not guarded that way. Is this ok or if not we do not
particularly care? Function 'task_state()' in the same file seems
to be more careful about this.
Michal
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Is this racy?
2002-10-07 20:51 Is this racy? Michal Jaegermann
@ 2002-10-07 21:37 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2002-10-07 21:37 UTC (permalink / raw)
To: linux-kernel
On Mon, Oct 07, 2002 at 02:51:52PM -0600, Michal Jaegermann wrote:
> In fs/proc/array.c (2.4.20-pre9, 2.4.19 and likely many other
> versions) in function 'proc_pid_stat()' there is a code like that:
>
> ......
> read_lock(&tasklist_lock);
> ppid = task->pid ? task->p_opptr->pid : 0;
> read_unlock(&tasklist_lock);
> res = sprintf(buffer,"<long format string>",
> task->pid,
> ......
> ppid,
> ......
>
> So assignment to ppid is locked but other reads from fiels of 'task'
> structure are not guarded that way. Is this ok or if not we do not
> particularly care? Function 'task_state()' in the same file seems
> to be more careful about this.
I think the lock is just so that p_opptr->pid doesn't change while
we're looking at it.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-10-07 21:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-07 20:51 Is this racy? Michal Jaegermann
2002-10-07 21:37 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).