Package: valgrind
Severity: normal

I tried on version 1:3.5.0-3, and it does work for me.

This is my test program:
#define _GNU_SOURCE
#include <sys/mman.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
    void *someMem = malloc(10000);
    void *aligned = (void*)((long)someMem & ~4095L);

    ((char*)aligned)[1000] = 'H';

    void *remapedPtr = mremap(aligned, 4096, 1024 * 512, MREMAP_MAYMOVE);

    printf("%smoved  : %lx -> %lx : %c\n", (remapedPtr == aligned)? "not ": "", 
aligned, remapedPtr, ((char*)remapedPtr)[1000]);

    ((char*)remapedPtr)[25000] = 'K';

    void *backToAligned = mremap(remapedPtr, 1024 * 512, 4096, MREMAP_MAYMOVE | 
MREMAP_FIXED, aligned);
    printf("%smoved back  : %lx -> %lx : %c\n", (backToAligned == aligned)? "": 
"not ", remapedPtr, backToAligned, ((char*)backToAligned)[1000]);

    free(someMem);
    return 0;
}


And this is the valgrind result:
w...@celine:~/debian-fix/valgrind-test% valgrind ./mremap
==11380== Memcheck, a memory error detector
==11380== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==11380== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for copyright 
info
==11380== Command: ./mremap
==11380==
moved  : 517a000 -> 4045000 : H
moved back  : 4045000 -> 517a000 : H
==11380==
==11380== HEAP SUMMARY:
==11380==     in use at exit: 0 bytes in 0 blocks
==11380==   total heap usage: 1 allocs, 1 frees, 10,000 bytes allocated
==11380==
==11380== All heap blocks were freed -- no leaks are possible
==11380==
==11380== For counts of detected and suppressed errors, rerun with: -v
==11380== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)
w...@celine:~/debian-fix/valgrind-test%


Do you have a small example that will reproduce the problem ?

Regards,
JB


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages valgrind depends on:
ii  libc6                         2.10.2-5   Embedded GNU C Library: Shared lib
ii  libc6-dbg                     2.10.2-5   Embedded GNU C Library: detached d

Versions of packages valgrind recommends:
ii  gdb                           7.0-1      The GNU Debugger

Versions of packages valgrind suggests:
pn  alleyoop                      <none>     (no description available)
ii  kcachegrind                   4:4.3.2-1  visualisation tool for the Valgrin
pn  valkyrie                      <none>     (no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to