On Sun, Oct 15, 2017 at 11:56:31AM -0400, T.Lux wrote:
> On 15 October 2017 at 05:19 GMT, Sebastien Marie wrote:
> 
> > 2) recompile the port with debugging symbol, and extract the backtrace
> > of the failure with gdb ?
> > 
> > $ cd /usr/ports/x11/dunst
> > $ make FETCH_PACKAGES=yes CFLAGS=-g
> > $ gdb /usr/ports/pobj/dunst-1.2.0/dunst-1.2.0/dunst
> > (gdb) run
> > ...
> > Program received signal SIGABRT, Aborted.
> > (gdb) backtrace
> Attached file (within .tar.gz): gdb_dunst.txt

inlined backtrace for lazy readers.

Starting program: /usr/ports/pobj/dunst-1.2.0/dunst-1.2.0/dunst 
[New process 11913]

Program received signal SIGABRT, Aborted.
_dl___syscall () at -:1
1       -: No such file or directory.
        in -
Current language:  auto; currently asm
#0  _dl___syscall () at -:1
#1  0x0000050ef1a00d38 in _dl_tryload_shlib (
    libname=0x50ef1c14b50 
"/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so", 
type=Variable "type" is not available.
) at syscall.h:67
#2  0x0000050ef1a08d70 in _dl_load_shlib (libname=Variable "libname" is not 
available.
) at /usr/src/libexec/ld.so/library_subr.c:421
#3  0x0000050ef1a094f7 in dlopen (libname=0x50ee660f500 
"/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so", 
    flags=Variable "flags" is not available.
) at /usr/src/libexec/ld.so/dlfcn.c:83
#4  0x0000050f65b4c9a2 in g_module_open (
    file_name=0x50f3de7f580 
"/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so", 
flags=Variable "flags" is not available.
) at gmodule-dl.c:97
#5  0x0000050eaedeb8db in _gdk_pixbuf_load_module () from 
/usr/local/lib/libgdk_pixbuf-2.0.so.3200.1
#6  0x0000050eaedec83f in gdk_pixbuf_new_from_file () from 
/usr/local/lib/libgdk_pixbuf-2.0.so.3200.1
#7  0x0000050ca6b0d1ba in get_pixbuf_from_file (icon_path=0x50f3de7eb80 
"/usr/local/share/icons/Moka/16x16/status//info.png")
    at src/x11/x.c:310
#8  0x0000050ca6b0ce31 in get_pixbuf_from_path (icon_path=0x50f844bc980 "info") 
at src/x11/x.c:349
#9  0x0000050ca6b0c7f6 in r_init_shared (c=0x50f65466000, n=0x50f2ccf8100) at 
src/x11/x.c:414
#10 0x0000050ca6b0c488 in r_create_layout_from_notification (c=0x50f65466000, 
n=0x50f2ccf8100) at src/x11/x.c:482
#11 0x0000050ca6b0a011 in r_create_layouts (c=0x50f65466000) at src/x11/x.c:534
#12 0x0000050ca6b09c15 in x_win_draw () at src/x11/x.c:653
#13 0x0000050ca6b02849 in run (data=0x0) at src/dunst.c:242
#14 0x0000050ca6b02dfd in dunst_main (argc=1, argv=0x7f7ffffe8388) at 
src/dunst.c:378
#15 0x0000050ca6b0dcf2 in main (argc=1, argv=0x7f7ffffe8388) at main.c:5
The program is running.  Exit anyway? (y or n) 

> OK, my inexperienced analysis is that I'm using icons in my dunstrc which
> uses:
> (a) /usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so
> to load png icons. the latter call mmap(2) with protection "PROT_EXEC"
> to load icons which failed since pledge(2) was already requested
> without "prot_exec" promise.

libgdk_pixbuf-2.0.so tries to load dynamic library with dlopen() on
first need. but it is already too late for pledge.

> I would guess that adding the line below into your dunstrc would
> reproduce this problem.
> 
>  icon_folders = /usr/local/share/icons/gnome/16x16/status/
> 
> correct?

unsure. I still couldn't reproduce. it should be part of the problem.
but I don't really know how to use this port :)

A bindly try is to pledge(2) really late... in fact it is at end of the
run() function, just before the sleep, so:
  - the program will call pledge(2) at each loop (not a problem per se)
  - the first loop is unpledged (but as initialization occurs in the
    first loop...)

else we should isolate exactly what trigger dlopen() in the config file,
and run unpledged in this case.

-- 
Sebastien Marie


Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/dunst/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- Makefile    31 Aug 2017 20:57:00 -0000      1.3
+++ Makefile    15 Oct 2017 16:21:00 -0000
@@ -5,6 +5,7 @@ COMMENT=        customizable and lightweight no
 GH_ACCOUNT =   dunst-project
 GH_PROJECT =   dunst
 GH_TAGNAME =   v1.2.0
+REVISION   =   0
 
 CATEGORIES =   x11
 
Index: patches/patch-src_dunst_c
===================================================================
RCS file: /cvs/ports/x11/dunst/patches/patch-src_dunst_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_dunst_c
--- patches/patch-src_dunst_c   31 Aug 2017 20:57:00 -0000      1.1
+++ patches/patch-src_dunst_c   15 Oct 2017 16:21:00 -0000
@@ -13,13 +13,13 @@ Index: src/dunst.c
  #include "dbus.h"
  #include "menu.h"
  #include "notification.h"
-@@ -325,6 +328,9 @@ int dunst_main(int argc, char *argv[])
-         int owner_id = initdbus();
+@@ -239,6 +242,9 @@ gboolean run(void *data)
+             x_win_draw();
+         }
  
-         x_setup();
-+      
 +        if (pledge("stdio rpath proc exec", NULL) == -1)
 +                err(1, "pledge");
- 
-         if (settings.startup_notification) {
-                 notification *n = notification_create();
++
+         if (xctx.visible) {
+                 int now = time(NULL);
+                 int sleep = get_sleep_time();

Reply via email to