Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=19c5d45a09312ca20cd1f9df3fd1a87fe0cb8aac
Commit:     19c5d45a09312ca20cd1f9df3fd1a87fe0cb8aac
Parent:     72c1bbf308c75a136803d2d76d0e18258be14c7a
Author:     Alexey Dobriyan <[EMAIL PROTECTED]>
AuthorDate: Tue May 8 00:26:46 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue May 8 11:15:04 2007 -0700

    /proc/*/oom_score oops re badness
    
    Eternal quest to make
    
        while true; do cat /proc/fs/xfs/stat >/dev/null 2>/dev/null; done
        while true; do find /proc -type f 2>/dev/null | xargs cat >/dev/null 
2>/dev/null; done
        while true; do modprobe xfs; rmmod xfs; done
    
    work reliably continues and now kernel oopses in the following way:
    
    BUG: unable to handle ... at virtual address 6b6b6b6b
    EIP is at badness
    process: cat
        proc_oom_score
        proc_info_read
        sys_fstat64
        vfs_read
        proc_info_read
        sys_read
    
    Failing code is prefetch hidden in list_for_each_entry() in badness().
    badness() is reachable from two points. One is proc_oom_score, another
    is out_of_memory() => select_bad_process() => badness().
    
    Second path grabs tasklist_lock, while first doesn't.
    
    Signed-off-by: Alexey Dobriyan <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/proc/base.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 0697fd0..ab1b439 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -314,7 +314,9 @@ static int proc_oom_score(struct task_struct *task, char 
*buffer)
        struct timespec uptime;
 
        do_posix_clock_monotonic_gettime(&uptime);
+       read_lock(&tasklist_lock);
        points = badness(task, uptime.tv_sec);
+       read_unlock(&tasklist_lock);
        return sprintf(buffer, "%lu\n", points);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to