9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Kenji Arisawa <arisawa@ar.aichi-u.ac.jp>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] validateaddress
Date: Thu, 13 Aug 2009 10:39:44 +0900	[thread overview]
Message-ID: <27EA76E9-D63C-411B-8534-9D7314D0D900@ar.aichi-u.ac.jp> (raw)
In-Reply-To: <dd6fe68a0908120759x71e8dfcet668e2d084f6f4a58@mail.gmail.com>

Hello Russ,

Your prediction is right as shown below.

ar% acid 1236297
/proc/1236297/text:386 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/386
acid: kw
0x00016120
acid: src(klook)
/sys/src/cmd/rc/var.c:47
  42		kenter(SWITCH, "switch");
  43		kenter(FN, "fn");
  44	}
  45
  46	tree*
 >47	klook(char *name)
  48	{
  49		struct kw *p;
  50		tree *t = token(name, WORD);
  51		for(p = kw[hash(name, NKW)];p;p = p->next)
  52			if(strcmp(p->name, name)==0){
acid: mem(kw, "30X")
0x00000000 0x00019870 0x00000000 0x000197f0 0x00019830 0x00000000
0x000197b0 0x00000000 0x00000000 0x00019730 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x00000000 0x000196f0 0x00019770 0x00000000 0x000198b0 0x00000000
0x00000000 0x000196b0 0x00000000 0x00000000 0x00000000 0x00000000
acid: *(kw+25*4)
0x000196b0
acid: mem(*(kw+25*4), "16X")
0x00015274 0x0000e003 0x000196b0 0xfaf0f1fe 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0xef2c00be 0x00000040
0x0a110c09 0x00000040 0x0000be2c 0x00000000
acid: *(**(kw+25*4)\s)
in
acid:

By the way, how you can find
	mem(*(kw+25*4), "16X")  // dumps entry for 'in'
?

Kenji Arisawa


On 2009/08/12, at 23:59, Russ Cox wrote:

> so strcmp is being called a lot but klook isn't.
> that means that klook is looping inside, which
> basically means the p->next pointer is pointing
> at itself.
>
> final script:
>
> kw
> mem(kw, "30X")  // dumps hash table
> *(kw+25*4)
> mem(*(kw+25*4), "16X")  // dumps entry for 'in'
> *(**(kw+25*4)\s)  // should print 'in'
>
> i expect that the value printed for *(kw+25*4)
> in the third line will also be the third value printed
> by the mem on the fourth line, meaning that
> the hash table entry in question has a next
> pointer pointing at itself.  assuming that is true,
> i think we're close to the end of what can be done.
> the hash table list isn't supposed to loop back
> on itself but it is.  that means some kind of dangling
> pointer or other memory corruption error, which
> we're not likely to find retroactively.
>
> russ
>




  reply	other threads:[~2009-08-13  1:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-10  6:11 Kenji Arisawa
2009-08-10 17:13 ` erik quanstrom
2009-08-11  3:57   ` Kenji Arisawa
2009-08-11  4:07     ` erik quanstrom
2009-08-11  5:26       ` Kenji Arisawa
2009-08-11 15:27         ` Russ Cox
2009-08-12  6:48           ` Kenji Arisawa
2009-08-12 14:59             ` Russ Cox
2009-08-13  1:39               ` Kenji Arisawa [this message]
2009-08-13  2:15                 ` Russ Cox

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=27EA76E9-D63C-411B-8534-9D7314D0D900@ar.aichi-u.ac.jp \
    --to=arisawa@ar.aichi-u.ac.jp \
    --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).