libgomp php-imagick segfault #185

Closed
opened 2023-05-09 15:58:41 +02:00 by danog · 1 comment

A segfault is raised when initializing libgomp when loading the php-imagick extension.

To reproduce, install php and the php-imagick ext, and run:
php -d extension=imagick

gdb backtrace:

(gdb) back
#0  0x00007fffe7dbb15e in initialize_env () at /usr/src/debug/gcc/gcc/libgomp/env.c:2062
#1  0x00007ffff7fcb96e in call_init (l=<optimized out>, argc=argc@entry=3, argv=argv@entry=0x7fffffffdc88, env=env@entry=0x5555568372b0) at dl-init.c:70
#2  0x00007ffff7fcba58 in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, l=<optimized out>) at dl-init.c:33
#3  _dl_init (main_map=0x555556973710, argc=3, argv=0x7fffffffdc88, env=0x5555568372b0) at dl-init.c:117
#4  0x00007ffff7fc756a in __GI__dl_catch_exception (exception=exception@entry=0x0, operate=operate@entry=0x7ffff7fd2920 <call_dl_init>, args=args@entry=0x7fffffffc0e0) at dl-catch.c:211
#5  0x00007ffff7fd29d7 in dl_open_worker (a=0x7fffffffc280) at dl-open.c:808
#6  dl_open_worker (a=a@entry=0x7fffffffc280) at dl-open.c:771
#7  0x00007ffff7fc74dd in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffc260, operate=operate@entry=0x7ffff7fd2940 <dl_open_worker>, args=args@entry=0x7fffffffc280)
    at dl-catch.c:237
#8  0x00007ffff7fd2d2c in _dl_open (file=0x7ffff4a09100 "/usr/lib/php/modules/imagick.so", mode=<optimized out>, caller_dlopen=0x555555821d86 <php_load_extension+854>, nsid=<optimized out>,
    argc=3, argv=0x7fffffffdc88, env=0x5555568372b0) at dl-open.c:884
#9  0x00007ffff7292afc in dlopen_doit (a=a@entry=0x7fffffffc4f0) at dlopen.c:56
#10 0x00007ffff7fc74dd in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffc450, operate=0x7ffff7292aa0 <dlopen_doit>, args=0x7fffffffc4f0) at dl-catch.c:237
#11 0x00007ffff7fc7613 in _dl_catch_error (objname=0x7fffffffc4a8, errstring=0x7fffffffc4b0, mallocedp=0x7fffffffc4a7, operate=<optimized out>, args=<optimized out>) at dl-catch.c:256
#12 0x00007ffff72925f7 in _dlerror_run (operate=operate@entry=0x7ffff7292aa0 <dlopen_doit>, args=args@entry=0x7fffffffc4f0) at dlerror.c:138
#13 0x00007ffff7292bb1 in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>, file=<optimized out>) at dlopen.c:71
#14 ___dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:81
#15 0x0000555555821d86 in php_load_shlib (errp=<synthetic pointer>, path=<optimized out>) at /usr/src/debug/php/php-8.2.5/ext/standard/dl.c:88
#16 php_load_extension (filename=0x7ffff4a02080 "imagick", type=1, start_now=0) at /usr/src/debug/php/php-8.2.5/ext/standard/dl.c:163
#17 0x0000555555924d6e in zend_llist_apply (l=l@entry=0x55555681d7d8 <extension_lists+56>, func=func@entry=0x5555558c43e0 <php_load_php_extension_cb>)
    at /usr/src/debug/php/php-8.2.5/Zend/zend_llist.c:184
#18 0x00005555558c51a5 in php_ini_register_extensions () at /usr/src/debug/php/php-8.2.5/main/php_ini.c:761
#19 0x00005555558bd6fe in php_module_startup (sf=<optimized out>, additional_module=0x0) at /usr/src/debug/php/php-8.2.5/main/main.c:2259
#20 0x000055555563fd1e in main (argc=3, argv=0x555556838ca0) at /usr/src/debug/php/php-8.2.5/sapi/cli/php_cli.c:1300
A segfault is raised when initializing libgomp when loading the `php-imagick` extension. To reproduce, install `php` and the `php-imagick` ext, and run: `php -d extension=imagick` gdb backtrace: ``` (gdb) back #0 0x00007fffe7dbb15e in initialize_env () at /usr/src/debug/gcc/gcc/libgomp/env.c:2062 #1 0x00007ffff7fcb96e in call_init (l=<optimized out>, argc=argc@entry=3, argv=argv@entry=0x7fffffffdc88, env=env@entry=0x5555568372b0) at dl-init.c:70 #2 0x00007ffff7fcba58 in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, l=<optimized out>) at dl-init.c:33 #3 _dl_init (main_map=0x555556973710, argc=3, argv=0x7fffffffdc88, env=0x5555568372b0) at dl-init.c:117 #4 0x00007ffff7fc756a in __GI__dl_catch_exception (exception=exception@entry=0x0, operate=operate@entry=0x7ffff7fd2920 <call_dl_init>, args=args@entry=0x7fffffffc0e0) at dl-catch.c:211 #5 0x00007ffff7fd29d7 in dl_open_worker (a=0x7fffffffc280) at dl-open.c:808 #6 dl_open_worker (a=a@entry=0x7fffffffc280) at dl-open.c:771 #7 0x00007ffff7fc74dd in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffc260, operate=operate@entry=0x7ffff7fd2940 <dl_open_worker>, args=args@entry=0x7fffffffc280) at dl-catch.c:237 #8 0x00007ffff7fd2d2c in _dl_open (file=0x7ffff4a09100 "/usr/lib/php/modules/imagick.so", mode=<optimized out>, caller_dlopen=0x555555821d86 <php_load_extension+854>, nsid=<optimized out>, argc=3, argv=0x7fffffffdc88, env=0x5555568372b0) at dl-open.c:884 #9 0x00007ffff7292afc in dlopen_doit (a=a@entry=0x7fffffffc4f0) at dlopen.c:56 #10 0x00007ffff7fc74dd in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffc450, operate=0x7ffff7292aa0 <dlopen_doit>, args=0x7fffffffc4f0) at dl-catch.c:237 #11 0x00007ffff7fc7613 in _dl_catch_error (objname=0x7fffffffc4a8, errstring=0x7fffffffc4b0, mallocedp=0x7fffffffc4a7, operate=<optimized out>, args=<optimized out>) at dl-catch.c:256 #12 0x00007ffff72925f7 in _dlerror_run (operate=operate@entry=0x7ffff7292aa0 <dlopen_doit>, args=args@entry=0x7fffffffc4f0) at dlerror.c:138 #13 0x00007ffff7292bb1 in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>, file=<optimized out>) at dlopen.c:71 #14 ___dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:81 #15 0x0000555555821d86 in php_load_shlib (errp=<synthetic pointer>, path=<optimized out>) at /usr/src/debug/php/php-8.2.5/ext/standard/dl.c:88 #16 php_load_extension (filename=0x7ffff4a02080 "imagick", type=1, start_now=0) at /usr/src/debug/php/php-8.2.5/ext/standard/dl.c:163 #17 0x0000555555924d6e in zend_llist_apply (l=l@entry=0x55555681d7d8 <extension_lists+56>, func=func@entry=0x5555558c43e0 <php_load_php_extension_cb>) at /usr/src/debug/php/php-8.2.5/Zend/zend_llist.c:184 #18 0x00005555558c51a5 in php_ini_register_extensions () at /usr/src/debug/php/php-8.2.5/main/php_ini.c:761 #19 0x00005555558bd6fe in php_module_startup (sf=<optimized out>, additional_module=0x0) at /usr/src/debug/php/php-8.2.5/main/main.c:2259 #20 0x000055555563fd1e in main (argc=3, argv=0x555556838ca0) at /usr/src/debug/php/php-8.2.5/sapi/cli/php_cli.c:1300 ```
Owner

This is an vanilla Arch bug, not specific to ALHP. I'd recommend running php with

LD_PRELOAD=libgomp.so.1 php

until its fixed upstream.

This is an vanilla Arch bug, not specific to ALHP. I'd recommend running php with ``` LD_PRELOAD=libgomp.so.1 php ``` until its [fixed upstream](https://github.com/Imagick/imagick/issues/609).
anonfunc added the
wontfix
label 2023-05-09 16:08:06 +02:00
Sign in to join this conversation.
No description provided.