aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2021-06-10 07:37:09 +0200
committerDaniel Lange <DLange@git.local>2021-06-10 07:37:09 +0200
commit423169e635c222e549e3c8d989d3f1f3576c117d (patch)
treef9e0ef5df116f19752c1304225fc8777b256b442
parent37d8824862a2f6b9375022e1c45ba4548162650f (diff)
downloaddebian_htop-423169e635c222e549e3c8d989d3f1f3576c117d.tar.gz
debian_htop-423169e635c222e549e3c8d989d3f1f3576c117d.tar.bz2
debian_htop-423169e635c222e549e3c8d989d3f1f3576c117d.zip
Some fixes for Bullseye htop 3.0.5-x
-rw-r--r--debian/patches/0100-update-uid-on-change.patch62
-rw-r--r--debian/patches/0101-drop-o-path-usage.patch38
-rw-r--r--debian/patches/series2
3 files changed, 102 insertions, 0 deletions
diff --git a/debian/patches/0100-update-uid-on-change.patch b/debian/patches/0100-update-uid-on-change.patch
new file mode 100644
index 0000000..04a7d8f
--- /dev/null
+++ b/debian/patches/0100-update-uid-on-change.patch
@@ -0,0 +1,62 @@
+From ca8ae00cbe03924f05903ec432f91c73893472d4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
+Date: Wed, 9 Jun 2021 11:13:39 +0200
+Subject: [PATCH] Linux: update process uid on change
+
+Always check if the user of a process changed, e.g. by using setuid(2).
+---
+ Process.c | 1 +
+ linux/LinuxProcessList.c | 17 ++++++++++-------
+ 2 files changed, 11 insertions(+), 7 deletions(-)
+
+--- a/linux/LinuxProcessList.c
++++ b/linux/LinuxProcessList.c
+@@ -366,7 +366,7 @@
+ }
+
+
+-static bool LinuxProcessList_statProcessDir(Process* process, openat_arg_t procFd) {
++static bool LinuxProcessList_updateUser(ProcessList* processList, Process* process, openat_arg_t procFd) {
+ struct stat sstat;
+ #ifdef HAVE_OPENAT
+ int statok = fstat(procFd, &sstat);
+@@ -375,7 +375,12 @@
+ #endif
+ if (statok == -1)
+ return false;
+- process->st_uid = sstat.st_uid;
++
++ if (process->st_uid != sstat.st_uid) {
++ process->st_uid = sstat.st_uid;
++ process->user = UsersTable_getRef(processList->usersTable, sstat.st_uid);
++ }
++
+ return true;
+ }
+
+@@ -1383,12 +1388,10 @@
+ proc->percent_cpu = CLAMP(percent_cpu, 0.0F, cpus * 100.0F);
+ proc->percent_mem = proc->m_resident / (double)(pl->totalMem) * 100.0;
+
+- if (!preExisting) {
+-
+- if (! LinuxProcessList_statProcessDir(proc, procFd))
+- goto errorReadingProcess;
++ if (! LinuxProcessList_updateUser(pl, proc, procFd))
++ goto errorReadingProcess;
+
+- proc->user = UsersTable_getRef(pl->usersTable, proc->st_uid);
++ if (!preExisting) {
+
+ #ifdef HAVE_OPENVZ
+ if (settings->flags & PROCESS_FLAG_LINUX_OPENVZ) {
+--- a/Process.c
++++ b/Process.c
+@@ -436,6 +436,7 @@
+ this->show = true;
+ this->updated = false;
+ this->basenameOffset = -1;
++ this->st_uid = (uid_t)-1;
+
+ if (Process_getuid == (uid_t)-1) {
+ Process_getuid = getuid();
diff --git a/debian/patches/0101-drop-o-path-usage.patch b/debian/patches/0101-drop-o-path-usage.patch
new file mode 100644
index 0000000..969d727
--- /dev/null
+++ b/debian/patches/0101-drop-o-path-usage.patch
@@ -0,0 +1,38 @@
+From d8e81ab747e96cb687e8d6981ef4a0fb58050884 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
+Date: Wed, 9 Jun 2021 10:55:22 +0200
+Subject: [PATCH] Linux: drop O_PATH usage
+
+O_PATH is available since Linux 2.6.39, but we are using fstat(2) on the
+returned file descriptor in LinuxProcessList_statProcessDir(), which
+is only supported since Linux 3.6.
+
+Fixes #534
+---
+ linux/LinuxProcessList.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+--- a/linux/LinuxProcessList.c
++++ b/linux/LinuxProcessList.c
+@@ -58,12 +58,6 @@
+ #endif
+
+
+-// CentOS 6's kernel doesn't provide a definition of O_PATH
+-// based on definition taken from uapi/asm-generic/fcnth.h in Linux kernel tree
+-#ifndef O_PATH
+-# define O_PATH 010000000
+-#endif
+-
+ static long long btime = -1;
+
+ static long jiffy;
+@@ -1313,7 +1307,7 @@
+ proc->tgid = parent ? parent->pid : pid;
+
+ #ifdef HAVE_OPENAT
+- int procFd = openat(dirFd, entry->d_name, O_PATH | O_DIRECTORY | O_NOFOLLOW);
++ int procFd = openat(dirFd, entry->d_name, O_RDONLY | O_DIRECTORY | O_NOFOLLOW);
+ if (procFd < 0)
+ goto errorReadingProcess;
+ #else
diff --git a/debian/patches/series b/debian/patches/series
index 9ab8f3d..f8e08e4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -14,3 +14,5 @@
0014-fix-zfs-coloring.patch
0015-clean-infoscreen-before-new-scan.patch
0016-fix-div-by-zero-zfscompressedarcmeter.patch
+0100-update-uid-on-change.patch
+0101-drop-o-path-usage.patch

© 2014-2024 Faster IT GmbH | imprint | privacy policy