9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] Kernel crash bug
Date: Sat,  1 Aug 2009 22:13:45 -0400	[thread overview]
Message-ID: <a0f6b6622967044ad528bbd0247ad54a@quanstro.net> (raw)
In-Reply-To: <ccf33bfa3bb16eaa82d860ce725abeb4@quanstro.net>

On Sat Aug  1 21:40:18 EDT 2009, quanstro@quanstro.net wrote:
> diff -c /n/dump/2009/0801/sys/src/9/port/sysproc.c sysproc.c
> /n/dump/2009/0801/sys/src/9/port/sysproc.c:234,247 - sysproc.c:234,248

ready.  shoot.  aim.
sorry.  i sent the wrong patch.

i also should have mentioned that this patch is not as aggressive
about checking for arguments changing underfoot as russ'.  so
we can all anticipate the next program that'll be posted.

i do agree with charles that part of the solution is to ease fault386 to
only panic on addresses that obviously could have never been
valid, like 0, addresses in pci space, etc.

- erik

diffy -c sysproc.c chan.c
diff -c /n/dump/2009/0801/sys/src/9/port/sysproc.c sysproc.c
/n/dump/2009/0801/sys/src/9/port/sysproc.c:223,229 - sysproc.c:223,229
  	int i;
  	Chan *tc;
  	char **argv, **argp;
- 	char *a, *charp, *args, *file;
+ 	char *a, *charp, *args, *file, *file0;
  	char *progarg[sizeof(Exec)/2+1], *elem, progelem[64];
  	ulong ssize, spage, nargs, nbytes, n, bssend;
  	int indir;
/n/dump/2009/0801/sys/src/9/port/sysproc.c:234,247 - sysproc.c:234,248
  	ulong magic, text, entry, data, bss;
  	Tos *tos;

- 	validaddr(arg[0], 1, 0);
- 	file = (char*)arg[0];
+ 	file = nil;
  	indir = 0;
  	elem = nil;
  	if(waserror()){
  		free(elem);
+ 		free(file);
  		nexterror();
  	}
+ 	file = file0 = validnamedup((char*)arg[0], 1);
  	for(;;){
  		tc = namec(file, Aopen, OEXEC, 0);
  		if(waserror()){
/n/dump/2009/0801/sys/src/9/port/sysproc.c:375,380 - sysproc.c:376,382
  		charp += n;
  	}

+ 	free(file0);
  	free(up->text);
  	up->text = elem;
  	elem = nil;	/* so waserror() won't free elem */
diff -c /n/dump/2009/0801/sys/src/9/port/chan.c chan.c
/n/dump/2009/0801/sys/src/9/port/chan.c:1689,1701 - chan.c:1689,1698
  	if((ulong)name < KZERO){
  		validaddr((ulong)name, 1, 0);
  		if(!dup)
- 			print("warning: validname called from %lux with user pointer", pc);
+ 			print("warning: validname called from %#p with user pointer", pc);
  		p = name;
  		t = BY2PG-((ulong)p&(BY2PG-1));
- 		while((ename=vmemchr(p, 0, t)) == nil){
- 			p += t;
- 			t = BY2PG;
- 		}
+ 		ename = vmemchr(name, 0, 1<<16);
  	}else
  		ename = memchr(name, 0, (1<<16));

- erik



      reply	other threads:[~2009-08-02  2:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-01 21:01 Elizabeth Jones
2009-08-01 21:37 ` cinap_lenrek
2009-08-01 22:01   ` Charles Forsyth
2009-08-01 22:08     ` Russ Cox
2009-08-01 22:47       ` Elizabeth Jones
2009-08-01 23:09         ` Russ Cox
2009-08-01 23:15         ` cinap_lenrek
2009-08-02  1:38         ` erik quanstrom
2009-08-02  2:13           ` erik quanstrom [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a0f6b6622967044ad528bbd0247ad54a@quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).