9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] bad juju in devproc.c
@ 2011-01-18  3:39 erik quanstrom
  2011-01-18 13:57 ` erik quanstrom
  0 siblings, 1 reply; 2+ messages in thread
From: erik quanstrom @ 2011-01-18  3:39 UTC (permalink / raw)
  To: 9fans

subtitle: hard linking, chan style.

if you do the chan switcheroo,
you must close the orphan, too.

; diffy -c devproc.c
/n/dump/2011/0117/sys/src/9/port/devproc.c:387,392 - devproc.c:387,393
  		tc->offset = 0;
  		qunlock(&p->debug);
  		poperror();
+ 		cclose(c);
  		return tc;

  	case Qproc:
/n/dump/2011/0117/sys/src/9/port/devproc.c:1183,1190 - devproc.c:1184,1193
  		error(Eprocdied);
  	}

- 	if(p->pid != PID(c->qid))
+ 	if(p->pid != PID(c->qid)){
+ 		cclose(tc);
  		error(Eprocdied);
+ 	}

  	unlock(i);
  	poperror();

it's interesting that the naïve expectation is uniformly
that /proc/$pid/text refers to the image cache, not the
original opened channel.

- erik



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

* Re: [9fans] bad juju in devproc.c
  2011-01-18  3:39 [9fans] bad juju in devproc.c erik quanstrom
@ 2011-01-18 13:57 ` erik quanstrom
  0 siblings, 0 replies; 2+ messages in thread
From: erik quanstrom @ 2011-01-18 13:57 UTC (permalink / raw)
  To: 9fans

i forgot to attach the recipie for disaster.

	sleep 1000000 &
	cd /proc/$apid
	while()cat text>/dev/null

that's about 1000x slower than necessary.  you can speed up the crash
by using the following program.

- erik

----
#include <u.h>
#include <libc.h>

void
main(void)
{
	for(;;)
		close(open("text", OREAD));
	exits("");
}



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

end of thread, other threads:[~2011-01-18 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-18  3:39 [9fans] bad juju in devproc.c erik quanstrom
2011-01-18 13:57 ` 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).