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] ping suicide: sys: trap: divide error  pc=0x00003953c
Date: Mon,  9 Mar 2009 20:11:28 +0900	[thread overview]
Message-ID: <0C884056-DAC1-484D-880A-30012762C49C@ar.aichi-u.ac.jp> (raw)
In-Reply-To: <a24a8384-832a-4c08-9840-0197284f673e@b16g2000yqb.googlegroups.com>

Hello,

ip/ping -r -f www.google.com
io% ip/ping -r -f www.google.com
sending 32 64 byte messages 0 ms apart to icmp!www.google.com!1
ping 34691: suicide: sys: trap: divide error pc=0x00003953
0: rtt 9797 µs, avg rtt 9797 µs, ttl = 245
io% ps
...
arisawa       34679    0:00   0:00      128K Pread    tcp17010
arisawa       34691    0:00   0:00      140K Broken   ping
arisawa       34695    0:00   0:00      140K Pread    ping
arisawa       34696    0:00   0:00      192K Pread    ps
io% acid 34691
/proc/34691/text:386 plan 9 executable

/sys/lib/acid/port
/sys/lib/acid/386
acid: lstk()
nrand(n=0x0)+0x18 /sys/src/libc/port/nrand.c:13
	slop=0xa39fb2cf
sender(msglen=0x40,n=0x20,interval=0x0,fd=0x6)+0x151 /sys/src/cmd/ip/ 
ping.c:268
	seq=0xef0c4ef8
	buf=0x0
	icmp=0xdffeed0e
	me=0x0
	mev4=0x501a8c0
	i=0x1
	r=0x22b78
main(argv=0xdfffefa0,argc=0x1)+0x212 /sys/src/cmd/ip/ping.c:571
	interval=0x0
	msglen=0x40
	nmsg=0x20
	_argc=0x66
	_args=0xdfffefb8
	ds=0x11534
	fd=0x6
_main+0x31 /sys/src/libc/386/main9.s:16
acid: \x04
echo kill > /proc/34691/ctl
io% cat /sys/src/libc/port/nrand.c
#include	<u.h>
#include	<libc.h>

#define	MASK	0x7fffffffL

int
nrand(int n)
{
	long slop, v;

	if(n < 0)
		return n;
	slop = MASK % n;
	do
		v = lrand();
	while(v <= slop);
	return v % n;
}


Think that where and why nrand(0) is executed and fix the problem.

Kenji Arisawa


On 2009/03/09, at 18:38, ROuNIN wrote:

> Hello all,
> I would like to learn how to fix this in the ping C code, I am new to
> plan9 and C
>
> ip/ping -r -f www.google.com
> sending 32 64 bytes messages 0 ms apart  to icmp!www.google.com!1
> ping 238: suicide: sys: trap: divide error  pc=0x00003953
> term% 0: rrt 38841 us, avg rtt 38841 us, ttl = 128
>
> ROuNIN
>




  reply	other threads:[~2009-03-09 11:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-09  9:38 ROuNIN
2009-03-09 11:11 ` Kenji Arisawa [this message]
2009-03-09 13:24   ` erik quanstrom

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=0C884056-DAC1-484D-880A-30012762C49C@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).