~kennylevinsen/greetd#41: 
Failed Howdy authentication crashes greetd

Hello! I am using Howdy for facial authentication using an IR camera on my laptop.

I also use greetd+ReGreet as my Display Manager, which is working great.

However, when Howdy fails to recognize my face, the ReGreet UI freezes. We (Harish Rajagopal and I) have figured out it is not ReGreet getting freezes, but greetd. You can read the conversation here.

I am attaching the coredump of greetd, which I got by running coredumpctl info greetd -S today:

           PID: 126161 (greetd)
           UID: 0 (root)
           GID: 0 (root)
        Signal: 6 (ABRT)
     Timestamp: Sun 2023-03-19 00:22:24 EET (13min ago)
  Command Line: /nix/store/6gq7rm8bil7n6l53wcygyqy6arn007ha-greetd-0.8.0/bin/greetd --session-worker 12
    Executable: /nix/store/6gq7rm8bil7n6l53wcygyqy6arn007ha-greetd-0.8.0/bin/greetd
 Control Group: /system.slice/greetd.service
          Unit: greetd.service
         Slice: system.slice
       Boot ID: 61e83d899d4847f8b0e61b0ffb68a1af
    Machine ID: 20973b6ad9b7467586c81b604444befa
      Hostname: io
       Storage: /var/lib/systemd/coredump/core.greetd.0.61e83d899d4847f8b0e61b0ffb68a1af.126161.1679178144000000.zst (inaccessible)
       Message: Process 126161 (greetd) of user 0 dumped core.
                
                Module pam_warn.so without build-id.
                Module libffi.so.8 without build-id.
                Module libp11-kit.so.0 without build-id.
                Module libcap.so.2 without build-id.
                Module pam_systemd.so without build-id.
                Module pam_loginuid.so without build-id.
                Module pam_env.so without build-id.
                Module pam_deny.so without build-id.
                Module pam_gnupg.so without build-id.
                Module libinih.so.0 without build-id.
                Module libstdc++.so.6 without build-id.
                Module libevdev.so.2 without build-id.
                Module libINIReader.so.0 without build-id.
                Module pam_howdy.so without build-id.
                Module libcrypt.so.1 without build-id.
                Module pam_unix.so without build-id.
                Module libaudit.so.1 without build-id.
                Module libgcc_s.so.1 without build-id.
                Module libpam_misc.so.0 without build-id.
                Module libpam.so.0 without build-id.
                Module greetd without build-id.
                Stack trace of thread 126161:
                #0  0x00007f73b848abc7 __pthread_kill_implementation (libc.so.6 + 0x8abc7)
                <a href="/~kennylevinsen/greetd/1" title="~kennylevinsen/greetd#1: Kill remaining session children when session terminates">#1</a>  0x00007f73b843db46 raise (libc.so.6 + 0x3db46)
                <a href="/~kennylevinsen/greetd/2" title="~kennylevinsen/greetd#2: Consider implementing lockscreen functionality">#2</a>  0x00007f73b84284b5 abort (libc.so.6 + 0x284b5)
                <a href="/~kennylevinsen/greetd/3" title="~kennylevinsen/greetd#3: Greeter → session handover without glitching to text mode">#3</a>  0x00007f73b80a9a89 _ZN9__gnu_cxx27__verbose_terminate_handlerEv.cold (libstdc++.so.6 + 0xa9a89)
                <a href="/~kennylevinsen/greetd/4" title="~kennylevinsen/greetd#4: Enabling LTO causes optimization failures">#4</a>  0x00007f73b80b4f0a _ZN10__cxxabiv111__terminateEPFvvE (libstdc++.so.6 + 0xb4f0a)
                <a href="/~kennylevinsen/greetd/5" title="~kennylevinsen/greetd#5: Figure out how to handle arbitrary PAM questions">#5</a>  0x00007f73b80b4f75 _ZSt9terminatev (libstdc++.so.6 + 0xb4f75)
                <a href="/~kennylevinsen/greetd/6" title="~kennylevinsen/greetd#6: Move some documentation into manpages">#6</a>  0x00007f73b80b51c7 __cxa_throw (libstdc++.so.6 + 0xb51c7)
                <a href="/~kennylevinsen/greetd/7" title="~kennylevinsen/greetd#7: Requested feature: Auto-login">#7</a>  0x00007f73b80ac756 _ZSt20__throw_system_errori (libstdc++.so.6 + 0xac756)
                <a href="/~kennylevinsen/greetd/8" title="~kennylevinsen/greetd#8: Support conv after open_session">#8</a>  0x00007f73b80e05c0 _ZNSt6thread4joinEv (libstdc++.so.6 + 0xe05c0)
                <a href="/~kennylevinsen/greetd/9" title="~kennylevinsen/greetd#9: Crash upon startup with ENOMEM">#9</a>  0x00007f73b86b3d46 _Z8identifyP10pam_handleiiPPKcb (pam_howdy.so + 0xcd46)
                <a href="/~kennylevinsen/greetd/10" title="~kennylevinsen/greetd#10: initial_session starts again if greeter terminates">#10</a> 0x00007f73b8769cbe _pam_dispatch (libpam.so.0 + 0x3cbe)
                <a href="/~kennylevinsen/greetd/11" title="~kennylevinsen/greetd#11: Login via greetd infra doesn&#39;t get recognized by w and who commands">#11</a> 0x00007f73b876966f pam_authenticate (libpam.so.0 + 0x366f)
                <a href="/~kennylevinsen/greetd/12" title="~kennylevinsen/greetd#12: greetd is stuck in crashloop if the user configured for initial session is locked">#12</a> 0x00005644a9e5ba41 _ZN6greetd4main28_$u7b$$u7b$closure$u7d$$u7d$17h220da801a4c25d49E (greetd + 0x2ea41)
                <a href="/~kennylevinsen/greetd/13" title="~kennylevinsen/greetd#13: Default config is read even when --config is used">#13</a> 0x00005644a9e57397 _ZN6greetd4main17h75a23768bd6843e3E (greetd + 0x2a397)
                <a href="/~kennylevinsen/greetd/14" title="~kennylevinsen/greetd#14: no key repeat in wlgreet">#14</a> 0x00005644a9e3fed4 _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7bf8c7c098f4166dE (greetd + 0x12ed4)
                <a href="/~kennylevinsen/greetd/15" title="~kennylevinsen/greetd#15: Allow setting PAM environment vars from greeter">#15</a> 0x00005644a9e5f531 main (greetd + 0x32531)
                <a href="/~kennylevinsen/greetd/16" title="~kennylevinsen/greetd#16: agreety: verbose errors, bug makes me unable to login under certain conditions">#16</a> 0x00007f73b842924e __libc_start_call_main (libc.so.6 + 0x2924e)
                <a href="/~kennylevinsen/greetd/17" title="~kennylevinsen/greetd#17: [Feature Request] Smooth transition from Plymouth ">#17</a> 0x00007f73b8429309 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x29309)
                <a href="/~kennylevinsen/greetd/18" title="~kennylevinsen/greetd#18: greetd segfaults [tuigreet keeps showing &#39;Please Wait...&#39;]">#18</a> 0x00005644a9e3bdd5 _start (greetd + 0xedd5)
                ELF object binary architecture: AMD x86-64
Status
REPORTED
Submitter
~fufexan
Assigned to
No-one
Submitted
1 year, 4 months ago
Updated
1 year, 4 months ago
Labels
No labels applied.

~fufexan 1 year, 4 months ago*

I guess the # turned into links, sorry about that.

Here's the same log in a file https://0x0.st/H-W_.dump.

~kennylevinsen 1 year, 4 months ago

There appears to be two issues here:

  1. When a greetd worker crashes, the login flow freezes.
  2. The greetd worker crashed when you used pam_howdy.

The stack suggests that pam_howdy, written in C++, throws an exception and aborts the process it is running in. This is not something we can (or should) handle, and so only the first of the issues is a greetd bug.

Regarding the crash cause, pam_howdy seems to be starting threads and having one of the joins fail. Getting the exception message might be helpful. If it went to stderr, you should be able to find it in greetd's log output. The crash cause may be that it expected something from the login manager, but regardless of the cause, pam modules should never crash.

Also note that having a PAM module spawn threads can be dangerous. Login managers need to fork, call various setup functions (some of which are not async-signal-safe), and then exec the final executable, but a multi-threaded program can only safely call async-signal-safe functions between fork and exec. It becomes the module authors responsibility that it is safe to call non-async-signal-safe functions after fork once conversation functions have returned.

Register here or Log in to comment, or comment via email.