* Logan Gabriel <[EMAIL PROTECTED]> [010412 11:50] wrote:
> There is a hard to duplicate race condition in freebsd's
> kernel malloc.  Bassically it is possiables for the kernel    
> to tsleep way down in vm_page_sleep_busy even when M_NOWAIT
> is spefcied.  Under some conditions this can block the kernel
> completly.
> 
> Attatched is a kernel module that demonstrates this rare condition,
> The module has been tested on 4.2-RELEASE generic kernel configurations
> as well as -STABLE.  The module only seems to work about one out of every 
> 10 or 15 tries which makes me think there is a race condition happening.
> 

Please try the attached patch:


Index: vm_kern.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_kern.c,v
retrieving revision 1.61.2.1
diff -u -r1.61.2.1 vm_kern.c
--- vm_kern.c   2000/08/04 22:31:11     1.61.2.1
+++ vm_kern.c   2001/04/12 20:19:17
@@ -362,7 +362,7 @@
                                vm_map_lock(map);
                                goto retry;
                        }
-                       vm_map_delete(map, addr, addr + size);
+                       vm_map_delete(map, addr, addr + (i - PAGE_SIZE));
                        vm_map_unlock(map);
                        if (flags & M_ASLEEP) {
                                VM_AWAIT;


if it bombs please try:


Index: vm_kern.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_kern.c,v
retrieving revision 1.61.2.1
diff -u -r1.61.2.1 vm_kern.c
--- vm_kern.c   2000/08/04 22:31:11     1.61.2.1
+++ vm_kern.c   2001/04/12 20:19:59
@@ -362,7 +362,7 @@
                                vm_map_lock(map);
                                goto retry;
                        }
-                       vm_map_delete(map, addr, addr + size);
+                       vm_map_delete(map, addr, addr + i);
                        vm_map_unlock(map);
                        if (flags & M_ASLEEP) {
                                VM_AWAIT;

-- 
-Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]]
Instead of asking why a piece of software is using "1970s technology,"
start asking why software is ignoring 30 years of accumulated wisdom.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to