I propose this new test setuid04 for the setuid syscall. The goal if this test is to check the fsuid is correctly handled by the setuid syscall. To do so, the test create a testfile as root with permission 0644, then do a setuid and try to open the file RDWR. This last open must fail since the process with new UID is not allowed to open the file on write. In a second step, the test does a fork to check the fsuid is correctly passed to a son and the son behaves correctly regarding files, i.e. it cannot open on write the test file.
I propose this new test setfsuid04 for the setfsuid syscall. The goal if this test is to check the fsuid is correctly handled by the setfsuid syscall. To do so, the test creates a testfile as root with permission 0644, then do a setuid and try to open the file RDWR. This last open must fail since the process with new UID is not allowed to open the file on write. In a second step, the test does a fork to check the fsuid is correctly passed to a son and the son behaves correctly regarding files, i.e. it cannot open on write the test file. Finally, the test falls back to the initial UID and try to open the file on write. This open must succeed.
I propose this new test setreuid07 for the setreuid syscall. The goal if this test is to check the fsuid is correctly handled by the setreuid syscall. To do so, the test creates a testfile as root with permission 0644, then do a setreuid and try to open the file RDWR. This last open must fail since the process with new UID is not allowed to open the file on write. In a second step, the test does a fork to check the fsuid is correctly passed to a son and the son behaves correctly regarding files, i.e. it cannot open on write the test file. Finally, the test falls back to the initial UID and try to open the file on write. This open must succeed.
I also propose this new test setresuid04 for the setresuid syscall. The goal if this test is to check the fsuid is correctly handled by the setresuid syscall. To do so, the test creates a testfile as root with permission 0644, then do a setresuid and try to open the file RDWR. This last open must fail since the process with new UID is not allowed to open the file on write. In a second step, the test does a fork to check the fsuid is correctly passed to a son and the son behaves correctly regarding files, i.e. it cannot open on write the test file. Finally, the test falls back to the initial UID and try to open the file on write. This open must succeed.
Signed-Off-By: Renaud Lottiaux <Renaud.Lottiaux@kerlabs.com>,
Signed-Off-By: Subrata Modak <subrata@linux.vnet.ibm.com>.
diff --git a/runtest/syscalls b/runtest/syscalls
index 2c2e515..c074f34 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -751,6 +751,7 @@
 setfsuid01 setfsuid01
 setfsuid02 setfsuid02
 setfsuid03 setfsuid03
+setfsuid04 setfsuid04
 
 setgid01 setgid01
 setgid01_16 setgid01_16
@@ -799,6 +800,7 @@
 setresuid01 setresuid01
 setresuid02 setresuid02
 setresuid03 setresuid03
+setresuid04 setresuid04
 
 setreuid01 setreuid01
 setreuid02 setreuid02
@@ -806,6 +808,7 @@
 setreuid04 setreuid04
 setreuid05 setreuid05
 setreuid06 setreuid06
+setreuid07 setreuid07
 
 setrlimit01 setrlimit01
 setrlimit02 setrlimit02
@@ -823,6 +826,7 @@
 setuid01 setuid01
 setuid02 setuid02
 setuid03 setuid03
+setuid04 setuid04
 
 shmat01 shmat01
 shmat02 shmat02