clang 6: php 5.6 broken with opcache

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

clang 6: php 5.6 broken with opcache

Stuart Henderson
php 5.6 built with clang 6 segfaults at runtime if opcache is used
(same with the in-tree version and a locally-built update to 5.6.35).

Packages built with old clang do work ok on the same kernel that the
new ones fail with.

Seems okay if opcache is not enabled. Seems okay in 7.0.

Does anyone have an idea what might be going on? In the absence of
anything better I'm currently trying to figure out how to compile
various files with a different compiler to try to narrow things down
to a particular file.


Example backtrace:

(gdb) bt
#0  0x00000d96cb832f53 in zend_block_optimization (op_array=Variable "op_array" is not available.
)
    at block_pass.c:1902
#1  0x00000d96cb830a8a in zend_optimize (op_array=Variable "op_array" is not available.
) at pass5.c:2
#2  0x00000d96cb82dad2 in zend_accel_optimize (op_array=0xd9664740a38,
    script=Variable "script" is not available.
)
    at /usr/obj/ports/php-5.6.35/php-5.6.35/ext/opcache/Optimizer/zend_optimizer.c:586
#3  0x00000d96cb82d897 in zend_accel_script_optimize (script=0xd9664740a20)
    at /usr/obj/ports/php-5.6.35/php-5.6.35/ext/opcache/Optimizer/zend_optimizer.c:633
#4  0x00000d96cb821d7b in compile_and_cache_file (file_handle=Variable "file_handle" is not available.
)
    at ZendAccelerator.c:1165
#5  0x00000d96cb821674 in persistent_compile_file (
    file_handle=0x7f7ffffdcf48, type=8) at ZendAccelerator.c:1680
#6  0x00000d943a70c10e in zend_execute_scripts (type=8, retval=0x0,
    file_count=3) at zend.c:1333
#7  0x00000d943a6a9b36 in php_execute_script (primary_file=Variable "primary_file" is not available.
) at main.c:2613
#8  0x00000d943a79c0fd in do_cli (argc=Variable "argc" is not available.
) at php_cli.c:999
#9  0x00000d943a79b03f in main (argc=2, argv=0x7f7ffffdd588)
    at php_cli.c:1383

Tail of kdump:

 42144 php-5.6  CALL  lseek(4,0,SEEK_CUR)
 42144 php-5.6  RET   lseek 5766/0x1686
 42144 php-5.6  CALL  fcntl(4,F_ISATTY)
 42144 php-5.6  RET   fcntl -1 errno 25 Inappropriate ioctl for device
 42144 php-5.6  CALL  fstat(4,0x7f7ffffd0070)
 42144 php-5.6  STRU  struct stat { dev=1037, ino=947378, mode=-rwxr-xr-x , nlink=1, uid=0<"root">, gid=7<"bin">, rdev=3812237, atime=1524224156<"Apr 20 12:35:56 2018">.361714097, mtime=1524095986<"Apr 19 00:59:46 2018">, ctime=1524217255<"Apr 20 10:40:55 2018">.710145907, size=5766, blocks=16, blksize=32768, flags=0x0, gen=0x0 }
 42144 php-5.6  RET   fstat 0
 42144 php-5.6  CALL  mmap(0,0x16a6,0x1<PROT_READ>,0x2<MAP_PRIVATE>,4,0)
 42144 php-5.6  RET   mmap 33848217530368/0x1ec8e6fb7000
 42144 php-5.6  CALL  mmap(0,0x40000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
 42144 php-5.6  RET   mmap 33850099900416/0x1ec9572e2000
 42144 php-5.6  CALL  kbind(0x7f7ffffd02a0,24,0xc153e7a574fb2071)
 42144 php-5.6  RET   kbind 0
 42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
 42144 php-5.6  RET   kbind 0
 42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
 42144 php-5.6  RET   kbind 0
 42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
 42144 php-5.6  RET   kbind 0
 42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
 42144 php-5.6  RET   kbind 0
 42144 php-5.6  CALL  kbind(0x7f7ffffd0130,24,0xc153e7a574fb2071)
 42144 php-5.6  RET   kbind 0
 42144 php-5.6  CALL  kbind(0x7f7ffffd0130,24,0xc153e7a574fb2071)
 42144 php-5.6  RET   kbind 0
 42144 php-5.6  CALL  kbind(0x7f7ffffd00a0,24,0xc153e7a574fb2071)
 42144 php-5.6  RET   kbind 0
 42144 php-5.6  CALL  kbind(0x7f7ffffd0130,24,0xc153e7a574fb2071)
 42144 php-5.6  RET   kbind 0
 42144 php-5.6  CALL  kbind(0x7f7ffffcfba0,24,0xc153e7a574fb2071)
 42144 php-5.6  RET   kbind 0
 42144 php-5.6  CALL  kbind(0x7f7ffffcfba0,24,0xc153e7a574fb2071)
 42144 php-5.6  RET   kbind 0
 42144 php-5.6  PSIG  SIGSEGV SIG_DFL code SEGV_MAPERR<1> addr=0x1ec9e4bb60ed trapno=6
 42144 php-5.6  NAMI  "php-5.6.core"

Reply | Threaded
Open this post in threaded view
|

Re: clang 6: php 5.6 broken with opcache

Stuart Henderson
On 2018/04/20 12:59, Stuart Henderson wrote:
> Does anyone have an idea what might be going on? In the absence of
> anything better I'm currently trying to figure out how to compile
> various files with a different compiler to try to narrow things down
> to a particular file.

..building the parts in ext/opcache with base gcc doesn't help.

Reply | Threaded
Open this post in threaded view
|

Re: clang 6: php 5.6 broken with opcache

Stuart Henderson
In reply to this post by Stuart Henderson
On 2018/04/20 12:59, Stuart Henderson wrote:

> php 5.6 built with clang 6 segfaults at runtime if opcache is used
> (same with the in-tree version and a locally-built update to 5.6.35).
>
> Packages built with old clang do work ok on the same kernel that the
> new ones fail with.
>
> Seems okay if opcache is not enabled. Seems okay in 7.0.
>
> Does anyone have an idea what might be going on? In the absence of
> anything better I'm currently trying to figure out how to compile
> various files with a different compiler to try to narrow things down
> to a particular file.

This problem is only triggered if suhosin is used, if I build with
FLAVOR=no_suhosin or install the no_suhosin flavoured packages then
it works ok.

Wondering if the easy option to "fix" this would be to kill 5.6.
Is it important for anything any more? I've been running with 7.0.x
for ages with no version-related problems.




> Example backtrace:
>
> (gdb) bt
> #0  0x00000d96cb832f53 in zend_block_optimization (op_array=Variable "op_array" is not available.
> )
>     at block_pass.c:1902
> #1  0x00000d96cb830a8a in zend_optimize (op_array=Variable "op_array" is not available.
> ) at pass5.c:2
> #2  0x00000d96cb82dad2 in zend_accel_optimize (op_array=0xd9664740a38,
>     script=Variable "script" is not available.
> )
>     at /usr/obj/ports/php-5.6.35/php-5.6.35/ext/opcache/Optimizer/zend_optimizer.c:586
> #3  0x00000d96cb82d897 in zend_accel_script_optimize (script=0xd9664740a20)
>     at /usr/obj/ports/php-5.6.35/php-5.6.35/ext/opcache/Optimizer/zend_optimizer.c:633
> #4  0x00000d96cb821d7b in compile_and_cache_file (file_handle=Variable "file_handle" is not available.
> )
>     at ZendAccelerator.c:1165
> #5  0x00000d96cb821674 in persistent_compile_file (
>     file_handle=0x7f7ffffdcf48, type=8) at ZendAccelerator.c:1680
> #6  0x00000d943a70c10e in zend_execute_scripts (type=8, retval=0x0,
>     file_count=3) at zend.c:1333
> #7  0x00000d943a6a9b36 in php_execute_script (primary_file=Variable "primary_file" is not available.
> ) at main.c:2613
> #8  0x00000d943a79c0fd in do_cli (argc=Variable "argc" is not available.
> ) at php_cli.c:999
> #9  0x00000d943a79b03f in main (argc=2, argv=0x7f7ffffdd588)
>     at php_cli.c:1383
>
> Tail of kdump:
>
>  42144 php-5.6  CALL  lseek(4,0,SEEK_CUR)
>  42144 php-5.6  RET   lseek 5766/0x1686
>  42144 php-5.6  CALL  fcntl(4,F_ISATTY)
>  42144 php-5.6  RET   fcntl -1 errno 25 Inappropriate ioctl for device
>  42144 php-5.6  CALL  fstat(4,0x7f7ffffd0070)
>  42144 php-5.6  STRU  struct stat { dev=1037, ino=947378, mode=-rwxr-xr-x , nlink=1, uid=0<"root">, gid=7<"bin">, rdev=3812237, atime=1524224156<"Apr 20 12:35:56 2018">.361714097, mtime=1524095986<"Apr 19 00:59:46 2018">, ctime=1524217255<"Apr 20 10:40:55 2018">.710145907, size=5766, blocks=16, blksize=32768, flags=0x0, gen=0x0 }
>  42144 php-5.6  RET   fstat 0
>  42144 php-5.6  CALL  mmap(0,0x16a6,0x1<PROT_READ>,0x2<MAP_PRIVATE>,4,0)
>  42144 php-5.6  RET   mmap 33848217530368/0x1ec8e6fb7000
>  42144 php-5.6  CALL  mmap(0,0x40000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
>  42144 php-5.6  RET   mmap 33850099900416/0x1ec9572e2000
>  42144 php-5.6  CALL  kbind(0x7f7ffffd02a0,24,0xc153e7a574fb2071)
>  42144 php-5.6  RET   kbind 0
>  42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
>  42144 php-5.6  RET   kbind 0
>  42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
>  42144 php-5.6  RET   kbind 0
>  42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
>  42144 php-5.6  RET   kbind 0
>  42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
>  42144 php-5.6  RET   kbind 0
>  42144 php-5.6  CALL  kbind(0x7f7ffffd0130,24,0xc153e7a574fb2071)
>  42144 php-5.6  RET   kbind 0
>  42144 php-5.6  CALL  kbind(0x7f7ffffd0130,24,0xc153e7a574fb2071)
>  42144 php-5.6  RET   kbind 0
>  42144 php-5.6  CALL  kbind(0x7f7ffffd00a0,24,0xc153e7a574fb2071)
>  42144 php-5.6  RET   kbind 0
>  42144 php-5.6  CALL  kbind(0x7f7ffffd0130,24,0xc153e7a574fb2071)
>  42144 php-5.6  RET   kbind 0
>  42144 php-5.6  CALL  kbind(0x7f7ffffcfba0,24,0xc153e7a574fb2071)
>  42144 php-5.6  RET   kbind 0
>  42144 php-5.6  CALL  kbind(0x7f7ffffcfba0,24,0xc153e7a574fb2071)
>  42144 php-5.6  RET   kbind 0
>  42144 php-5.6  PSIG  SIGSEGV SIG_DFL code SEGV_MAPERR<1> addr=0x1ec9e4bb60ed trapno=6
>  42144 php-5.6  NAMI  "php-5.6.core"
>

On 2018/04/20 22:13, Stuart Henderson wrote:
> On 2018/04/20 17:32, David CARLIER wrote:
> > I reproduced it just now ... all I can say is php without local patches does not trigger it.
>
> Oh that's very interesting. The port patches are pretty similar between
> 5.6 and 7.0 so it seems unlikely it would be them. But there is one major
> difference. I bet it's suhosin - trying without that now.

Reply | Threaded
Open this post in threaded view
|

Re: clang 6: php 5.6 broken with opcache

David CARLIER-2
I got same issue, once I recompiled the whole system earlier still got
segfault but slightly different ... If I switched the compiler to gcc 4.9
it worked but as said do not know if it worths keeping this version in the
tree ...

On 21 April 2018 at 12:51, Stuart Henderson <[hidden email]> wrote:

> On 2018/04/20 12:59, Stuart Henderson wrote:
> > php 5.6 built with clang 6 segfaults at runtime if opcache is used
> > (same with the in-tree version and a locally-built update to 5.6.35).
> >
> > Packages built with old clang do work ok on the same kernel that the
> > new ones fail with.
> >
> > Seems okay if opcache is not enabled. Seems okay in 7.0.
> >
> > Does anyone have an idea what might be going on? In the absence of
> > anything better I'm currently trying to figure out how to compile
> > various files with a different compiler to try to narrow things down
> > to a particular file.
>
> This problem is only triggered if suhosin is used, if I build with
> FLAVOR=no_suhosin or install the no_suhosin flavoured packages then
> it works ok.
>
> Wondering if the easy option to "fix" this would be to kill 5.6.
> Is it important for anything any more? I've been running with 7.0.x
> for ages with no version-related problems.
>
>
>
>
> > Example backtrace:
> >
> > (gdb) bt
> > #0  0x00000d96cb832f53 in zend_block_optimization (op_array=Variable
> "op_array" is not available.
> > )
> >     at block_pass.c:1902
> > #1  0x00000d96cb830a8a in zend_optimize (op_array=Variable "op_array" is
> not available.
> > ) at pass5.c:2
> > #2  0x00000d96cb82dad2 in zend_accel_optimize (op_array=0xd9664740a38,
> >     script=Variable "script" is not available.
> > )
> >     at /usr/obj/ports/php-5.6.35/php-5.6.35/ext/opcache/Optimizer/
> zend_optimizer.c:586
> > #3  0x00000d96cb82d897 in zend_accel_script_optimize
> (script=0xd9664740a20)
> >     at /usr/obj/ports/php-5.6.35/php-5.6.35/ext/opcache/Optimizer/
> zend_optimizer.c:633
> > #4  0x00000d96cb821d7b in compile_and_cache_file (file_handle=Variable
> "file_handle" is not available.
> > )
> >     at ZendAccelerator.c:1165
> > #5  0x00000d96cb821674 in persistent_compile_file (
> >     file_handle=0x7f7ffffdcf48, type=8) at ZendAccelerator.c:1680
> > #6  0x00000d943a70c10e in zend_execute_scripts (type=8, retval=0x0,
> >     file_count=3) at zend.c:1333
> > #7  0x00000d943a6a9b36 in php_execute_script (primary_file=Variable
> "primary_file" is not available.
> > ) at main.c:2613
> > #8  0x00000d943a79c0fd in do_cli (argc=Variable "argc" is not available.
> > ) at php_cli.c:999
> > #9  0x00000d943a79b03f in main (argc=2, argv=0x7f7ffffdd588)
> >     at php_cli.c:1383
> >
> > Tail of kdump:
> >
> >  42144 php-5.6  CALL  lseek(4,0,SEEK_CUR)
> >  42144 php-5.6  RET   lseek 5766/0x1686
> >  42144 php-5.6  CALL  fcntl(4,F_ISATTY)
> >  42144 php-5.6  RET   fcntl -1 errno 25 Inappropriate ioctl for device
> >  42144 php-5.6  CALL  fstat(4,0x7f7ffffd0070)
> >  42144 php-5.6  STRU  struct stat { dev=1037, ino=947378,
> mode=-rwxr-xr-x , nlink=1, uid=0<"root">, gid=7<"bin">, rdev=3812237,
> atime=1524224156<"Apr 20 12:35:56 2018">.361714097, mtime=1524095986<"Apr
> 19 00:59:46 2018">, ctime=1524217255<"Apr 20 10:40:55 2018">.710145907,
> size=5766, blocks=16, blksize=32768, flags=0x0, gen=0x0 }
> >  42144 php-5.6  RET   fstat 0
> >  42144 php-5.6  CALL  mmap(0,0x16a6,0x1<PROT_READ>,0x2<MAP_PRIVATE>,4,0)
> >  42144 php-5.6  RET   mmap 33848217530368/0x1ec8e6fb7000
> >  42144 php-5.6  CALL  mmap(0,0x40000,0x3<PROT_READ|
> PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,-1,0)
> >  42144 php-5.6  RET   mmap 33850099900416/0x1ec9572e2000
> >  42144 php-5.6  CALL  kbind(0x7f7ffffd02a0,24,0xc153e7a574fb2071)
> >  42144 php-5.6  RET   kbind 0
> >  42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
> >  42144 php-5.6  RET   kbind 0
> >  42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
> >  42144 php-5.6  RET   kbind 0
> >  42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
> >  42144 php-5.6  RET   kbind 0
> >  42144 php-5.6  CALL  kbind(0x7f7ffffd02c0,24,0xc153e7a574fb2071)
> >  42144 php-5.6  RET   kbind 0
> >  42144 php-5.6  CALL  kbind(0x7f7ffffd0130,24,0xc153e7a574fb2071)
> >  42144 php-5.6  RET   kbind 0
> >  42144 php-5.6  CALL  kbind(0x7f7ffffd0130,24,0xc153e7a574fb2071)
> >  42144 php-5.6  RET   kbind 0
> >  42144 php-5.6  CALL  kbind(0x7f7ffffd00a0,24,0xc153e7a574fb2071)
> >  42144 php-5.6  RET   kbind 0
> >  42144 php-5.6  CALL  kbind(0x7f7ffffd0130,24,0xc153e7a574fb2071)
> >  42144 php-5.6  RET   kbind 0
> >  42144 php-5.6  CALL  kbind(0x7f7ffffcfba0,24,0xc153e7a574fb2071)
> >  42144 php-5.6  RET   kbind 0
> >  42144 php-5.6  CALL  kbind(0x7f7ffffcfba0,24,0xc153e7a574fb2071)
> >  42144 php-5.6  RET   kbind 0
> >  42144 php-5.6  PSIG  SIGSEGV SIG_DFL code SEGV_MAPERR<1>
> addr=0x1ec9e4bb60ed trapno=6
> >  42144 php-5.6  NAMI  "php-5.6.core"
> >
>
> On 2018/04/20 22:13, Stuart Henderson wrote:
> > On 2018/04/20 17:32, David CARLIER wrote:
> > > I reproduced it just now ... all I can say is php without local
> patches does not trigger it.
> >
> > Oh that's very interesting. The port patches are pretty similar between
> > 5.6 and 7.0 so it seems unlikely it would be them. But there is one major
> > difference. I bet it's suhosin - trying without that now.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: clang 6: php 5.6 broken with opcache

Stuart Henderson
On 2018/04/21 13:27, David CARLIER wrote:
> I got same issue, once I recompiled the whole system earlier still got
> segfault but slightly different ... If I switched the compiler to gcc 4.9
> it worked but as said do not know if it worths keeping this version in the
> tree ...

Not checked but it's fairly likely that gcc 4.9 will result in problems
with icu4c (php-intl) due to the mixture of libc++ and libstdc++. I don't
think that is the answer.

Reply | Threaded
Open this post in threaded view
|

Re: clang 6: php 5.6 broken with opcache

David CARLIER-2
Surely not that s not ideal even without this C++ runtime conflict.
Seems FreeBSD touched by similar issue

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227723

On 21 April 2018 at 12:48, Stuart Henderson <[hidden email]> wrote:

> On 2018/04/21 13:27, David CARLIER wrote:
> > I got same issue, once I recompiled the whole system earlier still got
> > segfault but slightly different ... If I switched the compiler to gcc 4.9
> > it worked but as said do not know if it worths keeping this version in
> the
> > tree ...
>
> Not checked but it's fairly likely that gcc 4.9 will result in problems
> with icu4c (php-intl) due to the mixture of libc++ and libstdc++. I don't
> think that is the answer.
>
>