Re: [PATCH] race condition in procfs

From: Grzegorz Nosek (grzegorz.nosek_at_gmail.com)
Date: 11/29/05

  • Next message: Vivek Goyal: "Re: [Fastboot] Re: [PATCH & RFC] kdump and stack overflows"
    Date:	Tue, 29 Nov 2005 14:25:12 +0100
    To: Andrew Morton <akpm@osdl.org>
    
    

    > >
    > > Do you know what the race is?
    >
    > Apparently it's a race between deleting a process and accessing its
    > /proc/pid entries. It came out in pidof while it was accessing
    > /proc/pid/stat (fs/proc/array.c:do_task_stat crashed on first
    > instruction - it was an inline function accessing task->state,
    > get_task_state IIRC). oops (with vserver history data - I'm using a
    > patch mentioned below) is attached.
    >
    > >
    > > How does one reproduce it?
    >
    > I managed to reproduce it (although not reliably) during high CPU load
    > and I/O (parallel kernel compiles) on SMP systems with the vserver
    > patch (http://linux-vserver.org, the exact patch is
    > http://vserver.13thfloor.at/Experimental/patch-2.6.14.2-vs2.1.0-rc8.diff),
    > but the vserver maintainer pointed out that it probably is a mainline
    > issue. We're not using 2.6 systems too much except for the vserver
    > test beds so I cannot tell if it happens on vanilla kernels.
    >
    > >
    > > > The following micro-patch seems to fix it.
    > >
    > > It might be right, or it might be a workaround..
    > >
    >
    > I'm not a kernel guru so it's just my proposal. Can it break anything?
    > An alternative _might_ be somewhat coarser task_struct locking
    > (do_task_stat grabs a spinlock but then it's already too late).
    > However, if no "right" solution appears, I'll keep using my two-liner
    > because it seems to help, at least in my setup.
    >

    Oh well, I got another oops in the very same place with the patch
    applied. So now I surrounded the check with
    read_[un]lock(&tasklist_lock) and added a check to do_task_stat (both
    now have a printk). If it builds, boots and doesn't crash, I'll post
    the patch.

    Best regards,
     Grzegorz Nosek
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Vivek Goyal: "Re: [Fastboot] Re: [PATCH & RFC] kdump and stack overflows"

    Relevant Pages

    • race in usbnet.c in full RT
      ... seems there is a race in drivers/net/usbnet.c in full RT mode. ... honest I haven't hardly checked this on the latest kernel and latest RT ... patch but just took a look at usbnet.c and latest RT patch and haven't ... interrupts are not disabled and usb_submit_urbtriggers an interrupt ...
      (Linux-Kernel)
    • Re: RT patch acceptance
      ... judge the complexity of a design for that type of system. ... claim that you cannot judge the complexity of a kernel modification. ... Since the patch in question doesn't actually need that information to ... nanokernel's API up to date with additions to Linux's API that RT people ...
      (Linux-Kernel)
    • [RFC] Making percpu module variables have their own memory.
      ... Someone using the -rt patch found that one of the tracing options caused ... 64K for every CPU to cover all the per_cpu variables used in the kernel ... static void wakeup_softirqd_prio ...
      (Linux-Kernel)
    • Re: This is [Re:] How to improve the quality of the kernel[?].
      ... The -mm kernel already implements what your proposed PTS would do. ... If patch have no TS ID, ... Thus i can apply for example lguest patches and implement and test new ... How many open source projects use Bugzilla and how many use the Debian BTS? ...
      (Linux-Kernel)
    • Re: Documentation - how to apply patches for various trees
      ... >> explanation of the various kernel trees and how to apply their patches. ... +a patch to the kernel or, more specifically, what base kernel a patch for ... +and what new version the patch will change the source tree into. ...
      (Linux-Kernel)