From: Jack Steiner <steiner@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] SIGILL errors in strncpu (NAT consumption)
Date: Wed, 03 Apr 2002 21:43:37 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590701905372@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590701905358@msgid-missing>
I isolated the strncpy problem to a simple test program. It fails
with the new glibc-2.2.4-19.3 within a few seconds.
Works fine with older versions of glibc.
David Mosberger took a look at the strncpy code & spotted
the error:
From David:
>> I took a closer look and there seem to be several bugs in the routine:
>>
>> (1) I don't think it's save to do:
>>
>> chk.s r[MEMLAT], .recovery3
>> mov value = r[MEMLAT]
>>
>> in the same cycle. In the patch below, I fixed this by adding a
>> stop bit, but obviously it would be better to avoid that (either
>> by re-ordering the code or by adding a pipeline stage).
>>
>> (2) stop bit was missing after br.cloop.dptk
>>
>> (3) off-by-one error in .recovery4 code: the destination should be
>> r[MEMLAT-1], not r[MEMLAT]
>>
>> (4) I believe the address calcuation in .recovery3 and .recovery4 may
>> also be off by 8; this is just based on eye-balling the code though,
>> so I may be wrong
>>
>> Hope this helps,
>>
>> --david
>>
----
Test case - run ~12 copies of this in parallel.
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <time.h>
char *dest, *src;
void
sigill_handler(int sig)
{
fprintf(stderr,"SIGILL: pid %d, dest 0x%lx, src 0x%lx\n",
getpid(), (long)dest, (long)src);
exit(1);
}
int
main() {
time_t temp1;
char *p, buffer[1024];
signal(SIGILL, sigill_handler);
time(&temp1);
src = ctime(&temp1);
dest = buffer;
printf("%d\n", strlen(src));
while(1)
strncpy(buffer,src,strlen(src));
}
--
Thanks
Jack Steiner (651-683-5302) (vnet 233-5302) steiner@sgi.com
next prev parent reply other threads:[~2002-04-03 21:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-02 3:11 [Linux-ia64] SIGILL errors in strncpu (NAT consumption) Jack Steiner
2002-04-02 3:46 ` Jack Steiner
2002-04-03 21:29 ` Erich Focht
2002-04-03 21:43 ` Jack Steiner [this message]
2002-04-03 22:10 ` David Mosberger
2002-04-04 8:36 ` Francois-Xavier Kowalski
2002-04-04 10:29 ` Hideki Yamamoto
2002-04-04 15:54 ` David Mosberger
2002-04-04 18:44 ` David Mosberger
2002-04-04 19:27 ` Erich Focht
2002-04-04 19:31 ` David Mosberger
2002-04-04 21:26 ` Erich Focht
2002-04-05 3:44 ` Hideki Yamamoto
2002-04-05 21:27 ` David Mosberger
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=marc-linux-ia64-105590701905372@msgid-missing \
--to=steiner@sgi.com \
--cc=linux-ia64@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.