From: "ron minnich" <rminnich@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: [9fans] bug in ape?
Date: Tue, 18 Dec 2007 12:22:40 -0800 [thread overview]
Message-ID: <13426df10712181222w2b60d0f0y31ca1522a16e4e9e@mail.gmail.com> (raw)
The ssh2 always fails with copious data. I.e. lots of data comes in,
and the proc reading from the socket at some point fails.
I see this go by:
pread(4, 0x06000508, 8192, 4294967295)
return value: 7520
data: 0x06000508, 7520
Note the offset is x508, and we read 7520 bytes, which, if the buffer
is 8k, is an overrun.
The ape code is this:
static void
_copyproc(int fd, Muxbuf *b)
{
unsigned char *e;
int n;
int nzeros;
e = &b->data[PERFDMAX];
for(;;) {
/* make sure there's room */
lock(&mux->lock);
if(e - b->putnext < READMAX) {
if(b->getnext == b->putnext) {
b->getnext = b->putnext = b->data;
unlock(&mux->lock);
} else {
/* sleep until there's room */
b->roomwait = 1;
unlock(&mux->lock);
_RENDEZVOUS((unsigned long)&b->roomwait, 0);
}
} else
unlock(&mux->lock);
/*
* A Zero-length _READ might mean a zero-length write
* happened, or it might mean eof; try several times to
* disambiguate (posix read() discards 0-length messages)
*/
nzeros = 0;
do {
n = _READ(fd, b->putnext, READMAX); <<<<<<<<<============= this line
if(b->fd == -1) {
_exit(0); /* we've been closed */
}
} while(n == 0 && ++nzeros < 3);
lock(&mux->lock);
note the _READ above. It always calls with READMAX. I don't know yet
what putnext can be (in range), but this is a data point. I am posting
this as there may be someone who has seen it before.
ron
next reply other threads:[~2007-12-18 20:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-18 20:22 ron minnich [this message]
2007-12-19 2:51 ` sqweek
2007-12-19 4:36 ` ron minnich
2007-12-19 21:23 ` cinap_lenrek
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=13426df10712181222w2b60d0f0y31ca1522a16e4e9e@mail.gmail.com \
--to=rminnich@gmail.com \
--cc=9fans@cse.psu.edu \
/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).