i386 memory fence incompatible with valgrind

Marc Lehmann schmorp at schmorp.de
Wed Jan 11 08:14:05 CET 2017

On Tue, Jan 10, 2017 at 08:03:49PM +0100, Matthias Urlichs <matthias at urlichs.de> wrote:
> valgrind does this on i386:

you mean libev?

>       #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("lock; orb
> $0, -1(%%esp)" : : : "memory")
> This code triggers a warning whenever it is executed under valgrind:
> whatever is below the stack pointer is undefined memory by definition.
> Not a good idea, as this causes legitimate warnings to get lost in the
> noise. :-(

This is a bug in valgrind, you should report it, they will probably fix

> Please access a legitimate memory location instead.

The area *is* a legitimate memory location, and I am sure valgrind agrees.

The instruction is a standard memory fence pattern also used by linux
for example, and if valgrind doesn't support it this is a deficiency in

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list