Messages in this thread | | | Date | Thu, 9 May 2002 12:21:18 +0900 | Subject | [BUG] mm deadlock | From | TeJun Huh <> |
| |
Running the following program on linux 2.4.18 SMP results in lockup of the thread and some part of the system (any attempt to access the thread list results in the lockup of the attempting thread).
The program basically mmaps memory until the mmapped region is very close to the bottom of the stack with some unmapped region inbetween. Then it tries to access region beyond the end of the highest mmaped region. I think it has something to do with stack growth.
---- program follows ----
#include <stdio.h> #include <unistd.h> #include <sys/mman.h>
#define BASE_SIZE (32 << 20) #define MIN_SIZE (512 << 10)
int main(void) { size_t size; unsigned long *p, *lastp; size_t last_size; int i;
lastp = NULL; size = BASE_SIZE; while (size >= MIN_SIZE) { p = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0); if (p == (unsigned long *)-1) size >>= 1; else { lastp = p; last_size = size; } }
p = lastp + last_size / sizeof(unsigned long); for (i = 0; i < last_size / sizeof(unsigned long); i++) p[i] = i;
printf("ok\n"); return 0; } - 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/
| |