Re: [discuss] Re: Opteron bug

Richard B. Johnson
2004-07-12T18:58:42Z

On Mon, 12 Jul 2004, H. Peter Anvin wrote:

> Andi Kleen wrote:
> >
> > The kernel never uses backwards REP prefixes.
> >
>
> Not even for memmove()?
>
> -hpa
>

One can't assume that 'cld' is not required because a user can
execute 'std'. Such a user, calling a kernel function in its
context, could really make a mess by executing 'std' before.

You definitely need a 'cld' inside any copy_to/from_user code.
memmove(), can copy overlapping buffers. It does this by
copying backwards when necessary. If it uses ix86 string
primatives, it executes 'std' for the backwards repeat counts.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.