Re: [PATCH 1/1] mm: mempolicy: fix mbind_range() && vma_adjust() interaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/09, Andrew Morton wrote:
>
> On Mon, 8 Jul 2013 20:05:01 +0200 Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>
> > Change mbind_range() to recheck mpol_equal() after vma_merge() to
> > fix the problem 1444f92c tried to address.
>
> So I assume the kernel still passes Steven's testcase from the
> 1444f92c changelog?

Yes.

Just in case, I had to modify it a little bit so that it can be compiled
on my machine. But this test-case is not reliable afaics. It should fail
(without 1444f92c or this fix) only if the subsequent get_unmapped_area()
allocates the region "right before" the previous mmap.

Please see the simplified and robust test-case below.

Oleg.

int main(void)
{
	unsigned long mask[MAXNODE] = { 1 };
	int pgsz = getpagesize();
	int policy = -1;
	unsigned char *p;

	p = mmap(NULL, 2 * pgsz, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
			-1, 0);
	assert(p != MAP_FAILED);

	assert(syscall(__NR_mbind, p + pgsz, pgsz, MPOL_BIND, mask, MAXNODE, 0) == 0);
	assert(syscall(__NR_mbind, p, pgsz, MPOL_BIND, mask, MAXNODE, 0) == 0);
	assert(syscall(__NR_get_mempolicy, &policy, NULL, 0, p, MPOL_F_ADDR) == 0);

	assert(policy == MPOL_BIND);
	return 0;
}

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]