[prev in list] [next in list] [prev in thread] [next in thread]
List: kwin
Subject: Re: Review Request: Make KWin able to kill frozen clients using
From: "Mikael Gerdin" <mikael.gerdin () gmail ! com>
Date: 2011-03-06 21:11:05
Message-ID: 20110306211105.23055.97009 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On March 6, 2011, 6:19 p.m., Martin Gräßlin wrote:
> > I just tried to push the patch, but it does not apply to kwin any more. Could you \
> > please post a new patch? Thanks in advance :-)
This reviewboard won't accept the git diff i created, so I'll just post the damned \
diff here... This should apply cleanly. Sorry for not keeping up with this, I've had \
a lot to do.
commit 8ddcbbdcbf1a047d25d60c97926fc87796571b5e
Author: Mikael Gerdin <mikael.gerdin@gmail.com>
Date: Sat Feb 5 13:25:20 2011 +0100
Add KAuth support to KWin process killer
diff --git a/kwin/killer/killer.cpp b/kwin/killer/killer.cpp
index 581c60c..d37a654 100644
--- a/kwin/killer/killer.cpp
+++ b/kwin/killer/killer.cpp
@@ -26,11 +26,14 @@ DEALINGS IN THE SOFTWARE.
#include <kapplication.h>
#include <kmessagebox.h>
#include <klocale.h>
+#include <kauth.h>
+#include <kdebug.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <QX11Info>
#include <QProcess>
#include <signal.h>
+#include <errno.h>
int main(int argc, char* argv[])
{
@@ -75,8 +78,20 @@ int main(int argc, char* argv[])
QStringList lst;
lst << hostname << "kill" << QString::number(pid);
QProcess::startDetached("xon", lst);
- } else
- ::kill(pid, SIGKILL);
- XKillClient(QX11Info::display(), id);
+ } else {
+ if (::kill(pid, SIGKILL) && errno == EPERM) {
+ KAuth::Action \
killer("org.kde.ksysguard.processlisthelper.sendsignal"); + \
killer.setHelperID("org.kde.ksysguard.processlisthelper"); + \
killer.addArgument("pid0", pid); + killer.addArgument("pidcount", 1);
+ killer.addArgument("signal", SIGKILL);
+ if (killer.isValid()) {
+ kDebug(1212) << "Using KAuth to kill pid: " << pid;
+ killer.execute();
+ } else {
+ kDebug(1212) << "KWin process killer action not valid";
+ }
+ }
+ }
}
}
- Mikael
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/4460/#review9961
-----------------------------------------------------------
On June 26, 2010, 3:05 p.m., Mikael Gerdin wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/4460/
> -----------------------------------------------------------
>
> (Updated June 26, 2010, 3:05 p.m.)
>
>
> Review request for kwin.
>
>
> Summary
> -------
>
> Makes KWin's window killer able to kill processes running as other users.
> I just re-used the code used in krunner's (and ksysguard's) process lister
> to kill processes using elevated privileges.
>
> As it works now it only tries to use elevated privileges if kill returns EPERM.
>
>
> This addresses bug 129476.
> https://bugs.kde.org/show_bug.cgi?id=129476
>
>
> Diffs
> -----
>
> /trunk/KDE/kdebase/workspace/kwin/killer/killer.cpp 1143106
>
> Diff: http://svn.reviewboard.kde.org/r/4460/diff
>
>
> Testing
> -------
>
> Manual testing by calling the helper app manually and by making a
> root-owned X window hang and click the "X" to make kwin try to kill it.
>
>
> Thanks,
>
> Mikael
>
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://svn.reviewboard.kde.org/r/4460/">http://svn.reviewboard.kde.org/r/4460/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On March 6th, 2011, 6:19 p.m., <b>Martin \
Gräßlin</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;"> <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">I just tried to push the patch, but it does not apply to kwin any more. \
Could you please post a new patch? Thanks in advance :-)</pre> </blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This reviewboard \
won't accept the git diff i created, so I'll just post the damned diff \
here... This should apply cleanly. Sorry for not keeping up with this, I've had a \
lot to do.
commit 8ddcbbdcbf1a047d25d60c97926fc87796571b5e
Author: Mikael Gerdin <mikael.gerdin@gmail.com>
Date: Sat Feb 5 13:25:20 2011 +0100
Add KAuth support to KWin process killer
diff --git a/kwin/killer/killer.cpp b/kwin/killer/killer.cpp
index 581c60c..d37a654 100644
--- a/kwin/killer/killer.cpp
+++ b/kwin/killer/killer.cpp
@@ -26,11 +26,14 @@ DEALINGS IN THE SOFTWARE.
#include <kapplication.h>
#include <kmessagebox.h>
#include <klocale.h>
+#include <kauth.h>
+#include <kdebug.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <QX11Info>
#include <QProcess>
#include <signal.h>
+#include <errno.h>
int main(int argc, char* argv[])
{
@@ -75,8 +78,20 @@ int main(int argc, char* argv[])
QStringList lst;
lst << hostname << "kill" << \
QString::number(pid); QProcess::startDetached("xon", lst);
- } else
- ::kill(pid, SIGKILL);
- XKillClient(QX11Info::display(), id);
+ } else {
+ if (::kill(pid, SIGKILL) && errno == EPERM) {
+ KAuth::Action \
killer("org.kde.ksysguard.processlisthelper.sendsignal"); + \
killer.setHelperID("org.kde.ksysguard.processlisthelper"); + \
killer.addArgument("pid0", pid); + \
killer.addArgument("pidcount", 1); + \
killer.addArgument("signal", SIGKILL); + if \
(killer.isValid()) { + kDebug(1212) << "Using KAuth to \
kill pid: " << pid; + killer.execute();
+ } else {
+ kDebug(1212) << "KWin process killer action not \
valid"; + }
+ }
+ }
}
}</pre>
<br />
<p>- Mikael</p>
<br />
<p>On June 26th, 2010, 3:05 p.m., Mikael Gerdin wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://svn.reviewboard.kde.orgrb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for kwin.</div>
<div>By Mikael Gerdin.</div>
<p style="color: grey;"><i>Updated June 26, 2010, 3:05 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Makes KWin's window killer able to kill processes running as other \
users. I just re-used the code used in krunner's (and ksysguard's) process \
lister to kill processes using elevated privileges.
As it works now it only tries to use elevated privileges if kill returns EPERM.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Manual testing by calling the helper app manually and by making a \
root-owned X window hang and click the "X" to make kwin try to kill \
it.</pre> </td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://bugs.kde.org/show_bug.cgi?id=129476">129476</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/KDE/kdebase/workspace/kwin/killer/killer.cpp <span style="color: \
grey">(1143106)</span></li>
</ul>
<p><a href="http://svn.reviewboard.kde.org/r/4460/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic