9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Race condition in /sys/src/9/pc/trap.c?
@ 2009-07-30  4:03 Matthew J Jones
  2009-07-30 11:27 ` erik quanstrom
  0 siblings, 1 reply; 21+ messages in thread
From: Matthew J Jones @ 2009-07-30  4:03 UTC (permalink / raw)
  To: 9fans

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



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2009-07-31 21:52 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-30  4:03 [9fans] Race condition in /sys/src/9/pc/trap.c? Matthew J Jones
2009-07-30 11:27 ` erik quanstrom
2009-07-30 14:25   ` Elizabeth Jones
2009-07-30 14:37     ` Sape Mullender
2009-07-30 15:01       ` cinap_lenrek
2009-07-30 15:24         ` cinap_lenrek
2009-07-30 15:17       ` cinap_lenrek
2009-07-30 15:54         ` Charles Forsyth
2009-07-31 13:07           ` Charles Forsyth
2009-07-31 13:28             ` Richard Miller
2009-07-31 17:13             ` cinap_lenrek
2009-07-31 18:00               ` erik quanstrom
2009-07-31 18:08                 ` Devon H. O'Dell
2009-07-31 18:18                   ` erik quanstrom
2009-07-31 18:35                     ` Devon H. O'Dell
2009-07-31 21:52                 ` cinap_lenrek
2009-07-31 19:31               ` Charles Forsyth
2009-07-31 19:40                 ` erik quanstrom
2009-07-31 20:41                   ` Charles Forsyth
2009-07-30 15:20       ` erik quanstrom
2009-07-30 14:39     ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).