Re: [criu] 1M guard page ruined restore

From: Cyrill Gorcunov
Date: Wed Jun 21 2017 - 12:22:57 EST


On Tue, Jun 20, 2017 at 03:23:20AM -0700, Hugh Dickins wrote:
...
>
> We do need to understand this fairly quickly, since those stable
> backports will pose more of a problem for you than the v4.12
> release itself.

The patches for criu are on the fly. Still one of the test case
start failing with the new kernels. Basically the test does
the following:

- allocate growsdown memory area
- touch first byte (which before the patch force the kernel
to extend the stack allocating new page)
- touch first-1 byte

---
int main(int argc, char **argv)
{
char *start_addr, *start_addr1, *fake_grow_down, *test_addr, *grow_down;
volatile char *p;

start_addr = mmap(NULL, PAGE_SIZE * 10, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (start_addr == MAP_FAILED) {
printf("Can't mal a new region");
return 1;
}
printf("start_addr %lx\n", start_addr);
munmap(start_addr, PAGE_SIZE * 10);

fake_grow_down = mmap(start_addr + PAGE_SIZE * 5, PAGE_SIZE,
PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED | MAP_GROWSDOWN, -1, 0);
if (fake_grow_down == MAP_FAILED) {
printf("Can't mal a new region");
return 1;
}
printf("start_addr %lx\n", fake_grow_down);

p = fake_grow_down;
*p-- = 'c';
*p = 'b';
...
}
---
This start failing because

| static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned long address)

function get dropped off. Hugh, it is done on intent and
userspace programs have to extend stack manually?

Cyrill