From 2ba384e8524dbdc980f6c12ec1c311f312e70a47 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Wed, 20 Nov 2013 14:41:34 +0400 Subject: [PATCH] rst: Add comment about old memory unmap Signed-off-by: Pavel Emelyanov --- pie/restorer.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pie/restorer.c b/pie/restorer.c index 8369e9c5b..ff5d25922 100644 --- a/pie/restorer.c +++ b/pie/restorer.c @@ -530,7 +530,19 @@ void __export_unmap(void) /* * This function unmaps all VMAs, which don't belong to - * the restored process or the restorer + * the restored process or the restorer. + * + * The restorer memory is two regions -- area with restorer, its stack + * and arguments and the one with private vmas of the tasks we restore + * (a.k.a. premmaped area): + * + * 0 TASK_SIZE + * +----+====+----+====+---+ + * + * Thus to unmap old memory we have to do 3 unmaps: + * [ 0 -- 1st area start ] + * [ 1st end -- 2nd start ] + * [ 2nd start -- TASK_SIZE ] */ static int unmap_old_vmas(void *premmapped_addr, unsigned long premmapped_len, void *bootstrap_start, unsigned long bootstrap_len)