aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Schaefer <gerald.schaefer@de.ibm.com>2013-03-07 15:41:58 +0100
committerEric B Munson <emunson@mgebm.net>2013-03-09 21:46:18 -0500
commita06eeed7e005af579169f3020d3980198eb3ba30 (patch)
tree5e57a060aa2fe66dd4f566cb6e916b6f00fa5ab2
parent7caefa7221c5b09bc5a9f77e715807bcc85fdfba (diff)
downloadlibhugetlbfs-a06eeed7e005af579169f3020d3980198eb3ba30.tar.gz
task-size-overrun: fix problem with dynamic pagetable upgrade on s390x
The strategy to find out TASK_SIZE won't work on s390x anymore, starting with kernel 3.9. We will dynamically increase the pagetable levels on s390x on access beyond TASK_SIZE, effectively increasing TASK_SIZE from 2^42 to 2^53, but /proc/self/maps won't reflect this. With the current strategy that means that find_task_size() would loop for a very long time, from 2^42 to 2^53. To fix this, increase addr in the loop for s390x as soon as we exceed the 2^42 limit. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
-rw-r--r--tests/task-size-overrun.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/task-size-overrun.c b/tests/task-size-overrun.c
index 0140277..0ab76c7 100644
--- a/tests/task-size-overrun.c
+++ b/tests/task-size-overrun.c
@@ -82,6 +82,10 @@ static unsigned long find_task_size(void)
}
munmap(p, getpagesize());
addr += getpagesize();
+#if defined(__s390x__)
+ if (addr > (1UL << 42) && addr < (1UL << 53))
+ addr = 1UL << 53;
+#endif
}
/* addr wrapped around */
return 0;