]> granicus.if.org Git - php/commitdiff
Add privilege check in pcntl_unshare test
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 5 Aug 2020 07:53:22 +0000 (09:53 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 5 Aug 2020 16:18:06 +0000 (18:18 +0200)
Privileges for CLONE_NEWPID were not checked.

ext/pcntl/tests/pcntl_unshare_02.phpt

index bdcb6120efdbc347d198e3e27d0af9c49ca3b3cd..cafd64dd9628b47b6d2d3d73ca5e6a45d3169338 100644 (file)
@@ -9,8 +9,11 @@ if (!defined("CLONE_NEWPID")) die("skip flag unavailable");
 if (getenv("SKIP_ASAN")) die("skip asan chokes on this");
 if (posix_getuid() !== 0 &&
     (!defined("CLONE_NEWUSER") ||
-    (pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) {
-    die("skip Insufficient previleges to run test");
+    (@pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) {
+    die("skip Insufficient privileges for CLONE_NEWUSER");
+}
+if (@pcntl_unshare(CLONE_NEWPID) == false && pcntl_get_last_error() == PCNTL_EPERM) {
+    die("skip Insufficient privileges for CLONE_NEWPID");
 }
 
 --FILE--