change mmap flags from PROT_EXEC to PROT_READ
PATCH 1/1 change mmap flags from PROT_EXEC to PROT_READ
In some architecture(e.g., mips), PROT_EXEC doesn't guarantee PROT_READ, which will cause segment fault. In others architectures, PROT_READ is more accurate.
--- testcases/kernel/syscalls/mmap/mmap03.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/mmap/mmap03.c +1 -1
@@ -85,7 +85,7 @@ int main(int ac, char **av)* with execute access. */ errno =0 ; - addr =mmap (0 , page_sz,PROT_EXEC , + addr =mmap (0 , page_sz,PROT_READ ,MAP_FILE |MAP_SHARED , fildes,0 );/* Check for the return value of mmap() */
Signature · 1 line
2.25.1
PATCH 1/1 change mmap flags from PROT_EXEC to PROT_READ
Hi!
Quoted 3 lines
In some
architecture(e.g., mips),PROT_EXECdoesn't guaranteePROT_READ, which will cause segment fault. In others architectures,PROT_READis more accurate.
First of all sorry for the late response.
Quoted 10 lines
Signed-off-by xueshi hu <[email protected]>--- testcases/kernel/syscalls/mmap/mmap03.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/kernel/syscalls/mmap/mmap03.c +0
-0
testcases/kernel/syscalls/mmap/mmap03.c int main(int ac, char **av) · line 89
Quoted 6 lines
testcases/kernel/syscalls/mmap/mmap03.c +1
-1@@ -85,7 +85,7 @@ int main(int ac, char **av)* with execute access. */ errno =0 ; - addr =mmap (0 , page_sz,PROT_EXEC , + addr =mmap (0 , page_sz,PROT_READ ,MAP_FILE |MAP_SHARED , fildes,0 );
This is not correct fix. The test actually expects that on certain architectures PROT_EXEC does not imply PROT_READ but that check is missing mips, so this should probably be fixed with:
testcases/kernel/syscalls/mmap/mmap03.c +1 -1
@@ -124,7 +124,7 @@ int main(int ac, char **av) "correct"); } } -#if defined(__ia64__) || defined(__hppa__) +#if defined(__ia64__) || defined(__hppa__) || defined(__mips__)if (pass) {tst_resm (TPASS ,"Got SIGSEGV as expected" ); }else {
Does this change fixes the test for you?
Signature · 2 lines
Cyril Hrubis [email protected]