Subject: Re: mprotect(2) strange behaviour under compat linux
To: Matthias Drochner <M.Drochner@fz-juelich.de>
From: Nicolas Joly <njoly@pasteur.fr>
List: current-users
Date: 12/19/2007 14:06:07
On Tue, Dec 18, 2007 at 02:56:41PM +0100, Matthias Drochner wrote:
> 
> njoly@pasteur.fr said:
> > Could this be a bug in memset from suse 10.0 glibc
> 
> I wouldn't call it a bug. It is likely an optimisation
> to allocate a cache line in case the system doesn't do
> write allocation, thus avoiding write-through latency.
> This is legal. Depending on architecture and alignment
> there are cases where physical reads can't be avoided
> at all.
> 
> Relying on write-only semantics is inherently non-portable.

Thanks.

In the mean time, i changed:
        memset(buf, 0x0, len)
to
	char *p;
	for (i = 0, p = buf; i < len; i++, p++) *p = 0x0;

Which does not exhibit the problem.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.