Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Bug in memmove
@ 2001-06-06 13:11 Gleb O. Raiko
  2001-06-22 18:21 ` Maciej W. Rozycki
  0 siblings, 1 reply; 5+ messages in thread
From: Gleb O. Raiko @ 2001-06-06 13:11 UTC (permalink / raw)
  To: linux-mips

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-06-25 12:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-06 13:11 Bug in memmove Gleb O. Raiko
2001-06-22 18:21 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox