diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2014-09-14 10:30:13 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@gnugeneration.com> | 2014-09-14 10:30:13 -0700 |
commit | 7bcde781975ddf4a5ce266a9214ba26f563ed063 (patch) | |
tree | 46d39444ab8c0e6137c50e5d4f87bad66ae3863d /patches | |
parent | c9554e3a6a27802aea1206ec492727d616f23a0a (diff) |
Import of vwm3 changes from published source tgz
Major changes from vwm2 include:
- Introduction of integrated X client process and descendants
monitoring in the form of per-window composited overlays.
The rendering is done using the Composite, Damage, and Render
extensions. When the monitors are visible, vwm3 is a compositing
manager. When invisible, vwm3 continues to be an immediate-mode
classic X11 minimalist window manager.
Monitors are toggled via Mod1-;, Mod1-LeftArrow and Mod1-RightArrow
may be used to decrease and increase the sampling frequency,
respectively. Mod1-' clears the monitored tasks history for the
focused window when monitoring is visible.
This feature depends on the CONFIG_CHECKPOINT_RESTORE kernel
configuration option for the discovery of descendant processes.
Without this kernel option enabled, you'll only get a single process
monitored per window; the X client process as indicated by the
_NET_WM_PID atom of the window.
A library called libvmon has been introduced for the abstraction of
lightweight system and process statistics sampling.
Since vwm2 received backported features unrelated to monitoring or
compositing while vwm3 was developed, there isn't really much
difference between the two outside the monitoring context.
This isn't to say there isn't much activity in the code, the addition
of compositing and monitoring requires a substantial amount of code
relative to the scale of vwm[12].
Diffstat (limited to 'patches')
3 files changed, 168 insertions, 0 deletions
diff --git a/patches/linux-sched-implement-adopt-system-call.patch.txt b/patches/linux-sched-implement-adopt-system-call.patch.txt new file mode 100644 index 0000000..f8c6ec1 --- /dev/null +++ b/patches/linux-sched-implement-adopt-system-call.patch.txt @@ -0,0 +1,132 @@ +From 2d9f1781c6cdec8d74f44f98624af2eacbd21810 Mon Sep 17 00:00:00 2001 +From: Vito Caputo <vcaputo@gnugeneration.com> +Date: Mon, 10 Jun 2013 17:28:49 -0700 +Subject: [PATCH 1/1] sched: implement adopt() system call + + This implements a proposed facility for adopting a process + by another. The immediate use case is programs like GNU + screen which lose their parent-child relationship when + detached. Using this sytem call on reattach, the relation + can be restored, which is particularly of use to those + taking advantage of the /proc/$pid/task/$pid/children list + provided by CONFIG_CHECKPOINT_RESTORE. + + This implementation applies permission checks similar to + that of kill(), in addition to preventing the adoption of + an ancestor process. + + I have tested it and use the change myself to complement + process subtree monitoring, without which I lose all + visibility of the descendants of my screen sessions on + reattach. + +Signed-off-by: Vito Caputo <vcaputo@gnugeneration.com> +--- + arch/x86/syscalls/syscall_32.tbl | 1 + + arch/x86/syscalls/syscall_64.tbl | 1 + + include/linux/syscalls.h | 2 ++ + kernel/exit.c | 59 ++++++++++++++++++++++++++++++++++++++ + 4 files changed, 63 insertions(+) + +diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl +index aabfb83..d219781 100644 +--- a/arch/x86/syscalls/syscall_32.tbl ++++ b/arch/x86/syscalls/syscall_32.tbl +@@ -357,3 +357,4 @@ + 348 i386 process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev + 349 i386 kcmp sys_kcmp + 350 i386 finit_module sys_finit_module ++351 i386 adopt sys_adopt +diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl +index 38ae65d..6345ebf 100644 +--- a/arch/x86/syscalls/syscall_64.tbl ++++ b/arch/x86/syscalls/syscall_64.tbl +@@ -320,6 +320,7 @@ + 311 64 process_vm_writev sys_process_vm_writev + 312 common kcmp sys_kcmp + 313 common finit_module sys_finit_module ++314 common adopt sys_adopt + + # + # x32-specific system call numbers start at 512 to avoid cache impact +diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h +index 4147d70..3997cde 100644 +--- a/include/linux/syscalls.h ++++ b/include/linux/syscalls.h +@@ -841,4 +841,6 @@ asmlinkage long sys_process_vm_writev(pid_t pid, + asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type, + unsigned long idx1, unsigned long idx2); + asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags); ++ ++asmlinkage long sys_adopt(pid_t upid); + #endif +diff --git a/kernel/exit.c b/kernel/exit.c +index af2eb3c..5b554c8 100644 +--- a/kernel/exit.c ++++ b/kernel/exit.c +@@ -1681,3 +1681,62 @@ SYSCALL_DEFINE3(waitpid, pid_t, pid, int __user *, stat_addr, int, options) + } + + #endif ++ ++/* ++ * sys_adopt() adopts the process specified as upid by the current ++ * process if permitted. This is linux-specific and provided so ++ * programs such as GNU screen may restore the parent-child ++ * relationship lost in detaching when reattaching. ++ */ ++SYSCALL_DEFINE1(adopt, pid_t, upid) ++{ ++ long ret = -ENOENT; ++ struct pid *pid; ++ ++ if ((pid = find_get_pid(upid))) { ++ struct task_struct *p; ++ ++ rcu_read_lock(); ++ write_lock_irq(&tasklist_lock); ++ p = pid_task(pid, PIDTYPE_PID); ++ if (p) { ++ struct task_struct *t; ++ const struct cred *cred = current_cred(); ++ const struct cred *tcred = __task_cred(p); ++ ++ if (!uid_eq(cred->euid, tcred->suid) && ++ !uid_eq(cred->euid, tcred->uid) && ++ !uid_eq(cred->uid, tcred->suid) && ++ !uid_eq(cred->uid, tcred->uid) && ++ !ns_capable(cred->user_ns, CAP_KILL)) { ++ ret = -EPERM; ++ goto out_unlock; ++ } ++ ++ ++ /* upid cannot be current nor an ancestor of current */ ++ for (t = current;; t = t->real_parent) { ++ if (t == p) { ++ ret = -EINVAL; ++ goto out_unlock; ++ } ++ if (is_global_init(t)) ++ break; ++ } ++ ++ t = p; ++ do { ++ t->real_parent = current; ++ } while_each_thread(p, t); ++ ++ list_move_tail(&p->sibling, &p->real_parent->children); ++ ret = 0; ++ } /* else { ret = -ENOENT } */ ++out_unlock: ++ write_unlock_irq(&tasklist_lock); ++ rcu_read_unlock(); ++ put_pid(pid); ++ } /* else { ret = -ENOENT } */ ++ ++ return ret; ++} +-- +1.7.10.4 + diff --git a/patches/screen-4.0.3-sys_adopt-on-attach.patch.txt b/patches/screen-4.0.3-sys_adopt-on-attach.patch.txt new file mode 100644 index 0000000..e729771 --- /dev/null +++ b/patches/screen-4.0.3-sys_adopt-on-attach.patch.txt @@ -0,0 +1,13 @@ +diff -u screen-4.0.3/attacher.c screen-4.0.3-sysadopt/attacher.c +--- screen-4.0.3/attacher.c 2013-06-08 02:46:54.000000000 -0700 ++++ screen-4.0.3-sysadopt/attacher.c 2013-06-08 02:44:51.000000000 -0700 +@@ -379,6 +379,9 @@ + } + #endif + rflag = 0; ++ ++ /* adopt the master process */ ++ syscall(314, MasterPid); + return 1; + } + diff --git a/patches/xorg-server-1.12.4-6+deb7u2-net-wm-pid-set-for-local-clients.patch.txt b/patches/xorg-server-1.12.4-6+deb7u2-net-wm-pid-set-for-local-clients.patch.txt new file mode 100644 index 0000000..3c12fd2 --- /dev/null +++ b/patches/xorg-server-1.12.4-6+deb7u2-net-wm-pid-set-for-local-clients.patch.txt @@ -0,0 +1,23 @@ +--- xorg-server-1.12.4/dix/window.c 2012-05-17 10:09:02.000000000 -0700 ++++ xorg-server-1.12.4.hacked/dix/window.c 2014-06-04 18:54:33.570855708 -0700 +@@ -840,6 +840,20 @@ + event.u.createNotify.override = pWin->overrideRedirect; + DeliverEvents(pParent, &event, 1, NullWindow); + } ++ ++ if (pScreen->root == pParent) { ++ /* top-level windows with local connections can reliably get _NET_WM_PID set by the server */ ++ LocalClientCredRec *lcc; ++ if (GetLocalClientCreds(client, &lcc) != -1) ++ if (lcc->fieldsSet & LCC_PID_SET) { ++ Atom prop; ++ ++ prop = MakeAtom("_NET_WM_PID", strlen("_NET_WM_PID"), TRUE); ++ dixChangeWindowProperty(client, pWin, prop, ++ XA_CARDINAL, 32, PropModeReplace, ++ 1, &lcc->pid, FALSE); ++ } ++ } + return pWin; + } + |