kuravih / gllock

not so simple opengl based X display locker utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segfault at password entry.

sesim-nov opened this issue · comments

On my system, gllock segfaults whenever enter is pressed on the lockscreen, whether the password is entered correctly or not.

Steps to reproduce:

  • start gllock
  • press enter

GDB Trace of such a segfault:
gdb_trace.txt
I tried to add symbols to the binary but i had no luck for some reason...

I am getting this as well. Got some errors in gllock.c:

cleaning
gllock build options:
CFLAGS   = -pedantic -Wall -Os -I. -I/usr/include -I/usr/X11R6/include -DVERSION="0.1-alpha" -DHAVE_SHADOW_H -DSHADER_LOCATION="/root/.gllock" -DFRGMNT_SHADER="circle.fragment.glsl"
LDFLAGS  = -s -L/usr/lib -lc -lcrypt -L/usr/X11R6/lib -lX11 -lGL -lGLEW -lpthread
CC       = cc
CC gllock.c
gllock.c: In function ‘readpw’:
gllock.c:172:26: warning: implicit declaration of function ‘crypt’; did you mean ‘chroot’? [-Wimplicit-function-declaration]
         running = strcmp(crypt(passwd, pws), pws);
                          ^~~~~
                          chroot
gllock.c:172:26: warning: passing argument 1 of ‘strcmp’ makes pointer from integer without a cast [-Wint-conversion]
         running = strcmp(crypt(passwd, pws), pws);
                          ^~~~~~~~~~~~~~~~~~
In file included from gllock.c:15:
/usr/include/string.h:136:32: note: expected ‘const char *’ but argument is of type ‘int’
 extern int strcmp (const char *__s1, const char *__s2)
                    ~~~~~~~~~~~~^~~~
CC common.c
CC -o gllock
installing executable file to /usr/local/bin

gllock works otherwise, except it doesn't require a pw.

 ██████████████████  ████████     ds@elektrophagous
 ██████████████████  ████████     OS: Manjaro 18.0.4 Illyria
 ██████████████████  ████████     Kernel: x86_64 Linux 5.1.4-1-MANJARO
 ██████████████████  ████████     Uptime: 16h 34m
 ████████            ████████     Packages: 1241
 ████████  ████████  ████████     Shell: fish 3.0.2
 ████████  ████████  ████████     Resolution: 3840x2160
 ████████  ████████  ████████     WM: i3
 ████████  ████████  ████████     GTK Theme: Adapta-Nokto-Eta-Maia [GTK2/3]
 ████████  ████████  ████████     Icon Theme: Papirus-Adapta-Nokto-Maia
 ████████  ████████  ████████     Font: Noto Sans 10
 ████████  ████████  ████████     CPU: Intel Core i7-8550U @ 8x 4GHz [49.0°C]
 ████████  ████████  ████████     GPU: Mesa DRI Intel(R) UHD Graphics 620 (Kabylake GT2) 
 ████████  ████████  ████████     RAM: 3398MiB / 15785MiB

Can confirm i see identical errors.

Confirmed the patch to gllock.c fixed all errors on my system.

Question: should there be an indicator when typing pw or on failure?

Still getting segfaults, but the compilation errors are gone now. Also, it works right if the lock program is run as root.

GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
attach: No such file or directory.
Attaching to process 28960
[New LWP 28961]
[New LWP 28962]
[New LWP 28963]
[New LWP 28964]
[New LWP 28965]
[New LWP 28966]
[New LWP 28967]
[New LWP 28968]
[New LWP 28969]
[New LWP 28970]
[New LWP 28971]
[New LWP 28972]
[New LWP 28973]
[New LWP 28975]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
0x00007fe4a1f6a0d1 in poll () from /usr/lib/libc.so.6
(gdb) c
Continuing.

Thread 1 "gllock" received signal SIGSEGV, Segmentation fault.
0x00007fe4a1fd319e in __strcmp_avx2 () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007fe4a1fd319e in __strcmp_avx2 () from /usr/lib/libc.so.6
#1  0x00005567d2286a72 in ?? ()
#2  0x00005567d228668c in ?? ()
#3  0x00007fe4a1e9dce3 in __libc_start_main () from /usr/lib/libc.so.6
#4  0x00005567d228670e in ?? ()
(gdb) strace
warning: Couldn't determine the static tracepoint marker to probe
Static tracepoint 1 at 0x7fe4a1fd319e
(gdb) kill
Kill the program being debugged? (y or n) y
[Inferior 1 (process 28960) killed]
(gdb) quit

Nevermind, the issue above was on my end. Looks like this issue is resolved!

@manjaroblack

Question: should there be an indicator when typing pw or on failure?

It will do an audible bell on wrong password. I Intend to implement something visual in the future.