From: "Gleb O. Raiko" <raiko@niisi.msk.ru>
To: linux-mips@oss.sgi.com
Subject: Bug in memmove
Date: Wed, 06 Jun 2001 17:11:19 +0400 [thread overview]
Message-ID: <3B1E2BF7.5C0CADB8@niisi.msk.ru> (raw)
Hello,
It seems there is a bug in our memmove routine. The condition is rare
though, for example, memmove copies incorrectly, if src=5, dst=4, len=9.
I guess, exact condition is:
len > 8, 0 < src - dst < 8, src isn't aligned on qw (8 bytes), src - dst
!= 4
I may be wrong on exact condition, but at least the example works.
Briefly, memmove calls memcpy if src > dst. Then, when memcpy aligns src
on qw, it copies qw to dst. So, after src is aligned, it is overwritten
as well. In the example, memcpy copies qw at 4 (so, new data ends on
4+8=12), but aligned src is at address 8, so a word at address 8 is
overwritten.
Two questions here. First, do we have a pattern that satisfies the
condition, i.e. is the bug showstopper? My guess, it's not. Second, does
somebody have ideas how to fix the bug? Well, I have, but want to hear
somebody else.
Regards,
Gleb.
next reply other threads:[~2001-06-06 16:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-06 13:11 Gleb O. Raiko [this message]
2001-06-22 18:21 ` Bug in memmove Maciej W. Rozycki
2001-06-23 14:22 ` Ralf Baechle
2001-06-25 12:03 ` Gleb O. Raiko
2001-06-25 12:13 ` Maciej W. Rozycki
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=3B1E2BF7.5C0CADB8@niisi.msk.ru \
--to=raiko@niisi.msk.ru \
--cc=linux-mips@oss.sgi.com \
/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