Re: [FIX] x11/dunst - pledge promises

2017-12-17 Thread Thierry


Hi Timo,

on 17 Dec 17 at 03:14:53 PM +, Timo Myyrä 
 wrote:

Hmm,
It indeed seems that the setting causing this is icon_position 
in the config
file. When its not off, the icons are enabled and the dlopen 
occurs.


What do you think about following patch, it adds prot_exec to 
pledge promises

when icon_position != off.

Timo

I made a few tests with icon_position={left,right,off} and so far 
so good.

Thank you for your time.

Regards,
Thierry



Re: [FIX] x11/dunst - pledge promises

2017-12-17 Thread Timo Myyrä
"T.Lux"  writes:

> On 15 October 2017 at 16:26 GMT, Sebastien Marie wrote:
>
>> 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  0x050ef1a00d38 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  0x050ef1a08d70 in _dl_load_shlib (libname=Variable "libname"
>> is not available.
>> ) at /usr/src/libexec/ld.so/library_subr.c:421
>> #3  0x050ef1a094f7 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  0x050f65b4c9a2 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  0x050eaedeb8db in _gdk_pixbuf_load_module () from
>> /usr/local/lib/libgdk_pixbuf-2.0.so.3200.1
>> #6  0x050eaedec83f in gdk_pixbuf_new_from_file () from
>> /usr/local/lib/libgdk_pixbuf-2.0.so.3200.1
>> #7  0x050ca6b0d1ba in get_pixbuf_from_file
>> (icon_path=0x50f3de7eb80
>> "/usr/local/share/icons/Moka/16x16/status//info.png")
>> at src/x11/x.c:310
>> #8  0x050ca6b0ce31 in get_pixbuf_from_path
>> (icon_path=0x50f844bc980 "info") at src/x11/x.c:349
>> #9  0x050ca6b0c7f6 in r_init_shared (c=0x50f65466000,
>> n=0x50f2ccf8100) at src/x11/x.c:414
>> #10 0x050ca6b0c488 in r_create_layout_from_notification
>> (c=0x50f65466000, n=0x50f2ccf8100) at src/x11/x.c:482
>> #11 0x050ca6b0a011 in r_create_layouts (c=0x50f65466000) at
>> src/x11/x.c:534
>> #12 0x050ca6b09c15 in x_win_draw () at src/x11/x.c:653
>> #13 0x050ca6b02849 in run (data=0x0) at src/dunst.c:242
>> #14 0x050ca6b02dfd in dunst_main (argc=1, argv=0x7f7e8388)
>> at src/dunst.c:378
>> #15 0x050ca6b0dcf2 in main (argc=1, argv=0x7f7e8388) 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.
>
>
>
> Your diff fix my problem, thank you for that! As to why you cannot
> reproduce it with the addition of the icon_folders directive in your
> configuration file is quite strange.
> I've attached the configuration file I am using, just in case... just
> launch it with dunst -config /path/to/config/file
>
> Regards,
> Thierry

Hmm,
It indeed seems that the setting causing this is icon_position in the config
file. When its not off, the icons are enabled and the dlopen occurs.

What do you think about following patch, it adds prot_exec to pledge promises
when icon_position != off.

Timo

Index: Makefile
===
RCS file: /cvs/ports/x11/dunst/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- Makefile31 Aug 2017 20:57:00 -  1.3
+++ Makefile17 Dec 2017 15:13:56 -
@@ -5,12 +5,13 @@ COMMENT=  

Re: [FIX] x11/dunst - pledge promises

2017-12-02 Thread Timo Myyrä
Sebastien Marie  writes:

> 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  0x050ef1a00d38 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  0x050ef1a08d70 in _dl_load_shlib (libname=Variable "libname" is not 
> available.
> ) at /usr/src/libexec/ld.so/library_subr.c:421
> #3  0x050ef1a094f7 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  0x050f65b4c9a2 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  0x050eaedeb8db in _gdk_pixbuf_load_module () from 
> /usr/local/lib/libgdk_pixbuf-2.0.so.3200.1
> #6  0x050eaedec83f in gdk_pixbuf_new_from_file () from 
> /usr/local/lib/libgdk_pixbuf-2.0.so.3200.1
> #7  0x050ca6b0d1ba in get_pixbuf_from_file (icon_path=0x50f3de7eb80 
> "/usr/local/share/icons/Moka/16x16/status//info.png")
> at src/x11/x.c:310
> #8  0x050ca6b0ce31 in get_pixbuf_from_path (icon_path=0x50f844bc980 
> "info") at src/x11/x.c:349
> #9  0x050ca6b0c7f6 in r_init_shared (c=0x50f65466000, n=0x50f2ccf8100) at 
> src/x11/x.c:414
> #10 0x050ca6b0c488 in r_create_layout_from_notification (c=0x50f65466000, 
> n=0x50f2ccf8100) at src/x11/x.c:482
> #11 0x050ca6b0a011 in r_create_layouts (c=0x50f65466000) at 
> src/x11/x.c:534
> #12 0x050ca6b09c15 in x_win_draw () at src/x11/x.c:653
> #13 0x050ca6b02849 in run (data=0x0) at src/dunst.c:242
> #14 0x050ca6b02dfd in dunst_main (argc=1, argv=0x7f7e8388) at 
> src/dunst.c:378
> #15 0x050ca6b0dcf2 in main (argc=1, argv=0x7f7e8388) 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.

Sorry for long delay,

I'd say the pledging in the loop would be best method now.
In the long term the dunst initialization should be tweaked so dlopen occurs
before the loop.

Timo



Re: [FIX] x11/dunst - pledge promises

2017-10-15 Thread T.Lux


On 15 October 2017 at 16:26 GMT, Sebastien Marie wrote:

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  0x050ef1a00d38 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  0x050ef1a08d70 in _dl_load_shlib (libname=Variable 
"libname" is not available.

) at /usr/src/libexec/ld.so/library_subr.c:421
#3  0x050ef1a094f7 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  0x050f65b4c9a2 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  0x050eaedeb8db in _gdk_pixbuf_load_module () from 
/usr/local/lib/libgdk_pixbuf-2.0.so.3200.1
#6  0x050eaedec83f in gdk_pixbuf_new_from_file () from 
/usr/local/lib/libgdk_pixbuf-2.0.so.3200.1
#7  0x050ca6b0d1ba in get_pixbuf_from_file 
(icon_path=0x50f3de7eb80 
"/usr/local/share/icons/Moka/16x16/status//info.png")

at src/x11/x.c:310
#8  0x050ca6b0ce31 in get_pixbuf_from_path 
(icon_path=0x50f844bc980 "info") at src/x11/x.c:349
#9  0x050ca6b0c7f6 in r_init_shared (c=0x50f65466000, 
n=0x50f2ccf8100) at src/x11/x.c:414
#10 0x050ca6b0c488 in r_create_layout_from_notification 
(c=0x50f65466000, n=0x50f2ccf8100) at src/x11/x.c:482
#11 0x050ca6b0a011 in r_create_layouts (c=0x50f65466000) at 
src/x11/x.c:534

#12 0x050ca6b09c15 in x_win_draw () at src/x11/x.c:653
#13 0x050ca6b02849 in run (data=0x0) at src/dunst.c:242
#14 0x050ca6b02dfd in dunst_main (argc=1, 
argv=0x7f7e8388) at src/dunst.c:378
#15 0x050ca6b0dcf2 in main (argc=1, argv=0x7f7e8388) 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.
[global]
font = Dejavu Sans Mono-7,FontAwesome-7
# Allow a small subset of html markup:
#   bold
#   italic
#   strikethrough
#   underline
#
# For a complete reference see
# .
# If markup is not allowed, those tags will be stripped out of the
# message.
allow_markup = yes

# The format of the message.  Possible variables are:
#   %a  appname
#   %s  summary
#   %b  body
#   %i  iconname (including its path)
#   %I  iconname (without its path)
#   %p  progress value if set ([  0%] to [100%]) or nothing
# Markup is allowed
format = "%a \n%s\n%b"

# Sort messages by urgency.
sort = yes

# Show how many messages are currently hidden (because of geometry).
indicate_hidden = yes

# Alignment of message text.
# Possible values are "left", "center" and "right".
alignment = left

# The frequency with wich text that is longer than the notification
# window allows bounces back and forth.
# This option conflicts with "word_wrap".
# Set to 0 to disable.
bounce_freq = 0

# Show age of 

Re: [FIX] x11/dunst - pledge promises

2017-10-15 Thread Sebastien Marie
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  0x050ef1a00d38 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  0x050ef1a08d70 in _dl_load_shlib (libname=Variable "libname" is not 
available.
) at /usr/src/libexec/ld.so/library_subr.c:421
#3  0x050ef1a094f7 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  0x050f65b4c9a2 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  0x050eaedeb8db in _gdk_pixbuf_load_module () from 
/usr/local/lib/libgdk_pixbuf-2.0.so.3200.1
#6  0x050eaedec83f in gdk_pixbuf_new_from_file () from 
/usr/local/lib/libgdk_pixbuf-2.0.so.3200.1
#7  0x050ca6b0d1ba in get_pixbuf_from_file (icon_path=0x50f3de7eb80 
"/usr/local/share/icons/Moka/16x16/status//info.png")
at src/x11/x.c:310
#8  0x050ca6b0ce31 in get_pixbuf_from_path (icon_path=0x50f844bc980 "info") 
at src/x11/x.c:349
#9  0x050ca6b0c7f6 in r_init_shared (c=0x50f65466000, n=0x50f2ccf8100) at 
src/x11/x.c:414
#10 0x050ca6b0c488 in r_create_layout_from_notification (c=0x50f65466000, 
n=0x50f2ccf8100) at src/x11/x.c:482
#11 0x050ca6b0a011 in r_create_layouts (c=0x50f65466000) at src/x11/x.c:534
#12 0x050ca6b09c15 in x_win_draw () at src/x11/x.c:653
#13 0x050ca6b02849 in run (data=0x0) at src/dunst.c:242
#14 0x050ca6b02dfd in dunst_main (argc=1, argv=0x7f7e8388) at 
src/dunst.c:378
#15 0x050ca6b0dcf2 in main (argc=1, argv=0x7f7e8388) 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
--- Makefile31 Aug 2017 20:57:00 -  1.3
+++ Makefile15 Oct 2017 16:21:00 -
@@ -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 -  1.1
+++ patches/patch-src_dunst_c   15 Oct 2017 16:21:00 -
@@ -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");
- 
- 

Re: [FIX] x11/dunst - pledge promises

2017-10-15 Thread T.Lux


debug_dunst.tar.gz
Description: Binary data

On 15 October 2017 at 05:19 GMT, Sebastien Marie wrote:

could you provide more debugging information ?

1) run the program with ktrace -di

$ ktrace -di dunst
Abort trap (core dumped)
$ kdump

(mostly the 100-last lines of kdump)


Attached file (within .tar.gz): kdump_dunst_tn100.out

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

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.

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?

Thanks,
Thierry


Re: [FIX] x11/dunst - pledge promises

2017-10-14 Thread Sebastien Marie
On Sat, Oct 14, 2017 at 09:41:17PM -0400, Thierry wrote:
> 
> On 14 October 2017 at 19:14 GMT, Theo Buehler wrote:
> > On Sat, Oct 14, 2017 at 02:29:41PM -0400, Thierry wrote:
> > > 
> > > Hi,
> > > 
> > > Since revision 1.1 dunst stopped working and produced coredumps
> > > related to "syscsall 197 'protexec'". The latter indicated that
> > > pledge(2) detected an unauthorized system call not defined in the
> > > promises list. Below is a proposed fix which is running fine under
> > > OpenBSD 6.2 GENERIC.MP#0 amd64
> > > 
> > 
> > It pledges too early.
> > 
> > I was unable to reproduce your problem, but I ran into another pledge
> > issue with dunst trying to open a socket. I only tested this very
> > briefly, but this patch seems to work for me.
> > 
> > Please test this with various setups.
> 
> Applying your diffs trigger a corddump with the same message, namely:
> /bsd: dunst(12359): syscall 197 "protexec"
> 

could you provide more debugging information ?

1) run the program with ktrace -di

$ ktrace -di dunst
Abort trap (core dumped)
$ kdump 

(mostly the 100-last lines of kdump)


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


Thanks.
-- 
Sebastien Marie



Re: [FIX] x11/dunst - pledge promises

2017-10-14 Thread Thierry


On 14 October 2017 at 19:14 GMT, Theo Buehler wrote:

On Sat, Oct 14, 2017 at 02:29:41PM -0400, Thierry wrote:


Hi,

Since revision 1.1 dunst stopped working and produced coredumps
related to "syscsall 197 'protexec'". The latter indicated that
pledge(2) detected an unauthorized system call not defined in 
the
promises list. Below is a proposed fix which is running fine 
under

OpenBSD 6.2 GENERIC.MP#0 amd64



It pledges too early.

I was unable to reproduce your problem, but I ran into another 
pledge
issue with dunst trying to open a socket. I only tested this 
very

briefly, but this patch seems to work for me.

Please test this with various setups.


Applying your diffs trigger a corddump with the same message, 
namely:

/bsd: dunst(12359): syscall 197 "protexec"

Regards,
Thierry



Re: [FIX] x11/dunst - pledge promises

2017-10-14 Thread Theo Buehler
On Sat, Oct 14, 2017 at 02:29:41PM -0400, Thierry wrote:
> 
> Hi,
> 
> Since revision 1.1 dunst stopped working and produced coredumps
> related to "syscsall 197 'protexec'". The latter indicated that
> pledge(2) detected an unauthorized system call not defined in the
> promises list. Below is a proposed fix which is running fine under
> OpenBSD 6.2 GENERIC.MP#0 amd64
> 

It pledges too early.

I was unable to reproduce your problem, but I ran into another pledge
issue with dunst trying to open a socket. I only tested this very
briefly, but this patch seems to work for me.

Please test this with various setups.

Index: Makefile
===
RCS file: /var/cvs/ports/x11/dunst/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- Makefile31 Aug 2017 20:57:00 -  1.3
+++ Makefile14 Oct 2017 19:01:14 -
@@ -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: /var/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 -  1.1
+++ patches/patch-src_dunst_c   14 Oct 2017 18:57:08 -
@@ -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();
- 
- x_setup();
-+  
+@@ -352,6 +356,9 @@ int dunst_main(int argc, char *argv[])
+ NULL,
+ NULL
+ };
++
 +if (pledge("stdio rpath proc exec", NULL) == -1)
 +err(1, "pledge");
  
- if (settings.startup_notification) {
- notification *n = notification_create();
+ GSource *x11_source =
+ g_source_new(_source_funcs, sizeof(x11_source_t));



[FIX] x11/dunst - pledge promises

2017-10-14 Thread Thierry


Hi,

Since revision 1.1 dunst stopped working and produced coredumps
related to "syscsall 197 'protexec'". The latter indicated that
pledge(2) detected an unauthorized system call not defined in the
promises list. Below is a proposed fix which is running fine under
OpenBSD 6.2 GENERIC.MP#0 amd64

Regards,
Thierry


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 -  1.1
+++ patches/patch-src_dunst_c   14 Oct 2017 18:23:57 -
@@ -18,7 +18,7 @@ Index: src/dunst.c

 x_setup();
+
-+if (pledge("stdio rpath proc exec", NULL) == -1)
++if (pledge("stdio rpath proc exec prot_exec", NULL) == 
-1)

+err(1, "pledge");

 if (settings.startup_notification) {