[CRIU] [PATCH] zdtm: fix integer literal type bug in maps03
Andrew Vagin
avagin at parallels.com
Thu Apr 3 01:31:08 PDT 2014
On Wed, Apr 02, 2014 at 05:53:40PM -0700, Jamie Liu wrote:
> maps03 should have caught the bug fixed by 288cf5174165 "restore: mutate
> tgt_addr in map_private_vma", but didn't because integer literals
> (defaulting to 32-bit ints) were shifted out of range.
>
> Signed-off-by: Jamie Liu <jamieliu at google.com>
Acked-by: Andrew Vagin <avagin at parallels.com>
> ---
> test/zdtm/live/static/maps03.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/test/zdtm/live/static/maps03.c b/test/zdtm/live/static/maps03.c
> index 207e2a0..d5d6451 100644
> --- a/test/zdtm/live/static/maps03.c
> +++ b/test/zdtm/live/static/maps03.c
> @@ -12,22 +12,22 @@ int main(int argc, char **argv)
> unsigned char *mem;
>
> test_msg("Alloc huge VMA\n");
> - mem = (void *)mmap(NULL, (10 << 30), PROT_READ | PROT_WRITE,
> + mem = (void *)mmap(NULL, (10L << 30), PROT_READ | PROT_WRITE,
> MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> if ((void *)mem == MAP_FAILED) {
> err("mmap failed: %m");
> return -1;
> }
>
> - mem[4 << 30] = 1;
> - mem[8 << 30] = 2;
> + mem[4L << 30] = 1;
> + mem[8L << 30] = 2;
>
> test_daemon();
> test_waitsig();
>
> test_msg("Testing restored data\n");
>
> - if (mem[4 << 30] != 1 || mem[8 << 30] != 2) {
> + if (mem[4L << 30] != 1 || mem[8L << 30] != 2) {
> fail("Data corrupted!\n");
> exit(1);
> }
> --
> 1.9.1.423.g4596e3a
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list