-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ext/ffi/tests/300.phpt
test is failing on Alpine linux
#9139
Comments
This test has a skipif clause which checks the |
Yes, but it skips the test if the |
Would it also be possible to run the tests on Alpine as regular user? |
I searched all occurences of
We can. Why is |
Seems like Lines 23 to 24 in fdb9e3a
|
Adding
We should skip this test when ran as root. I also think that we should execute tests as a non root user.
This test also fails here |
Isn't this resolved via 1c9a49e?
ACK |
With 1c9a49e we get the new error:
That's because |
I confirm this issue: https://github.com/php/php-src/runs/7694180097?check_suite_focus=true#step:10:92 Is there anything againt allowing preload as a root (/wo |
php-src/ext/opcache/ZendAccelerator.c Line 4621 in ad04345
Can Crude patch: diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
--- ext/opcache/ZendAccelerator.c
+++ ext/opcache/ZendAccelerator.c
@@ -4624,8 +4624,12 @@
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Preloading failed to getpwnam(\"%s\")", ZCG(accel_directives).preload_user);
return FAILURE;
}
+ if (pw->pw_uid == 0) {
+ goto skipfork;
+ }
+
pid = fork();
if (pid == -1) {
zend_shared_alloc_unlock();
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Preloading failed to fork()");
@@ -4670,8 +4674,9 @@
zend_accel_error(ACCEL_LOG_WARNING, "\"opcache.preload_user\" is ignored");
}
}
+skipfork:
sapi_module.activate = NULL;
sapi_module.deactivate = NULL;
sapi_module.register_server_variables = NULL;
sapi_module.header_handler = preload_header_handler; |
I've tried to look for particular reasons for this. What I've found is that when running Apache mod_php, the function People wouldn't expect their PHP scripts to be loaded/executed as root when they have configured Apache to run as an unprivileged user. So This also explains why the error message is worded this way: It's possible that FPM and other SAPIs work in a similar way.
Yes, I think so |
For the purpose of #8621, we could run the tests as a non-root user, or skip this test when ran as root. We could then allow FFI preloading to work a root in a separate PR. |
It would be actually good to have one of the pipeline run as root possibly as for example fpm often runs under root. Currently we have got just one test specific to root but there might be more in the future. Think the best solution is to skip it if run under root. In terms of opcache preloading and fpm, you get the same issue so that preload_user is needed there to work correctly. However it might still not resolve all of the issues as there can be multiple pools to run under different users and then it might not really work because opcache is shared between pools which is not ideal. You can see some discussion on the related issue in #8072 . |
In that light, doesn't it make sense to have the check (requiring |
Description
CI output:
CI: https://github.com/php/php-src/runs/7506106345?check_suite_focus=true#step:10:739
how can be this test fixed?
PHP Version
master, all other FFI tests pass
Operating System
Alpine linux
The text was updated successfully, but these errors were encountered: