From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 30 Jul 2009 00:03:04 -0400 From: Matthew J Jones To: 9fans@9fans.net Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: [9fans] Race condition in /sys/src/9/pc/trap.c? Topicbox-Message-UUID: 31bacd86-ead5-11e9-9d60-3106f5b1d025 My familiarity with the kernel source code is superficial to say the least, but it seems to me that this code (from /sys/src/9/pc/trap.c) contains a race condition: 702 if(sp<(USTKTOP-BY2PG) || sp>(USTKTOP-sizeof(Sargs)-BY2WD)) 703 validaddr(sp, sizeof(Sargs)+BY2WD, 0); 704 705 up->s = *((Sargs*)(sp+BY2WD)); We verify that the address is correct; is there any reason another thread in the same address space cannot start running after line 703 completes and unmap that memory, causing us to access unmapped memory at line 705? The system call entry is itself an interrupt gate, but line 689 is spllo(), and we appear to hold no locks at this point. (Please forgive me if my terminology is not in line: as I said, my experience is very limited and I am just beginning to explore the source). -- Elly