** Patch removed: "20261113-gdm-set-pending-query-unlock-crash.patch"
   
https://bugs.launchpad.net/bugs/2174396/+attachment/6017634/+files/20261113-gdm-set-pending-query-unlock-crash.patch

** Description changed:

  Ubuntu 26.04 (resolute), gdm3 50.1-0ubuntu0.1, authd 0.7.1~ubuntu26.04
  (ppa:ubuntu-enterprise-desktop/authd), authd-google 0.5.4 snap.
  
  On a production system, unlocking a locked Wayland session destroyed the
  entire session: the user typed the password at the lock screen, hit Enter,
  and was returned to the GDM greeter with all applications lost. The session
  had been running since boot (1w 15h).
  
  == Crash (apport core dump captured, full 253 MB core analysed) ==
  
  The session's gdm-session-worker (hosting the GdmSession/UserVerifier
  bridge used for screen unlocking) aborted at the unlock attempt:
  
      Gdm:ERROR:../daemon/gdm-session.c:771:set_pending_query: assertion
      failed: (conversation->pending_invocation == NULL)
      Bail out! Gdm:ERROR:... (SIGABRT, signal 6)
  
  Backtrace from the core:
  
      #5  g_assertion_message (glib/gtestutils.c:3478)
      #7  set_pending_query.part.0             daemon/gdm-session.c:771
      #8  set_pending_query                    daemon/gdm-session.c:899
      #9  gdm_session_handle_secret_info_query daemon/gdm-session.c:900
          service_name="gdm-authd", query="Password: "
      #15 _gdm_dbus_worker_manager_skeleton_handle_method_call
          method="SecretInfoQuery" on org.gnome.DisplayManager.WorkerManager
      #17 call_in_idle_cb -> g_main_loop_run -> main (session-worker-main.c)
  
  The still-pending invocation at the time of the abort was a
  CustomJSONRequest carrying authd's UI handshake:
  
      {"type":"request","request":{"type":"uiLayoutCapabilities",
       "uiLayoutCapabilities":{}}}
  
  == Root cause ==
  
  GdmSessionConversation has a single pending_invocation slot shared by ALL
  query types (InfoQuery, SecretInfoQuery, ChoiceListQuery and
  CustomJSONRequest), and answers are matched positionally, not per query
  (gdm_session_answer_query() is called from AnswerQuery, CustomJSON.Reply
  and AnswerChoiceListQuery alike and completes whatever invocation is
  pending).
  
  With authd, unlocking runs the authd gdm JSON handshake (hello,
  uiLayoutCapabilities, polls) concurrently with the PAM stack. When the
  local broker is selected, pam_authd returns PAM_IGNORE immediately
  (authd commands.go startBrokerSession: brokerID == local ->
  pam.ErrIgnore) without waiting for the in-flight JSON exchange, and
  pam_unix (common-auth) prompts "Password: ". The resulting
  SecretInfoQuery then arrives at the session worker while the
  uiLayoutCapabilities request is still pending, tripping the g_assert().
  The worker's death tears down the whole user session.
  
  The production machine was under heavy load (load average 21-27) which
  widened the race window.
  
  == Reproduction ==
  
  Deterministic reproducer on Ubuntu 26.04 (qemu/kvm VM, gdm3 50.1,
  authd 0.7.1 + authd-google 0.5.4 - production-identical configuration):
  
  The unlock flow reproduces the production pattern exactly
  (journal with GDM_DEBUG_JSON_REQUESTS=1):
  
      emitting custom JSON request: {"type":"hello"}
      emitting custom JSON request: {"type":"request","request":
          {"type":"uiLayoutCapabilities",...}}
      emitting custom JSON request: {"type":"poll"}
      received pam message of type 1 with payload 'Password: '
  
  A session worker build in which answer_pending_query() does not clear the
  slot - i.e. the exact stale state captured in the production core - aborts
  on every unlock with the identical assertion, kills the shell and restarts
  the session (verified: "Worker job died: 6", "session died with signal
  Aborted").
  
- == Proposed fix (attached patch) ==
+ == Proposed fix ==
+ 
+ The current patch is maintained in the upstream merge request, which is kept 
up to date there:
+ https://gitlab.gnome.org/GNOME/gdm/-/merge_requests/421
+ 
  
  - track custom JSON requests in their own pending_custom_json_invocation
    slot; CustomJSON.Reply and CustomJSON.ReportError complete that slot,
    keeping password/choice-list answers on pending_invocation
  - replace the g_assert() in set_pending_query() with a warning and
    cancelling the new query, so a racing query fails its PAM conversation
    instead of killing the session
  - guard answer_pending_query() against replies arriving with nothing
    pending (currently passes NULL to GDBus)
  
  Validated in the VM: with the patched worker, the exact conditions that
  abort the unpatched worker result in a warning, a cancelled query and a
  surviving session.
  
  == SRU justification ==
  
  - Impact: a routine action (unlocking the screen) can abort the session
    worker and destroy the user's whole desktop session; observed on a
    production system with a full core dump and journal.
  - The patch only separates the custom-JSON pending slot from the classic
    query slot and converts an abort into a cancelled query; normal
    password/fingerprint unlock flows are unchanged. Regression potential:
    low.
  - Test: reproduced crash in a VM with the unpatched worker under the same
    conditions; no crash and surviving session with the patched worker.
  
  == Notes ==
  
+ - Upstream issue: https://gitlab.gnome.org/GNOME/gdm/-/work_items/1113
  - Related upstream report: 
https://gitlab.gnome.org/GNOME/gdm/-/work_items/1110
    (unlock auth failures with fprintd, GNOME 51 - same general area,
    different symptom)
  - authd version is relevant: archive authd 0.6.1 handles unlock entirely
    via JSON and cannot hit this; authd 0.7.1 (ppa:ubuntu-enterprise-desktop/
    authd) takes the pam_unix path when the local broker is selected.

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gdm3 in Ubuntu.
https://bugs.launchpad.net/bugs/2174396

Title:
  gdm-session-worker aborts on unlock when authd CustomJSONRequest races
  with a password prompt (session destroyed)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/2174396/+subscriptions


-- 
desktop-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to