[CRIU] [PATCH] zdtm: protect random pages in maps04
Pavel Emelyanov
xemul at parallels.com
Fri Mar 29 15:57:48 EDT 2013
On 03/29/2013 08:29 PM, Andrey Vagin wrote:
We should have a test in zdtm that checks maps protections to preserve.
Where is it?
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
> test/zdtm/live/static/maps04.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/test/zdtm/live/static/maps04.c b/test/zdtm/live/static/maps04.c
> index 86b23e6..daf841e 100644
> --- a/test/zdtm/live/static/maps04.c
> +++ b/test/zdtm/live/static/maps04.c
> @@ -21,6 +21,7 @@ int main(int argc, char ** argv)
> {
> void *m;
> uint32_t crc;
> + int i;
>
> test_init(argc, argv);
>
> @@ -35,9 +36,18 @@ int main(int argc, char ** argv)
> crc = ~0;
> datagen(m, MEM_SIZE, &crc);
>
> + for (i = 0; i < MEM_SIZE / (1<<20); i++)
> + if (mprotect(m + (lrand48() * PAGE_SIZE % MEM_SIZE), PAGE_SIZE, PROT_NONE)) {
> + err("mprotect");
> + return 1;
> + }
> +
> test_daemon();
> test_waitsig();
>
> + if (mprotect(m, MEM_SIZE, PROT_READ))
> + err("mprotect");
> +
> crc = ~0;
> if (datachk(m, MEM_SIZE, &crc))
> fail("Mem corrupted");
>
More information about the CRIU
mailing list