Bug #70973 [Opn->Fbk]: Segmentation fault when no huge pages available

From: Date: Thu, 26 Nov 2015 04:10:58 +0000
Subject: Bug #70973 [Opn->Fbk]: Segmentation fault when no huge pages available
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197428@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70973&edit=1 ID: 70973 Updated by: laruence@php.net Reported by: cv at jet9 dot ru Summary: Segmentation fault when no huge pages available -Status: Open +Status: Feedback Type: Bug Package: opcache Operating System: CentOS 6 PHP Version: 7.0.0RC7 -Assigned To: +Assigned To: laruence Block user comment: N Private report: N New Comment: I can not reproduce this simply, so could you please test with this patch? diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index e23e751..ae10d12 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2531,7 +2531,7 @@ static int accel_remap_huge_pages(void *start, size_t size, const char *name, si PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); - if (-1 == madvise(start, size, MADV_HUGEPAGE)) { + if (ret == MAP_FAILED || -1 == madvise(start, size, MADV_HUGEPAGE)) { munmap(mem, size); return -1; } Previous Comments: ------------------------------------------------------------------------ [2015-11-25 21:31:51] cv at jet9 dot ru Description: ------------ When opcache.huge_code_pages=1 and no huge pages available, php gots segfault: jet9.ru$ strace /own/bin/php ... mmap(0x400000, 2097152, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|0x40000, -1, 0) = -1 ENOMEM (Cannot allocate memory) munmap(0x7fa18485f000, 2097152) = 0 close(3) = 0 munmap(0x7fa1a0800000, 4096) = 0 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x5d72c0} --- +++ killed by SIGSEGV +++ Segmentation fault jet9.ru$ gdb /own/bin/php ... Program received signal SIGSEGV, Segmentation fault. zend_llist_del_element (l=0x9dc8e0, element=0x0, compare=0x7fffedf40590 <accelerator_remove_cb>) at /usr/src/debug/php-7.0.0RC8/Zend/zend_llist.c:91 I guess somewhere's lost mmap() returning value check when dealing with huge pages. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70973&edit=1

« previous php.bugs (#197428) next »