https://bugs.kde.org/show_bug.cgi?id=398445

--- Comment #8 from Stas Sergeev <s...@list.ru> ---
(In reply to Philippe Waroquiers from comment #7)
> If mmap would necessarily zero out memory, then
> that would create major difficulties to use
> shared memory.
> I think that what the kernel guarantees is that
> the first process that creates new memory
> with mmap gets zero-ed memory

Yes but I don't think valgrind knows if
this shm page is mapped first time or N-th
time. It simply doesn't have such info, unless
I am missing something obvious. So it should
probably assume the memory is initialized.
Or does it check if the mapping is MAP_SHARED
and assumes uninitialized only in that case?
In either case, my latest test-case does mmap()
then VALGRIND_MAKE_MEM_DEFINED() then fork().
No second mapping any more.

> Initialising yourself the memory via one ptr
> but accessing it via another mapping
> is not the same as declaring the memory
> defined after *each* mmap.
> In the first case, valgrind can just detect that
> the memory at ptr1 address is initialised,
> but it cannot see this initialisation via
> the second mapping.

Well, my last test-case does only one mmap()
and then fork(). So even if I think hard I don't
see how can I satisfy your current suggestion.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to