summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2024-08-21 15:43:13 -0500
committerTDE Gitea <[email protected]>2024-08-29 16:00:36 +0000
commit37d12d8d467da6e869e33fce21adea1cd85af166 (patch)
tree52921419bc5bafba9f802048b9151fd4d73f9894
parentcc5cfd87c722572c90a6c051a6b7be4eadd1f02e (diff)
downloadtdebase-kdesktop_lock_hang_fix.tar.gz
tdebase-kdesktop_lock_hang_fix.zip
Fix kdesktop lock process hang / denial of servicekdesktop_lock_hang_fix
Under specific circumstances, kdesktop_lock may fail to engage the screen lock when requested. When this occurs, the user is typically present to observe and attempt relock, however the kdesktop_lock process may not respond once the lock has failed to engage and the process has not been restarted. Add a fallback handler for SIGHUP (lock engage) to the kdesktop_lock startup application thread. This ensures the process will always respond to a lock request regardless of lock process state. Signed-off-by: Timothy Pearson <[email protected]>
-rw-r--r--kdesktop/lock/lockprocess.cpp20
-rw-r--r--kdesktop/lock/lockprocess.h6
-rw-r--r--kdesktop/lock/main.cpp14
3 files changed, 37 insertions, 3 deletions
diff --git a/kdesktop/lock/lockprocess.cpp b/kdesktop/lock/lockprocess.cpp
index 0a343d88e..234327001 100644
--- a/kdesktop/lock/lockprocess.cpp
+++ b/kdesktop/lock/lockprocess.cpp
@@ -4,7 +4,7 @@
//
// Copyright (c) 1999 Martin R. Jones <[email protected]>
// Copyright (c) 2003 Oswald Buddenhagen <[email protected]>
-// Copyright (c) 2010 - 2015 Timothy Pearson <[email protected]>
+// Copyright (c) 2010 - 2024 Timothy Pearson <[email protected]>
//
//kdesktop keeps running and checks user inactivity
@@ -193,6 +193,9 @@ mHackDelayStartupTimer->stop();
//
LockProcess::LockProcess()
: TQWidget(0L, "saver window", ((WFlags)(WStyle_StaysOnTop|WStyle_Customize|WStyle_NoBorder))),
+ mInitialized(FALSE),
+ mLockPending(FALSE),
+ mLocked(FALSE),
mOpenGLVisual(0),
mParent(0),
mShowLockDateTime(false),
@@ -438,6 +441,8 @@ void LockProcess::init(bool child, bool useBlankOnly)
TQObject::connect(mControlPipeHandler, TQ_SIGNAL(processCommand(TQString)), this, TQ_SLOT(processInputPipeCommand(TQString)));
TQTimer::singleShot(0, mControlPipeHandler, TQ_SLOT(run()));
mControlPipeHandlerThread->start();
+
+ mInitialized = TRUE;
}
static int signal_pipe[2];
@@ -1477,6 +1482,13 @@ i18n("<i>kcheckpass</i> is unable to operate. Possibly it is not SetUID root.");
//
bool LockProcess::startLock()
{
+ mLockPending = TRUE;
+
+ if (!mInitialized) {
+ // Don't hang if we're not even initialized yet -- startLock() was triggered prematurely
+ return false;
+ }
+
for (TQStringList::ConstIterator it = mPlugins.begin(); it != mPlugins.end(); ++it) {
GreeterPluginHandle plugin;
TQString path = KLibLoader::self()->findLibrary( ((*it)[0] == '/' ? *it : "kgreet_" + *it ).latin1() );
@@ -1507,6 +1519,7 @@ bool LockProcess::startLock()
kdDebug(KDESKTOP_DEBUG_ID) << "GreeterPlugin " << *it << " (" << plugin.info->method << ", " << plugin.info->name << ") loaded" << endl;
greetPlugin = plugin;
mLocked = true;
+ mLockPending = FALSE;
DM().setLock( true );
return true;
}
@@ -1973,6 +1986,11 @@ static void fakeFocusIn( WId window )
XSendEvent( tqt_xdisplay(), window, False, NoEventMask, &ev );
}
+bool LockProcess::lockPending()
+{
+ return mLockPending;
+}
+
void LockProcess::resumeUnforced()
{
resume( false );
diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h
index bfe1fe420..e2a761963 100644
--- a/kdesktop/lock/lockprocess.h
+++ b/kdesktop/lock/lockprocess.h
@@ -4,7 +4,7 @@
//
// Copyright (c) 1999 Martin R. Jones <[email protected]>
// Copyright (c) 2003 Oswald Buddenhagen <[email protected]>
-// Copyright (c) 2010 - 2015 Timothy Pearson <[email protected]>
+// Copyright (c) 2010 - 2024 Timothy Pearson <[email protected]>
//
#ifndef __LOCKENG_H__
@@ -104,6 +104,8 @@ class LockProcess : public TQWidget
void msgBox( TQMessageBox::Icon type, const TQString &txt );
int execDialog( TQDialog* dlg );
+ bool lockPending();
+
TDECryptographicCardDevice* cryptographicCardDevice();
signals:
@@ -181,6 +183,8 @@ class LockProcess : public TQWidget
void generateBackingImages();
void fullyOnline();
+ bool mInitialized;
+ bool mLockPending;
bool mLocked;
int mLockGrace;
int mPriority;
diff --git a/kdesktop/lock/main.cpp b/kdesktop/lock/main.cpp
index f80f406a1..1abb107ad 100644
--- a/kdesktop/lock/main.cpp
+++ b/kdesktop/lock/main.cpp
@@ -1,7 +1,7 @@
/* This file is part of the TDE project
Copyright (C) 1999 David Faure
Copyright (c) 2003 Oswald Buddenhagen <[email protected]>
- Copyright (c) 2010-2015 Timothy Pearson <[email protected]>
+ Copyright (c) 2010-2024 Timothy Pearson <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -103,6 +103,12 @@ static void sigusr5_handler(int)
signalled_run = TRUE;
}
+static void sighup_handler(int)
+{
+ signalled_forcelock = TRUE;
+ signalled_run = TRUE;
+}
+
static int trapXErrors(Display *, XErrorEvent *)
{
return 0;
@@ -428,6 +434,12 @@ int main( int argc, char **argv )
sigaddset(&(act.sa_mask), SIGTTOU);
act.sa_flags = 0;
sigaction(SIGTTOU, &act, 0L);
+ // handle SIGHUP (force lock, fallback handler)
+ act.sa_handler= sighup_handler;
+ sigemptyset(&(act.sa_mask));
+ sigaddset(&(act.sa_mask), SIGHUP);
+ act.sa_flags = 0;
+ sigaction(SIGHUP, &act, 0L);
// initialize the signal masks
sigemptyset(&new_mask);