neuter all kvm(3) calls until a proper fix is found. this allows

gnome-system-monitor to report net/disk usage again instead of simply dumping core
This commit is contained in:
jasper 2017-11-08 15:26:12 +00:00
parent ad0d1296d0
commit f141583332
16 changed files with 246 additions and 5 deletions

View File

@ -1,10 +1,14 @@
# $OpenBSD: Makefile,v 1.138 2017/11/03 11:22:11 jasper Exp $
# $OpenBSD: Makefile,v 1.139 2017/11/08 15:26:12 jasper Exp $
# All patches annotated with XXKVM are to prevent any kvm(3) which
# results in an abort() for the caller.
COMMENT= portable library for obtaining system information
GNOME_VERSION= 2.38.0
GNOME_PROJECT= libgtop
PKGNAME= libgtop2-${VERSION}
REVISION= 0
SHARED_LIBS= gtop-2.0 10.0 # .10.0

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sysdeps_openbsd_msg_limits_c,v 1.1 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/msg_limits.c
--- sysdeps/openbsd/msg_limits.c.orig
+++ sysdeps/openbsd/msg_limits.c
@@ -58,6 +58,9 @@ static struct nlist nlst [] = {
void
_glibtop_init_msg_limits_p (glibtop *server)
{
+ /* XXXKVM */
+ return;
+
if (kvm_nlist (server->machine->kd, nlst) < 0) {
glibtop_warn_io_r (server, "kvm_nlist (msg_limits)");
return;

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-sysdeps_openbsd_ppp_c,v 1.1 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/ppp.c
--- sysdeps/openbsd/ppp.c.orig
+++ sysdeps/openbsd/ppp.c
@@ -68,6 +68,9 @@ static struct nlist nlst [] = {
void
_glibtop_init_ppp_p (glibtop *server)
{
+ /* XXXKVM */
+ return;
+
#ifdef HAVE_I4B
#ifdef HAVE_I4B_ACCT
server->sysdeps.ppp = _glibtop_sysdeps_ppp |
@@ -97,6 +100,9 @@ glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf,
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PPP), 0);
memset (buf, 0, sizeof (glibtop_ppp));
+
+ /* XXXKVM */
+ return;
if (kvm_read (server->machine->kd, nlst [0].n_value,
&data, sizeof (data)) != sizeof (data))

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sysdeps_openbsd_procargs_c,v 1.13 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/procargs.c
--- sysdeps/openbsd/procargs.c.orig
+++ sysdeps/openbsd/procargs.c
@@ -59,6 +59,9 @@ glibtop_get_proc_args_p (glibtop *server, glibtop_proc
/* Ignore init */
if (pid < 2) return NULL;
+ /* XXXKVM */
+ return NULL;
+
glibtop_suid_enter (server);
/* Get the process data */

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sysdeps_openbsd_prockernel_c,v 1.16 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/prockernel.c
--- sysdeps/openbsd/prockernel.c.orig
+++ sysdeps/openbsd/prockernel.c
@@ -69,6 +69,9 @@ glibtop_get_proc_kernel_p (glibtop *server,
/* It does not work for the swapper task. */
if (pid == 0) return;
+ /* XXXKVM */
+ return;
+
glibtop_suid_enter (server);
/* Get the process information */

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sysdeps_openbsd_proclist_c,v 1.6 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/proclist.c
--- sysdeps/openbsd/proclist.c.orig
+++ sysdeps/openbsd/proclist.c
@@ -69,6 +69,9 @@ glibtop_get_proclist_p (glibtop *server, glibtop_procl
memset (buf, 0, sizeof (glibtop_proclist));
+ /* XXXKVM */
+ return NULL;
+
which = (int)(real_which & GLIBTOP_KERN_PROC_MASK);
/* Get the process data */

View File

@ -1,11 +1,22 @@
$OpenBSD: patch-sysdeps_openbsd_procmem_c,v 1.9 2017/04/17 09:46:45 espie Exp $
--- sysdeps/openbsd/procmem.c.orig Sun Apr 16 14:05:33 2017
+++ sysdeps/openbsd/procmem.c Sun Apr 16 14:17:23 2017
$OpenBSD: patch-sysdeps_openbsd_procmem_c,v 1.10 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/procmem.c
--- sysdeps/openbsd/procmem.c.orig
+++ sysdeps/openbsd/procmem.c
@@ -42,6 +42,7 @@
/* XXX until uvm gets cleaned up */
#include <sys/mutex.h>
typedef int boolean_t;
+#define RBT_PROTOTYPE(a, b, c, d) extern int nope
+#define RBT_PROTOTYPE(a, b, c, d) extern int nope
#include <uvm/uvm.h>
/* Fixme ... */
@@ -111,6 +112,9 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_
/* It does not work for the swapper task. */
if (pid == 0) return;
+
+ /* XXXKVM */
+ return;
/* Get the process data */
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid,

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sysdeps_openbsd_procopenfiles_c,v 1.10 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/procopenfiles.c
--- sysdeps/openbsd/procopenfiles.c.orig
+++ sysdeps/openbsd/procopenfiles.c
@@ -102,6 +102,9 @@ glibtop_get_proc_open_files_s (glibtop *server, glibto
memset(buf, 0, sizeof (glibtop_proc_open_files));
+ /* XXXKVM */
+ return NULL;
+
if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, kbuf)) == NULL)
g_warning("%s", kbuf);

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sysdeps_openbsd_procsegment_c,v 1.7 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/procsegment.c
--- sysdeps/openbsd/procsegment.c.orig
+++ sysdeps/openbsd/procsegment.c
@@ -62,6 +62,9 @@ glibtop_get_proc_segment_p (glibtop *server,
/* It does not work for the swapper task. */
if (pid == 0) return;
+ /* XXXKVM */
+ return;
+
/* Get the process info from the kernel */
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid,
sizeof (*pinfo), &count);

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sysdeps_openbsd_procsignal_c,v 1.9 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/procsignal.c
--- sysdeps/openbsd/procsignal.c.orig
+++ sysdeps/openbsd/procsignal.c
@@ -57,6 +57,9 @@ glibtop_get_proc_signal_p (glibtop *server,
/* It does not work for the swapper task. */
if (pid == 0) return;
+ /* XXXKVM */
+ return;
+
/* Get the process information */
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid,
sizeof (*pinfo), &count);

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sysdeps_openbsd_procstate_c,v 1.9 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/procstate.c
--- sysdeps/openbsd/procstate.c.orig
+++ sysdeps/openbsd/procstate.c
@@ -59,6 +59,9 @@ glibtop_get_proc_state_p (glibtop *server,
/* It does not work for the swapper task. */
if (pid == 0) return;
+ /* XXXKVM */
+ return;
+
/* Get the process information */
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid,
sizeof (*pinfo), &count);

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-sysdeps_openbsd_proctime_c,v 1.12 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/proctime.c
--- sysdeps/openbsd/proctime.c.orig
+++ sysdeps/openbsd/proctime.c
@@ -72,6 +72,8 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc
/* It does not work for the swapper task. */
if (pid == 0) return;
+ /* XXXKVM */
+ return;
/* Get the process information */
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid,

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sysdeps_openbsd_procuid_c,v 1.9 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/procuid.c
--- sysdeps/openbsd/procuid.c.orig
+++ sysdeps/openbsd/procuid.c
@@ -62,6 +62,9 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_
/* It does not work for the swapper task. */
if (pid == 0) return;
+ /* XXXKVM */
+ return;
+
/* Get the process information */
pinfo = kvm_getprocs (server->machine->kd, KERN_PROC_PID, pid,
sizeof (*pinfo), &count);

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sysdeps_openbsd_sem_limits_c,v 1.1 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/sem_limits.c
--- sysdeps/openbsd/sem_limits.c.orig
+++ sysdeps/openbsd/sem_limits.c
@@ -56,6 +56,9 @@ static struct nlist nlst [] = {
void
_glibtop_init_sem_limits_p (glibtop *server)
{
+ /* XXXKVM */
+ return;
+
if (kvm_nlist (server->machine->kd, nlst) < 0) {
glibtop_warn_io_r (server, "kvm_nlist (sem_limits)");
return;

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sysdeps_openbsd_shm_limits_c,v 1.1 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/shm_limits.c
--- sysdeps/openbsd/shm_limits.c.orig
+++ sysdeps/openbsd/shm_limits.c
@@ -50,6 +50,9 @@ static struct nlist nlst [] = {
void
_glibtop_init_shm_limits_p (glibtop *server)
{
+ /* XXXKVM */
+ return;
+
if (kvm_nlist (server->machine->kd, nlst) < 0) {
glibtop_warn_io_r (server, "kvm_nlist (shm_limits)");
return;

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-sysdeps_openbsd_suid_open_c,v 1.7 2017/11/08 15:26:12 jasper Exp $
Index: sysdeps/openbsd/suid_open.c
--- sysdeps/openbsd/suid_open.c.orig
+++ sysdeps/openbsd/suid_open.c
@@ -68,12 +68,14 @@ glibtop_open_p (glibtop *server, const char *program_n
server->machine->euid = geteuid ();
server->machine->gid = getgid ();
server->machine->egid = getegid ();
+/* XXXKVM */
+#if 0
/* Setup machine-specific data */
server->machine->kd = kvm_openfiles (NULL, NULL, NULL, O_RDONLY, errbuf);
if (server->machine->kd == NULL)
- glibtop_error_io_r (server, "kvm_open");
-
+ glibtop_error_io_r (server, "kvm_openfiles");
+#endif
/* Drop priviledges. */
if (setreuid (server->machine->euid, server->machine->uid))