|
From: John R. <jr...@bi...> - 2012-02-23 01:26:14
|
> /* Zero out the shadow area. */
> VG_(memset)(&arch->vex_shadow1, 0, sizeof(VexGuestS390XState));
> VG_(memset)(&arch->vex_shadow2, 0, sizeof(VexGuestS390XState));
>
> And that does not look right. At least on s390 all registers with
> exception of stack pointer and such are assumed to have undefined
> contents. I suspect this is similar on other architectures.
>
> Two questions:
>
> (1) Is the zero-out done on purpose?
So that memcheck itself does not use uninit bits.
Perhaps according to the rationale:
> by the time execution reaches those parts of the application
> program a user cares about, glibc will have populated the registers
> with some defined values anyhow? So why bother here?
For the actual answer, which is highly platform-dependent, see
<linux>/fs/binfmt_elf.h and the macro call:
ELF_PLAT_INIT(regs, reloc_func_desc);
On some $ARCH, execve() actually defines quite a few registers.
>
> (2) If I wanted to initialize those shadow areas to mark the registers
> as uninitialized, what bit pattern should be stored? All bits 1?
Hopefully the best answer will involve symbolic constants such as
V_BITS32_UNDEFINED or V_BITS64_UNDEFINED; see memcheck/memcheck.h.
--
|