Bug 1670386
Summary: | AVC denied httpd_execmem for php-fpm when php-opcache is installed | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | David Jež <djez> | |
Component: | php-7.2-module | Assignee: | Remi Collet <rcollet> | |
Status: | CLOSED WONTFIX | QA Contact: | rhel-cs-infra-services-qe <rhel-cs-infra-services-qe> | |
Severity: | unspecified | Docs Contact: | Lenka Špačková <lkuprova> | |
Priority: | unspecified | |||
Version: | 8.0 | CC: | bnater, jorton, mmalik, pasik, ralphkw1, rcollet | |
Target Milestone: | rc | Keywords: | TestBlockerForLayeredProduct | |
Target Release: | 8.0 | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | Doc Type: | Known Issue | ||
Doc Text: |
.`php-fpm` causes SELinux AVC denials when `php-opcache` is installed with PHP 7.2
When the `php-opcache` package is installed, the FastCGI Process Manager (`php-fpm`) causes SELinux AVC denials. To work around this problem, change the default configuration in the `/etc/php.d/10-opcache.ini` file to the following:
----
opcache.huge_code_pages=0
----
Note that this problem affects only the `php:7.2` stream, not the `php:7.3` one.
|
Story Points: | --- | |
Clone Of: | ||||
: | 1725104 (view as bug list) | Environment: | ||
Last Closed: | 2021-02-01 07:32:18 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: |
Description
David Jež
2019-01-29 13:18:52 UTC
The execmem permission for httpd_t domain will not be allowed by default, because it's dangerous from SELinux point-of-view: * https://danwalsh.livejournal.com/73611.html * https://akkadia.org/drepper/selinux-mem.html ---- type=PROCTITLE msg=audit(01/29/2019 10:27:11.504:308) : proctitle=/usr/sbin/php-fpm --nodaemonize type=SYSCALL msg=audit(01/29/2019 10:27:11.504:308) : arch=x86_64 syscall=mmap success=no exit=EACCES(Permission denied) a0=0x55b45f400000 a1=0x200000 a2=PROT_READ|PROT_WRITE|PROT_EXEC a3=MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_HUGETLB items=0 ppid=1 pid=6342 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=php-fpm exe=/usr/sbin/php-fpm subj=system_u:system_r:httpd_t:s0 key=(null) type=AVC msg=audit(01/29/2019 10:27:11.504:308) : avc: denied { execmem } for pid=6342 comm=php-fpm scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0 ---- If your use-case really needs such a permission, you have to enable the httpd_execmem boolean: # setsebool -P httpd_execmem on Need to test with opcache.huge_code_pages=0 2 possible fix: 1/ runtime - change default provided configuration to opcache.huge_code_pages=0 (whichh may allow user to enable it....) 2/ buldtime - add --disable-huge-code-pages build option - clean configuration file In both case, a configuration change is needed The previous comment indicates a configuration change is a possible mitigation. But it does not work for me. ; Enables or disables copying of PHP code (text segment) into HUGE PAGES. ; This should improve performance, but requires appropriate OS configuration. opcache.huge_code_pages=0 # php -v PHP 7.4.13 (cli) (built: Nov 24 2020 10:03:34) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies # ausearch -m AVC ---- time->Sat Dec 19 03:33:45 2020 type=AVC msg=audit(1608370425.385:153): avc: denied { execmem } for pid=742 comm="php-fpm" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0 (In reply to Ralph Williamson from comment #12) > The previous comment indicates a configuration change is a possible > mitigation. But it does not work for me. > > ; Enables or disables copying of PHP code (text segment) into HUGE PAGES. > ; This should improve performance, but requires appropriate OS configuration. > opcache.huge_code_pages=0 > > # php -v > PHP 7.4.13 (cli) (built: Nov 24 2020 10:03:34) ( NTS ) > Copyright (c) The PHP Group > Zend Engine v3.4.0, Copyright (c) Zend Technologies > with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies Hi Ralph, this doesn't look like php delivered by RedHat in rhel-8.3. Latest php 7.4 is php-common-7.4.6-4.module+el8.3.0+7002+2eb69d76 # php -v PHP 7.4.6 (cli) (built: May 12 2020 08:09:15) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies > > # ausearch -m AVC > > ---- > time->Sat Dec 19 03:33:45 2020 > type=AVC msg=audit(1608370425.385:153): avc: denied { execmem } for > pid=742 comm="php-fpm" scontext=system_u:system_r:httpd_t:s0 > tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0 After evaluating this issue, there are no plans to address it further or fix it in an upcoming release. Therefore, it is being closed. If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened. |