fastfetch-cli / fastfetch

A maintained, feature-rich and performance oriented, neofetch like system information tool.
MIT License
11.03k stars 426 forks source link

AddressSanitizer fires upon launching leading to SEGV #544

Closed RainerKuemmerle closed 1 year ago

RainerKuemmerle commented 1 year ago

General description of bug:

Often helpful information:

The content of the configuration file you use (if any)

Output of env NO_CONFIG=1 fastfetch --load-config all --show-errors --stat --multithreading false --disable-linewrap false --hide-cursor false:

==6522==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fd5bc62df99 bp 0x7fd5b59fb1a0 sp 0x7fd5b83fd760 T2)
==6522==The signal is caused by a WRITE memory access.
==6522==Hint: address points to the zero page. 
    #0 0x7fd5bc62df99 in XRRGetOutputProperty (/lib/x86_64-linux-gnu/libXrandr.so+0x6f99) (BuildId: b566cc3096f78d3ad5469b0ac5a77bcbfcd0306b)
    #1 0x5651f391f59f in xrandrHandleOutput /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/xlib.c:212
    #2 0x5651f391fc40 in xrandrHandleMonitor /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/xlib.c:235
    #3 0x5651f39205b2 in xrandrHandleMonitors /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/xlib.c:265
    #4 0x5651f3921325 in xrandrHandleScreen /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/xlib.c:310
    #5 0x5651f39225d3 in ffdsConnectXrandr /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/xlib.c:371
    #6 0x5651f3913214 in ffConnectDisplayServerImpl /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/displayserver_linux.c:105
    #7 0x5651f3849e5f in ffConnectDisplayServer /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/displayserver.c:39
    #8 0x5651f393e17e in ffDetectQt /home/goki/workspace/dotfiles/git/fastfetch/src/detection/gtk_qt/qt.c:157
    #9 0x5651f3829be7 in ffDetectQtThreadMain /home/goki/workspace/dotfiles/git/fastfetch/src/common/init.c:182
    #10 0x7fd5bc48f189 in start_thread nptl/pthread_create.c:444
    #11 0x7fd5bc51dbcf in clone3 ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libXrandr.so+0x6f99) (BuildId: b566cc3096f78d3ad5469b0ac5a77bcbfcd0306b) in XRRGetOutputProperty
Thread T2 created by T0 here:
    #0 0x7fd5bd049185 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:208
    #1 0x5651f3829292 in ffThreadCreate /home/goki/workspace/dotfiles/git/fastfetch/src/common/thread.h:34
    #2 0x5651f3829c62 in startDetectionThreads /home/goki/workspace/dotfiles/git/fastfetch/src/common/init.c:190
    #3 0x5651f3829f98 in ffStart /home/goki/workspace/dotfiles/git/fastfetch/src/common/init.c:234
    #4 0x5651f381e2ff in main /home/goki/workspace/dotfiles/git/fastfetch/src/fastfetch.c:1296
    #5 0x7fd5bc423a8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Output of fastfetch --list-features:

$ ./fastfetch --list-features               
threads
vulkan
xcb
xrandr
x11
gio
imagemagick6
chafa
zlib
egl
glx

If fastfatch crashed

Paste the stacktrace here. You may get it with:

$ gdb /path/to/fastfetch
$ run
$ bt
#0  0x00007ffff6e1af99 in XRRGetOutputProperty () from /lib/x86_64-linux-gnu/libXrandr.so
#1  0x0000555555b555a0 in xrandrHandleOutput (data=0x7ffff13fd080, output=82, name=0x7ffff10fd0e0, primary=true) at /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/xlib.c:212
#2  0x0000555555b55c41 in xrandrHandleMonitor (data=0x7ffff13fd080, monitorInfo=0x606000003380) at /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/xlib.c:235
#3  0x0000555555b565b3 in xrandrHandleMonitors (data=0x7ffff13fd080, screen=0x60c000006400) at /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/xlib.c:265
#4  0x0000555555b57326 in xrandrHandleScreen (data=0x7ffff13fd080, screen=0x60c000006400) at /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/xlib.c:310
#5  0x0000555555b585d4 in ffdsConnectXrandr (result=0x555556504d80 <result>) at /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/xlib.c:371
#6  0x0000555555b49215 in ffConnectDisplayServerImpl (ds=0x555556504d80 <result>) at /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/linux/displayserver_linux.c:105
#7  0x0000555555a7fe60 in ffConnectDisplayServer () at /home/goki/workspace/dotfiles/git/fastfetch/src/detection/displayserver/displayserver.c:39
#8  0x0000555555a5fbd4 in ffConnectDisplayServerThreadMain () at /home/goki/workspace/dotfiles/git/fastfetch/src/common/init.c:181
#9  0x00007ffff6c8f18a in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444
#10 0x00007ffff6d1dbd0 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Let me know how to provide more information.

CarterLi commented 1 year ago

Do you use x11 or wayland?

RainerKuemmerle commented 1 year ago

I am using X11 with Openbox as WM, kitty as Terminal.

Maybe helps, the output of 1.12.2

$ ./fastfetch --load-config ../presets/all
                            ....               goki@e14
              .',:clooo:  .:looooo:.           --------
           .;looooooooc  .oooooooooo'          OS: Ubuntu 23.04 x86_64
        .;looooool:,''.  :ooooooooooc          Host: 20T6000RGE (ThinkPad E14 Gen 2)
       ;looool;.         'oooooooooo,          Bios: 1.10
      ;clool'             .cooooooc.  ,,       Board: 20T6000RGE
         ...                ......  .:oo,      Chassis: 10
  .;clol:,.                        .loooo'     Kernel: 6.2.0-27-generic
 :ooooooooo,                        'ooool     Uptime: 26 mins
'ooooooooooo.                        loooo.    Processes: 696
'ooooooooool                         coooo.    Packages: 3278 (dpkg), 8 (snap)
 ,loooooooc.                        .loooo.    Shell: zsh 5.9
   .,;;;'.                          ;ooooc     Display 1: 1920x1080 @ 60Hz
       ...                         ,ooool.     Display 2: 1920x1080 @ 60Hz
    .cooooc.              ..',,'.  .cooo.      Brightness (0000:04:00.0): 31%
      ;ooooo:.           ;oooooooc.  :l.       DE: Xfce4
       .coooooc,..      coooooooooo.           WM: Openbox (X11)
         .:ooooooolc:. .ooooooooooo'           WM Theme: Nordic-Openbox
           .':loooooo;  ,oooooooooc            Theme: Nordic [GTK2/3]
               ..';::c'  .;loooo:'             Icons: elementary-xfce-dark [GTK2/3]
                             .                 Font: Sans (10pt) [GTK2/3]
                                               Cursor: DMZ-White (0px)
                                               Terminal: kitty 0.29.2
                                               Terminal Font: UbuntuMono Nerd Font Mono (11.0pt)
                                               CPU: AMD Ryzen 5 4500U (6) @ 2.375 GHz
                                               CPU Usage: 25%
                                               GPU: AMD Radeon Graphics (RADV RENOIR)
                                               Memory: 1.77 GiB / 14.85 GiB (11%)
                                               Swap: 0 B / 2.00 GiB (0%)
                                               Disk (/): 161 GiB / 468 GiB (34%)
                                               Battery: 58% [Charging]
                                               Public IP: X
                                               Local IP (enx482ae38072b2): 192.168.2.108
                                               Local IP (wlp3s0): 192.168.2.119
                                               Wifi: gokiWiFi-5G - 802.11
                                               Date & Time: 2023-08-26 10:19:17
                                               Locale: en_US.UTF-8
                                               Vulkan: 1.3.238 - radv [Mesa 23.0.4-0ubuntu1~23.04.1]
                                               OpenGL: 4.6 (Compatibility Profile) Mesa 23.0.4-0ubuntu1~23.04.1
                                               Users: goki
                                               Weather: +19°C - Partly cloudy (Stuttgart, Germany)

                                               ████████████████████████
                                               ████████████████████████

Not sure why DE is displayed as xfce, probably because I launch some components from Openbox' autostart but not xfce4-session.

My .config/fastfetch/config, which also triggers the problem, does actually not display any X/WM related info?

--kitty Tux.png
--logo-width 30

--separator "  "

--set-keyless HardwareStart=┌───────── \e[1mHardware Information\e[0m ─────────┐
--set-keyless SoftwareStart=├───────── \e[1mSoftware Information\e[0m ─────────┤
--set-keyless  NetworkStart=├───────── \e[1mNetwork Information\e[0m ──────────┤
--set-keyless InformationEnd=└────────────────────────────────────────┘
--set-keyless Colors=    \e[38m \e[37m \e[36m \e[35m \e[34m \e[33m \e[32m \e[31m
--structure HardwareStart:Host:CPU:Battery:SoftwareStart:OS:Kernel:Shell:Packages:NetworkStart:LocalIP:Wifi:InformationEnd

--battery-key "  "
--host-key "  "
--cpu-key "  "
--gpu-key "  󰍹"
--os-key "  "
--kernel-key "  "
--wm-key "  "
--shell-key "  "
--terminal-key "  "
--packages-key "  "
--localip-show-loop false
--localip-format "{1} {2}"
--localip-key "  󰌗"
--wifi-key "  "
--wifi-format "{1} state: {2} {4}"

 are nerdfont characters.

CarterLi commented 1 year ago

Should be fixed in the dev branch. Please test it

CarterLi commented 1 year ago

Not sure why DE is displayed as xfce, probably because I launch some components from Openbox' autostart but not xfce4-session.

I'm not familiar with Openbox. What should be displayed instead?

RainerKuemmerle commented 1 year ago

Should be fixed in the dev branch. Please test it

Thanks for the quick fix. Segfault is gone. A leak is showing up.

==20822==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 386 byte(s) in 2 object(s) allocated from:
    #0 0x7f6257adefef in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7f62570b3127 in XRRGetOutputProperty (/lib/x86_64-linux-gnu/libXrandr.so+0x7127) (BuildId: b566cc3096f78d3ad5469b0ac5a77bcbfcd0306b)

SUMMARY: AddressSanitizer: 386 byte(s) leaked in 2 allocation(s).
RainerKuemmerle commented 1 year ago

Not sure why DE is displayed as xfce, probably because I launch some components from Openbox' autostart but not xfce4-session.

I'm not familiar with Openbox. What should be displayed instead?

I am not sure either. Not clear to me what defines launching a DE or just a WM. It's fine to me, just wondered about it. When starting Openbox (a window manager) I launch xfce4-power-manager and xfce4-screensaver by autostart. So probably, it's a self made DE with using xfce components.

CarterLi commented 1 year ago

Should be fixed in the dev branch. Please test it

Thanks for the quick fix. Segfault is gone. A leak is showing up.

==20822==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 386 byte(s) in 2 object(s) allocated from:
    #0 0x7f6257adefef in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7f62570b3127 in XRRGetOutputProperty (/lib/x86_64-linux-gnu/libXrandr.so+0x7127) (BuildId: b566cc3096f78d3ad5469b0ac5a77bcbfcd0306b)

SUMMARY: AddressSanitizer: 386 byte(s) leaked in 2 allocation(s).

Fixed. Please test it again

RainerKuemmerle commented 1 year ago

Works. Thank you.

CarterLi commented 1 year ago

Good!

I suggest that you migrate your config file to JSON. You may refer to presets/examples/*.jsonc as a start