Control: tags -1 + patch upstream
Dear Maintainer, I tried to have a look at this crash and I guess I found the reason. The plugin calls into libgs.so.9 by gsapi_new_instance/psapi_new_instance. Unfortunately the instance pointer is given to that function uninitialized. But documentation states that it has to be NULL [1]. Building a gimp package with attached patch makes the import not crash any longer. Upstream seems to track this issue in [2]. Kind regards, Bernhard [1] https://www.ghostscript.com/doc/current/API.htm#new_instance [2] https://gitlab.gnome.org/GNOME/gimp/issues/3636 Thread 1 "file-ps" received signal SIGSEGV, Segmentation fault. gs_lib_ctx_init (ctx=ctx@entry=0x7fea95643559 <__libc_read+89>, mem=mem@entry=0x559c0c831c00) at ./base/gslibctx.c:175 175 gx_monitor_enter((gx_monitor_t *)(pio->core->monitor)); (gdb) bt #0 0x00007fea95999ab8 in gs_lib_ctx_init (ctx=ctx@entry=0x7fea95643559 <__libc_read+89>, mem=mem@entry=0x559c0c831c00) at ./base/gslibctx.c:175 #1 0x00007fea959956b1 in gs_malloc_init_with_context (ctx=0x7fea95643559 <__libc_read+89>) at ./base/gsmalloc.c:597 #2 0x00007fea95a45622 in psapi_new_instance (pinstance=0x7ffd709dfe88, caller_handle=0x0) at ./psi/psapi.c:92 #3 0x0000559c0c2774ca in ps_open (filename=0x559c0c61b8e0 "/usr/share/doc/hp2xx/hp-tests/pages.2.eps", llx=<optimized out>, lly=<optimized out>, urx=<optimized out>, ury=<optimized out>, is_epsf=0x7ffd709e0304, loadopt=0x559c0c281080 <plvals>) at file-ps.c:1760 #4 0x0000559c0c278074 in load_image (filename=0x559c0c61b8e0 "/usr/share/doc/hp2xx/hp-tests/pages.2.eps", error=0x7ffd709e03f8) at file-ps.c:1077 #5 0x0000559c0c27958c in run (name=<optimized out>, nparams=<optimized out>, param=0x559c0c61bf70, nreturn_vals=0x7ffd709e0484, return_vals=<optimized out>) at file-ps.c:847 #6 0x00007fea96f3560c in gimp_proc_run (proc_run=<optimized out>) at gimp.c:2439 #7 0x00007fea96f3560c in gimp_loop () at gimp.c:2264 #8 0x00007fea96f3560c in gimp_main (info=<optimized out>, argc=<optimized out>, argv=<optimized out>) at gimp.c:671 #9 0x00007fea9549309b in __libc_start_main (main=0x559c0c274b80 <main>, argc=6, argv=0x7ffd709e0688, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffd709e0678) at ../csu/libc-start.c:308 #10 0x0000559c0c274bca in _start () at file-ps.c:589
Description: Avoid crash in gsapi_new_instance by initializing instance pointer Ghostscript documentation requires the handle pointer to be initialized which is given to gsapi_new_instance. https://www.ghostscript.com/doc/current/API.htm#new_instance Author: Bernhard Ãbelacker <bernha...@mailbox.org> Bug: https://gitlab.gnome.org/GNOME/gimp/issues/3636 Bug-Debian: https://bugs.debian.org/948026 Forwarded: no Last-Update: 2020-01-03 --- gimp-2.10.8.orig/plug-ins/common/file-ps.c +++ gimp-2.10.8/plug-ins/common/file-ps.c @@ -1757,6 +1757,7 @@ ps_open (const gchar *filename, } #endif + instance = NULL; code = gsapi_new_instance (&instance, NULL); if (code == 0) { code = gsapi_init_with_args (instance, cmdA->len - 1, pcmdA);
# Buster/stable amd64 qemu VM 2020-01-03 apt update apt dist-upgrade apt install systemd-coredump xserver-xorg sddm openbox xterm psmisc mc strace gdb gdbserver gimp hp2xx gimp-dbgsym libgimp2.0-dbgsym ghostscript-dbg apt build-dep gimp mkdir /home/benutzer/source/gimp/orig -p cd /home/benutzer/source/gimp/orig apt source gimp cd mkdir /home/benutzer/source/ghostscript/orig -p cd /home/benutzer/source/ghostscript/orig apt source ghostscript cd export DISPLAY=:0 export LANG=C # ulimit -c unlimited # unfortunately somehow disables gimp the core dump production ... # mv /usr/lib/gimp/2.0/plug-ins/file-ps/file-ps /file-ps.real # (echo "#\!/bin/sh"; echo "exec /usr/bin/gdbserver localhost:50000 /file-ps.real") > /usr/lib/gimp/2.0/plug-ins/file-ps/file-ps # chmod +x /usr/lib/gimp/2.0/plug-ins/file-ps/file-ps # gimp /usr/share/doc/hp2xx/hp-tests/pages.2.eps # gdb -q # target remote localhost:50000 # does not work too # gdb -q --args gimp /usr/share/doc/hp2xx/hp-tests/pages.2.eps # set width 0 # set pagination off # set follow-fork-mode child # run # not working too benutzer@debian:~$ gimp --stack-trace-mode=always /usr/share/doc/hp2xx/hp-tests/pages.2.eps (gimp:10927): Gtk-WARNING **: 23:12:08.841: Unable to locate theme engine in module_path: "pixmap", ... gimp_device_info_set_device: trying to set GdkDevice 'VirtualPS/2 VMware VMMouse' on GimpDeviceInfo which already has a device (file-ps:10952): Gtk-WARNING **: 23:12:10.118: Unable to locate theme engine in module_path: "pixmap", ... /usr/lib/gimp/2.0/plug-ins/file-ps/file-ps: fatal error: Segmentation fault 26 ../sysdeps/unix/sysv/linux/read.c: No such file or directory. # Stack traces obtained from PID 10952 - Thread 10952 # [New LWP 10953] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". __libc_read (nbytes=256, buf=0x7ffe3ce3cbd0, fd=9) at ../sysdeps/unix/sysv/linux/read.c:26 Id Target Id Frame * 1 Thread 0x7f2d19c0b0c0 (LWP 10952) "file-ps" __libc_read (nbytes=256, buf=0x7ffe3ce3cbd0, fd=9) at ../sysdeps/unix/sysv/linux/read.c:26 2 Thread 0x7f2d188cc700 (LWP 10953) "gmain" 0x00007f2d1da60819 in __GI___poll (fds=0x559f46a6bd70, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 Thread 2 (Thread 0x7f2d188cc700 (LWP 10953)): #0 0x00007f2d1da60819 in __GI___poll (fds=0x559f46a6bd70, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 resultvar = 18446744073709551100 sc_cancel_oldtype = 0 #1 0x00007f2d1ec09136 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007f2d1ec0925c in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #3 0x00007f2d1ec092a1 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #4 0x00007f2d1ec31415 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #5 0x00007f2d1db3cfa3 in start_thread (arg=<optimized out>) at pthread_create.c:486 ret = <optimized out> pd = <optimized out> now = <optimized out> unwind_buf = {cancel_jmp_buf = {{jmp_buf = {139831662135040, -2397926947061419605, 140729919984510, 140729919984511, 139831662135040, 0, 2369714997150429611, 2369704031384973739}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}} not_first_call = <optimized out> #6 0x00007f2d1da6b4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Thread 1 (Thread 0x7f2d19c0b0c0 (LWP 10952)): #0 0x00007f2d1db46544 in __libc_read (nbytes=256, buf=0x7ffe3ce3cbd0, fd=9) at ../sysdeps/unix/sysv/linux/read.c:26 resultvar = 18446744073709551104 sc_cancel_oldtype = 0 sc_ret = <optimized out> #1 0x00007f2d1db46544 in __libc_read (fd=9, buf=0x7ffe3ce3cbd0, nbytes=256) at ../sysdeps/unix/sysv/linux/read.c:24 #2 0x00007f2d1f407d34 in gimp_stack_trace_print () at /lib/libgimpbase-2.0.so.0 #3 0x00007f2d1f437b1d in () at /lib/libgimp-2.0.so.0 #4 0x00007f2d1db47730 in <signal handler called> () at /lib/x86_64-linux-gnu/libpthread.so.0 #5 0x00007f2d1de9cab8 in gs_lib_ctx_init () at /lib/x86_64-linux-gnu/libgs.so.9 #6 0x00007f2d1de986b1 in gs_malloc_init_with_context () at /lib/x86_64-linux-gnu/libgs.so.9 #7 0x00007f2d1df48622 in psapi_new_instance () at /lib/x86_64-linux-gnu/libgs.so.9 #8 0x0000559f45b664ca in () #9 0x0000559f45b67074 in () #10 0x0000559f45b6858c in () #11 0x00007f2d1f43860c in gimp_main () at /lib/libgimp-2.0.so.0 #12 0x00007f2d1d99609b in __libc_start_main (main=0x559f45b63b80 <main>, argc=6, argv=0x7ffe3ce3dac8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe3ce3dab8) at ../csu/libc-start.c:308 result = <optimized out> unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, 8468545519437820331, 94142557731744, 140729919986368, 0, 0, 2397221096097132971, 2369703846000144811}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x7ffe3ce3db00, 0x7f2d1f56a190}, data = {prev = 0x0, cleanup = 0x0, canceltype = 1021565696}}} not_first_call = <optimized out> #13 0x0000559f45b63bca in _start () [Inferior 1 (process 10952) detached] GIMP Message Plug-in crashed: "file-ps" (/usr/lib/gimp/2.0/plug-ins/file-ps/file-ps) The dying plug-in may have messed up GIMP's internal state. You may want to save your images and restart GIMP to be on the safe side. GIMP Message Opening '/usr/share/doc/hp2xx/hp-tests/pages.2.eps' failed: Procedure 'file-eps-load' returned no return values With debug symbols: /usr/lib/gimp/2.0/plug-ins/file-ps/file-ps: fatal error: Segmentation fault 26 ../sysdeps/unix/sysv/linux/read.c: No such file or directory. # Stack traces obtained from PID 11215 - Thread 11215 # [New LWP 11216] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". __libc_read (nbytes=256, buf=0x7ffe959b5850, fd=9) at ../sysdeps/unix/sysv/linux/read.c:26 Id Target Id Frame * 1 Thread 0x7fd890bf70c0 (LWP 11215) "file-ps" __libc_read (nbytes=256, buf=0x7ffe959b5850, fd=9) at ../sysdeps/unix/sysv/linux/read.c:26 2 Thread 0x7fd88f8b8700 (LWP 11216) "gmain" 0x00007fd894a4c819 in __GI___poll (fds=0x5622128284e0, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 Thread 2 (Thread 0x7fd88f8b8700 (LWP 11216)): #0 0x00007fd894a4c819 in __GI___poll (fds=0x5622128284e0, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 resultvar = 18446744073709551100 sc_cancel_oldtype = 0 #1 0x00007fd895bf5136 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007fd895bf525c in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #3 0x00007fd895bf52a1 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #4 0x00007fd895c1d415 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #5 0x00007fd894b28fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486 ret = <optimized out> pd = <optimized out> now = <optimized out> unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140568097949440, 2156251556088977900, 140731408408558, 140731408408559, 140568097949440, 0, -2135387597318317588, -2135372283923719700}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}} not_first_call = <optimized out> #6 0x00007fd894a574cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Thread 1 (Thread 0x7fd890bf70c0 (LWP 11215)): #0 0x00007fd894b32544 in __libc_read (nbytes=256, buf=0x7ffe959b5850, fd=9) at ../sysdeps/unix/sysv/linux/read.c:26 resultvar = 18446744073709551104 sc_cancel_oldtype = 0 sc_ret = <optimized out> #1 0x00007fd894b32544 in __libc_read (fd=9, buf=buf@entry=0x7ffe959b5850, nbytes=nbytes@entry=256) at ../sysdeps/unix/sysv/linux/read.c:24 #2 0x00007fd8963f3d34 in read (__nbytes=256, __buf=0x7ffe959b5850, __fd=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/unistd.h:44 status = 22050 stack_printed = 0 gtrace = 0x0 gimp_pid = "11215\000\000\000L\000\000\000\000\000\000" buffer = "\240b\261\224\330\177\000\000\000\352Y\260\370\034\"\236'2\222\020\"V\000\000Pa\230\022\"V\000\000@\250\261\224\330\177\000\000\240\352\222\022\"V\000\000\340\310t\022\"V\000\000\000\000\000\000\000\000\000\000'2\222\020\"V\000\000\340\334\277\225\330\177\000\000\213\000\256\224\330\177\000\000Pl\202\022\"V\000\000\b\000\000\000\060\000\000\000\240Y\233\225\376\177\000\000\320X\233\225\376\177\000\000\000\352Y\260\370\034\"\236\260j\256\224\330\177\000\000\326w\233\225\376\177\000\000\356K\207\022\"V\000\000\v\000\000\000\000\000\000\000\017\000\000\000\000\000\000\000\340\245\224\022\"V\000\000\000\000\000\000\000\000\000\000\001*\276\225\330\177\000\000%\005", '\000' <repeats 14 times>... read_n = <optimized out> sync_fd = {7, 8} out_fd = {9, 10} fork_pid = 11217 pid = 11215 eintr_count = 0 tid = 11215 #3 0x00007fd8963f3d34 in gimp_stack_trace_print (prog_name=<optimized out>, stream=0x7fd894b1a760 <_IO_2_1_stdout_>, trace=trace@entry=0x0) at gimputils.c:1306 status = 22050 stack_printed = 0 gtrace = 0x0 gimp_pid = "11215\000\000\000L\000\000\000\000\000\000" buffer = "\240b\261\224\330\177\000\000\000\352Y\260\370\034\"\236'2\222\020\"V\000\000Pa\230\022\"V\000\000@\250\261\224\330\177\000\000\240\352\222\022\"V\000\000\340\310t\022\"V\000\000\000\000\000\000\000\000\000\000'2\222\020\"V\000\000\340\334\277\225\330\177\000\000\213\000\256\224\330\177\000\000Pl\202\022\"V\000\000\b\000\000\000\060\000\000\000\240Y\233\225\376\177\000\000\320X\233\225\376\177\000\000\000\352Y\260\370\034\"\236\260j\256\224\330\177\000\000\326w\233\225\376\177\000\000\356K\207\022\"V\000\000\v\000\000\000\000\000\000\000\017\000\000\000\000\000\000\000\340\245\224\022\"V\000\000\000\000\000\000\000\000\000\000\001*\276\225\330\177\000\000%\005", '\000' <repeats 14 times>... read_n = <optimized out> sync_fd = {7, 8} out_fd = {9, 10} fork_pid = 11217 pid = 11215 eintr_count = 0 tid = 11215 #4 0x00007fd896423b1d in gimp_plugin_sigfatal_handler (sig_num=<optimized out>) at gimp.c:2124 sigset = {__val = {0 <repeats 16 times>}} #5 0x00007fd894b33730 in <signal handler called> () at /lib/x86_64-linux-gnu/libpthread.so.0 #6 0x00007fd894e88ab8 in gs_lib_ctx_init (ctx=ctx@entry=0x7fd894b32559 <__libc_read+89>, mem=mem@entry=0x56221294c400) at ./base/gslibctx.c:175 pio = 0x5622129510e0 #7 0x00007fd894e846b1 in gs_malloc_init_with_context (ctx=0x7fd894b32559 <__libc_read+89>) at ./base/gsmalloc.c:597 malloc_memory_default = 0x56221294c400 memory_t_default = <optimized out> #8 0x00007fd894f34622 in psapi_new_instance (pinstance=0x7ffe959b5f38, caller_handle=0x0) at ./psi/psapi.c:92 mem = 0x0 minst = 0x0 #9 0x000056221091d4ca in ps_open (filename=0x56221274c8e0 "/usr/share/doc/hp2xx/hp-tests/pages.2.eps", llx=<optimized out>, lly=<optimized out>, urx=<optimized out>, ury=<optimized out>, is_epsf=0x7ffe959b63b4, loadopt=0x562210927080 <plvals>) at file-ps.c:1760 driver = 0x562210923227 "ppmraw" cmdA = 0x5622128f2540 pcmdA = 0x562212990b30 fd_popen = 0x0 eps_file = <optimized out> width = 789 height = 789 resolution = <optimized out> x0 = 0 y0 = 0 x1 = 568 y1 = 568 offx = <optimized out> offy = 0 is_pdf = <optimized out> maybe_epsf = <optimized out> code = <optimized out> instance = 0x7fd894b32559 <__libc_read+89> #10 0x000056221091e074 in load_image (filename=0x56221274c8e0 "/usr/share/doc/hp2xx/hp-tests/pages.2.eps", error=0x7ffe959b64a8) at file-ps.c:1077 image_ID = 0 image_list = <optimized out> nl = <optimized out> page_count = <optimized out> ifp = <optimized out> temp = <optimized out> llx = 0 lly = 0 urx = 788 ury = 788 k = 310927456 n_images = <optimized out> max_images = <optimized out> max_pagenum = <optimized out> is_epsf = 1 #11 0x000056221091f58c in run (name=<optimized out>, nparams=<optimized out>, param=0x56221274cf70, nreturn_vals=0x7ffe959b6534, return_vals=<optimized out>) at file-ps.c:847 values = {{type = GIMP_PDB_STATUS, data = {d_int32 = 0, d_int16 = 0, d_int8 = 0 '\000', d_float = 0, d_string = 0x0, d_int32array = 0x0, d_int16array = 0x0, d_int8array = 0x0, d_floatarray = 0x0, d_stringarray = 0x0, d_colorarray = 0x0, d_color = {r = 0, g = 0, b = 0, a = 0}, d_region = {x = 0, y = 0, width = 0, height = 0}, d_display = 0, d_image = 0, d_item = 0, d_layer = 0, d_layer_mask = 0, d_channel = 0, d_drawable = 0, d_selection = 0, d_boundary = 0, d_path = 0, d_vectors = 0, d_unit = 0, d_parasite = {name = 0x0, flags = 0, size = 0, data = 0x0}, d_tattoo = 0, d_status = GIMP_PDB_EXECUTION_ERROR}}, {type = GIMP_PDB_INT32, data = {d_int32 = 0, d_int16 = 0, d_int8 = 0 '\000', d_float = 0, d_string = 0x0, d_int32array = 0x0, d_int16array = 0x0, d_int8array = 0x0, d_floatarray = 0x0, d_stringarray = 0x0, d_colorarray = 0x0, d_color = {r = 0, g = 0, b = 0, a = 0}, d_region = {x = 0, y = 0, width = 0, height = 0}, d_display = 0, d_image = 0, d_item = 0, d_layer = 0, d_layer_mask = 0, d_channel = 0, d_drawable = 0, d_selection = 0, d_boundary = 0, d_path = 0, d_vectors = 0, d_unit = 0, d_parasite = {name = 0x0, flags = 0, size = 0, data = 0x0}, d_tattoo = 0, d_status = GIMP_PDB_EXECUTION_ERROR}}} run_mode = <optimized out> status = GIMP_PDB_SUCCESS image_ID = -1 drawable_ID = -1 orig_image_ID = -1 export = GIMP_EXPORT_CANCEL error = 0x0 #12 0x00007fd89642460c in gimp_proc_run (proc_run=<optimized out>) at gimp.c:2439 proc_return = {name = 0x7fd896444c40 <_gimp_unit_cache_get_number_of_units> "\351Ky\377\377ff.\017\037\204", nparams = 2521058384, params = 0x7fd896444c60 <_gimp_unit_cache_new>} return_vals = 0x562210929500 <values> n_return_vals = 1 msg = {type = 5, data = 0x562212737160} basename = <optimized out> env_string = <optimized out> debug_string = <optimized out> __func__ = "gimp_main" #13 0x00007fd89642460c in gimp_loop () at gimp.c:2264 msg = {type = 5, data = 0x562212737160} basename = <optimized out> env_string = <optimized out> debug_string = <optimized out> __func__ = "gimp_main" #14 0x00007fd89642460c in gimp_main (info=<optimized out>, argc=<optimized out>, argv=<optimized out>) at gimp.c:671 basename = <optimized out> env_string = <optimized out> debug_string = <optimized out> __func__ = "gimp_main" #15 0x00007fd89498209b in __libc_start_main (main=0x56221091ab80 <main>, argc=6, argv=0x7ffe959b6738, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe959b6728) at ../csu/libc-start.c:308 result = <optimized out> unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, -5645074692242859540, 94704306858912, 140731408410416, 0, 0, -2156766363437164052, -2135372055246857748}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x7ffe959b6770, 0x7fd896556190}, data = {prev = 0x0, cleanup = 0x0, canceltype = -1784977552}}} not_first_call = <optimized out> #16 0x000056221091abca in _start () at file-ps.c:589 [Inferior 1 (process 11215) detached] ################### ################### ################### gimp --stack-trace-mode=always /usr/share/doc/hp2xx/hp-tests/pages.2.eps gdb -q --pid $(pidof file-ps) set width 0 set pagination off directory /home/benutzer/source/ghostscript/orig/ghostscript-9.27~dfsg directory /home/benutzer/source/gimp/orig/gimp-2.10.8/plug-ins/common b ps_open b gsapi_new_instance b psapi_new_instance b gs_malloc_init_with_context b gs_lib_ctx_init cont # click "Import" bt benutzer@debian:~$ gdb -q --pid $(pidof file-ps) Attaching to process 11403 [New LWP 11404] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 0x00007fea9555d819 in __GI___poll (fds=0x559c0c7c8390, nfds=3, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 29 ../sysdeps/unix/sysv/linux/poll.c: Datei oder Verzeichnis nicht gefunden. (gdb) set width 0 (gdb) set pagination off (gdb) directory /home/benutzer/source/ghostscript/orig/ghostscript-9.27~dfsg Source directories searched: /home/benutzer/source/ghostscript/orig/ghostscript-9.27~dfsg:$cdir:$cwd (gdb) cont Continuing. Thread 1 "file-ps" received signal SIGSEGV, Segmentation fault. gs_lib_ctx_init (ctx=ctx@entry=0x7fea95643559 <__libc_read+89>, mem=mem@entry=0x559c0c831c00) at ./base/gslibctx.c:175 175 gx_monitor_enter((gx_monitor_t *)(pio->core->monitor)); (gdb) bt #0 0x00007fea95999ab8 in gs_lib_ctx_init (ctx=ctx@entry=0x7fea95643559 <__libc_read+89>, mem=mem@entry=0x559c0c831c00) at ./base/gslibctx.c:175 #1 0x00007fea959956b1 in gs_malloc_init_with_context (ctx=0x7fea95643559 <__libc_read+89>) at ./base/gsmalloc.c:597 #2 0x00007fea95a45622 in psapi_new_instance (pinstance=0x7ffd709dfe88, caller_handle=0x0) at ./psi/psapi.c:92 #3 0x0000559c0c2774ca in ps_open (filename=0x559c0c61b8e0 "/usr/share/doc/hp2xx/hp-tests/pages.2.eps", llx=<optimized out>, lly=<optimized out>, urx=<optimized out>, ury=<optimized out>, is_epsf=0x7ffd709e0304, loadopt=0x559c0c281080 <plvals>) at file-ps.c:1760 #4 0x0000559c0c278074 in load_image (filename=0x559c0c61b8e0 "/usr/share/doc/hp2xx/hp-tests/pages.2.eps", error=0x7ffd709e03f8) at file-ps.c:1077 #5 0x0000559c0c27958c in run (name=<optimized out>, nparams=<optimized out>, param=0x559c0c61bf70, nreturn_vals=0x7ffd709e0484, return_vals=<optimized out>) at file-ps.c:847 #6 0x00007fea96f3560c in gimp_proc_run (proc_run=<optimized out>) at gimp.c:2439 #7 0x00007fea96f3560c in gimp_loop () at gimp.c:2264 #8 0x00007fea96f3560c in gimp_main (info=<optimized out>, argc=<optimized out>, argv=<optimized out>) at gimp.c:671 #9 0x00007fea9549309b in __libc_start_main (main=0x559c0c274b80 <main>, argc=6, argv=0x7ffd709e0688, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffd709e0678) at ../csu/libc-start.c:308 #10 0x0000559c0c274bca in _start () at file-ps.c:589 (gdb) display/i $pc 1: x/i $pc => 0x7fea95999ab8 <gs_lib_ctx_init+152>: mov (%rax),%rdi (gdb) disassemble gs_lib_ctx_init Dump of assembler code for function gs_lib_ctx_init: 0x00007fea95999a20 <+0>: test %rsi,%rsi ... 0x00007fea95999aa6 <+134>: test %r12,%r12 0x00007fea95999aa9 <+137>: je 0x7fea95999bf0 <gs_lib_ctx_init+464> 0x00007fea95999aaf <+143>: mov 0x8(%r12),%rax 0x00007fea95999ab4 <+148>: mov %rax,0x8(%rbx) => 0x00007fea95999ab8 <+152>: mov (%rax),%rdi 0x00007fea95999abb <+155>: add $0x8,%rdi 0x00007fea95999abf <+159>: callq 0x7fea9575ab40 <gp_monitor_enter@plt> 0x00007fea95999ac4 <+164>: mov 0x8(%rbx),%rax ... 0x00007fea95999d0a <+746>: jmpq 0x7fea95999be5 <gs_lib_ctx_init+453> End of assembler dump. (gdb) print/x $r12 $4 = 0x7fea95643559 (gdb) x/1xg $r12 + 0x8 0x7fea95643561 <__libc_read+97>: 0x0f66c35c415d5b10 (gdb) list ps_open ... 1561 ps_open (const gchar *filename, ... 1582 void *instance; ... 1760 code = gsapi_new_instance (&instance, NULL); ... https://www.ghostscript.com/doc/current/API.htm#new_instance https://gitlab.gnome.org/GNOME/gimp/issues/3614 https://gitlab.gnome.org/GNOME/gimp/issues/3636