francma / wob

A lightweight overlay volume/backlight/progress/anything bar for Wayland.
ISC License
896 stars 49 forks source link

Segmentation fault since commit aec2abb94b0d038a13cb88418bd411a416f92230 #84

Closed jonasc closed 2 years ago

jonasc commented 3 years ago

After an update (after some time not updating) I noticed that my wob setup did not work anymore as expected. I'm on Arch Linux. I traced it down to a segmentation fault introduced in commit aec2abb94b0d038a13cb88418bd411a416f92230 (found it via git bisect).

For tests I ran wob like this

$ tail -f $XDG_RUNTIME_DIR/wob.sock | wob -vv
1631902749.243362 DEBUG log.c:111: Set log level to DEBUG
1631902749.243746 DEBUG pledge_seccomp.c:44: Adding syscall 228 to whitelist
1631902749.243763 DEBUG pledge_seccomp.c:44: Adding syscall 3 to whitelist
1631902749.243769 DEBUG pledge_seccomp.c:44: Adding syscall 60 to whitelist
1631902749.243776 DEBUG pledge_seccomp.c:44: Adding syscall 231 to whitelist
1631902749.243782 DEBUG pledge_seccomp.c:44: Adding syscall 72 to whitelist
1631902749.243794 DEBUG pledge_seccomp.c:44: Adding syscall 96 to whitelist
1631902749.243802 DEBUG pledge_seccomp.c:44: Adding syscall 7 to whitelist
1631902749.243809 DEBUG pledge_seccomp.c:44: Adding syscall 271 to whitelist
1631902749.243825 DEBUG pledge_seccomp.c:44: Adding syscall 0 to whitelist
1631902749.243830 DEBUG pledge_seccomp.c:44: Adding syscall 19 to whitelist
1631902749.243835 DEBUG pledge_seccomp.c:44: Adding syscall 47 to whitelist
1631902749.243840 DEBUG pledge_seccomp.c:44: Adding syscall 219 to whitelist
1631902749.243847 DEBUG pledge_seccomp.c:44: Adding syscall 46 to whitelist
1631902749.243855 DEBUG pledge_seccomp.c:44: Adding syscall 1 to whitelist
1631902749.243863 DEBUG pledge_seccomp.c:44: Adding syscall 20 to whitelist
1631902749.244417 DEBUG pledge_seccomp.c:57: Seccomp syscall whitelist successfully installed
1631902751.076187 INFO  main.c:898: [1]    125887 broken pipe                       tail -f $XDG_RUNTIME_DIR/wob.sock | 
       125888 segmentation fault (core dumped)  wob -vv

and the offending command was just

$ echo 10 >> $XDG_RUNTIME_DIR/wob.sock

The debug trace is as follows (but doesn't really help me track down the problem further):

(gdb) bt
#0  0x00007fde47698c0a in __strlen_sse2 () from /usr/lib/libc.so.6
#1  0x00007fde47666fd8 in __vfprintf_internal () from /usr/lib/libc.so.6
#2  0x00007fde476677a4 in buffered_vfprintf () from /usr/lib/libc.so.6
#3  0x00005626aa3ab3f3 in vfprintf (__ap=0x7ffcb1041fc0, __fmt=0x5626aa3ad540 "Received input { value = %ld, bg = %#x, border = %#x, bar = %#x, overflow = %s }", __stream=<optimized out>)
    at /usr/include/bits/stdio2.h:135
#4  _wob_log (importance=importance@entry=_WOB_LOG_INFO, file=file@entry=0x5626aa3ac055 "main.c", line=line@entry=898, 
    fmt=fmt@entry=0x5626aa3ad540 "Received input { value = %ld, bg = %#x, border = %#x, bar = %#x, overflow = %s }") at ../wob/log.c:89
#5  0x00005626aa3aa374 in main (argc=<optimized out>, argv=<optimized out>) at ../wob/main.c:891

If I can give you any more relevant details please ask. If you can give me further hints do debug it I'd be glad as well.

francma commented 3 years ago

This should fix this https://github.com/francma/wob/commit/66fb98821e600da0480f09aac09d704d4131e135. It's already in master and I will do a new release soon. Looks like only people running wob with -v are affected by this so it went unnoticed for a long time.

Thanks for the report :+1:

jonasc commented 3 years ago

I just tested it, it doesn't crash anymore. Thanks for the quick reply and fix.