Clear lockRequested latch on lock() so later lock() actually locks - #8
Open
kvnloo wants to merge 1 commit into
Open
Clear lockRequested latch on lock() so later lock() actually locks#8kvnloo wants to merge 1 commit into
kvnloo wants to merge 1 commit into
Conversation
When a lock request stalls after setting lockRequested=true but never reaches sessionLock.locked or sessionLock.secure, the latch stays true forever. Because root.locked derives from lockRequested, the IPC lock() method then short-circuits and returns 'ok' without ever calling beginLock(), making every subsequent lock attempt a silent no-op. This is a security issue: the machine can suspend unlocked because the lid-close lock handler receives 'ok' from a latched-stuck request that never actually locks. The fix detects a stalled lock state in the IPC lock() handler: when lockRequested is true but the session is neither locked nor secure, clear the latch and associated timers before checking root.locked. This ensures beginLock() gets called for a fresh lock attempt. Adds test/shell.d/lock-requested-latch-test.sh to verify the latch is cleared and timers are stopped before retrying the lock. Fixes omacom#10299 Co-authored-by: Kevin Rajan <kvnloo@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a security issue where a stalled lock request prevents all subsequent lock attempts, allowing the machine to suspend unlocked.
Problem
When
lock()is called andlockRequestedis set totruebut the session never reachessessionLock.lockedorsessionLock.secure(the lock stalls),lockRequestedstays latchedtrueforever. Becauseroot.lockedderives fromlockRequested || sessionLock.locked || sessionLock.secure, the IPClock()method's guardif (!root.locked && !root.beginLock())short-circuits on!root.lockedbeing false, sobeginLock()is never called again. The method returns"ok"without actually locking.This makes every subsequent lock attempt a silent no-op. The lid-close lock handler receives
"ok"and proceeds as if the session is locked, allowing the machine to suspend with the session fully exposed. On resume, Hyprland shows its crashed-lockscreen failsafe.Solution
Before checking
root.locked, detect a stalled lock state: whenlockRequestedistruebut the session is neitherlockednorsecure, clear the latch and stop the associated timers. This ensuresbeginLock()gets called for a fresh lock attempt.The fix is minimal and surgical: it only resets state when a lock is demonstrably stalled (requested but not materialized), and does so immediately before the retry.
Changes
shell/plugins/lock/Service.qml: Add stall detection in the IPClock()handler to clearlockRequested,pendingSessionLock, and stop both timers when the lock is stucktest/shell.d/lock-requested-latch-test.sh: New test verifying the latch-clearing behaviorTesting
lock-requested-latch-test.shpasses, verifying all latch-reset conditionslock-stranded-recovery-test.sh,system-lock-test.sh,sleep-lock-test.shRelated
Fixes omacom#10299
Adjacent PRs omacom#7169, omacom#8930, omacom#9429 address other lock lifecycle issues but do not fix this latch behavior.