[PATCH] fix secondary oops in sighand locking

Martin J. Bligh
2003-02-17T03:44:30Z

>> Ran your patch ... but I get plenty of these now:
>>
>> Unable to handle kernel NULL pointer dereference at virtual address 00000004
>> ...
>
> Ah, I see what happened, I think .... the locking used to be inside
> collect_sigign_sigcatch, and you moved it out into task_sig ... but
> there were two callers of collect_sigign_sigcatch, the other one being
> proc_pid_stat ... which now needs to have appropriate locking added to
> it as well to match the change ... I'll see if I can get something
> together that works for that.

OK, with this small extra patch, we now survive a beating with SDET
without oops or freeze. The patch adds the locking that was removed
from collect_sigign_sigcatch to the second caller (proc_pid_stat),
as well as task_sig.

diff -urpN -X /home/fletch/.diff.exclude linus-sdet/fs/proc/array.c linus-sdet-fix/fs/proc/array.c
--- linus-sdet/fs/proc/array.c Sun Feb 16 18:48:04 2003
+++ linus-sdet-fix/fs/proc/array.c Sun Feb 16 18:51:34 2003
@@ -316,7 +316,12 @@ int proc_pid_stat(struct task_struct *ta

wchan = get_wchan(task);

- collect_sigign_sigcatch(task, &sigign, &sigcatch);
+ sigemptyset(&sigign);
+ sigemptyset(&sigcatch);
+ read_lock(&tasklist_lock);
+ if (task->sighand)
+ collect_sigign_sigcatch(task, &sigign, &sigcatch);
+ read_unlock(&tasklist_lock);

/* scale priority and nice values from timeslices to -20..20 */
/* to make it look like a "normal" Unix priority/nice value */