Commit c2cae358 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

prctl: check -- Try new interface as well

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 1a2ed27b
...@@ -169,6 +169,7 @@ static int check_prctl(void) ...@@ -169,6 +169,7 @@ static int check_prctl(void)
{ {
unsigned long user_auxv = 0; unsigned long user_auxv = 0;
unsigned int *tid_addr; unsigned int *tid_addr;
unsigned int size = 0;
int ret; int ret;
ret = sys_prctl(PR_GET_TID_ADDRESS, (unsigned long)&tid_addr, 0, 0, 0); ret = sys_prctl(PR_GET_TID_ADDRESS, (unsigned long)&tid_addr, 0, 0, 0);
...@@ -177,6 +178,12 @@ static int check_prctl(void) ...@@ -177,6 +178,12 @@ static int check_prctl(void)
return -1; return -1;
} }
/*
* Either new or old interface must be supported in the kernel.
*/
ret = sys_prctl(PR_SET_MM, PR_SET_MM_MAP_SIZE, (unsigned long)&size, 0, 0);
if (ret) {
ret = sys_prctl(PR_SET_MM, PR_SET_MM_BRK, sys_brk(0), 0, 0); ret = sys_prctl(PR_SET_MM, PR_SET_MM_BRK, sys_brk(0), 0, 0);
if (ret) { if (ret) {
if (ret == -EPERM) if (ret == -EPERM)
...@@ -197,6 +204,7 @@ static int check_prctl(void) ...@@ -197,6 +204,7 @@ static int check_prctl(void)
pr_msg("prctl: PR_SET_MM_AUXV is not supported\n"); pr_msg("prctl: PR_SET_MM_AUXV is not supported\n");
return -1; return -1;
} }
}
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment