From d070a65f216eba1256c456505aadb48b676e1390 Mon Sep 17 00:00:00 2001 From: AlmaLinux RelEng Bot Date: Tue, 19 May 2026 18:41:01 -0400 Subject: [PATCH] import UBI procps-ng-4.0.4-11.el10 --- free-manpage-overcommit-note.patch | 23 +++++++++++ procps-ng.spec | 20 +++++++++- ps-etime-overflow.patch | 30 ++++++++++++++ sysctl-succ-on-fail.patch | 48 +++++++++++++++++++++++ uptime-w-user-sessions-only.patch | 63 ++++++++++++++++++++++++++++++ 5 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 free-manpage-overcommit-note.patch create mode 100644 ps-etime-overflow.patch create mode 100644 sysctl-succ-on-fail.patch create mode 100644 uptime-w-user-sessions-only.patch diff --git a/free-manpage-overcommit-note.patch b/free-manpage-overcommit-note.patch new file mode 100644 index 0000000..4a8fc07 --- /dev/null +++ b/free-manpage-overcommit-note.patch @@ -0,0 +1,23 @@ +commit 9a8dc789e83b869ef8c56cc94741dbc3a191f55b +Author: Jan Rybar +Date: Tue Oct 28 06:37:03 2025 +0000 + + free manpage: note on negative value with overcommitt enabled + +diff --git a/man/free.1 b/man/free.1 +index 02dae847..3816754a 100644 +--- a/man/free.1 ++++ b/man/free.1 +@@ -142,7 +142,11 @@ Display a line showing the column totals. + \fB\-v\fR, \fB\-\-committed\fR + Display a line showing the memory commit limit and amount of committed/uncommitted + memory. The \fBtotal\fR column on this line will display the memory commit +-limit. This line is relevant if memory overcommit is disabled. ++limit. This line is relevant if memory overcommit is disabled. On systems ++with memory overcommit enabled, the \fBfree\fR value can temporarily appear ++negative. This is not a bug, but an effect of overcommit, as the system has promised ++more memory than the total of its virtual address space. ++The negative value indicates the magnitude of the system's memory over-allocation. + .TP + \fB\-\-help\fR + Print help. diff --git a/procps-ng.spec b/procps-ng.spec index 4836ab7..88f0ac1 100644 --- a/procps-ng.spec +++ b/procps-ng.spec @@ -4,7 +4,7 @@ Summary: System and process monitoring utilities Name: procps-ng Version: 4.0.4 -Release: 8%{?dist} +Release: 11%{?dist} License: GPL-2.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later URL: https://sourceforge.net/projects/procps-ng/ @@ -12,6 +12,10 @@ Source0: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz Patch1: osh-findings.patch Patch2: top-fix-guest-tics.patch +Patch3: free-manpage-overcommit-note.patch +Patch4: sysctl-succ-on-fail.patch +Patch5: ps-etime-overflow.patch +Patch6: uptime-w-user-sessions-only.patch BuildRequires: make BuildRequires: ncurses-devel @@ -148,6 +152,20 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof %files i18n -f %{name}.lang %changelog +* Thu Jan 15 2026 Jan Rybar - 4.0.4-11 +- ps: etime overflow reappeared with rewritten library +- uptime, w: report user sessions only; upstream backport of 734930e47 +- Resolves: RHEL-60826 +- Resolves: RHEL-141839 + +* Thu Dec 04 2025 Jan Rybar - 4.0.4-10 +- sysctl: returns success even on fail bug +- Resolves: RHEL-84138 + +* Wed Oct 29 2025 Jan Rybar - 4.0.4-9 +- free manpage: expand note on negative value with overcommit +- Resolves: RHEL-100973 + * Wed Apr 16 2025 Jan Rybar - 4.0.4-8 - fix guest tics (backport upstr patch e1df029e6, 3fb34669) - Resolves: RHEL-84051 diff --git a/ps-etime-overflow.patch b/ps-etime-overflow.patch new file mode 100644 index 0000000..f8aa979 --- /dev/null +++ b/ps-etime-overflow.patch @@ -0,0 +1,30 @@ +diff --git a/library/pids.c b/library/pids.c +index 41673b5..f9f4f8f 100644 +--- a/library/pids.c ++++ b/library/pids.c +@@ -284,13 +284,13 @@ REG_set(TICS_USER, ull_int, utime) + setDECL(TICS_USER_C) { (void)I; R->result.ull_int = P->utime + P->cutime; } + setDECL(TIME_ALL) { R->result.real = ((double)P->utime + P->stime) / I->hertz; } + setDECL(TIME_ALL_C) { R->result.real = ((double)P->utime + P->stime + P->cutime + P->cstime) / I->hertz; } +-setDECL(TIME_ELAPSED) { double t = I->boot_tics - P->start_time; if (t > 0) R->result.real = t / I->hertz; } ++setDECL(TIME_ELAPSED) { double t = (double)I->boot_tics - P->start_time; if (t > 0) R->result.real = t / I->hertz; } + setDECL(TIME_START) { R->result.real = (double)P->start_time / I->hertz; } + REG_set(TTY, s_int, tty) + setDECL(TTY_NAME) { char buf[64]; freNAME(str)(R); dev_to_tty(buf, sizeof(buf), P->tty, P->tid, ABBREV_DEV); if (!(R->result.str = strdup(buf))) I->seterr = 1; } + setDECL(TTY_NUMBER) { char buf[64]; freNAME(str)(R); dev_to_tty(buf, sizeof(buf), P->tty, P->tid, ABBREV_DEV|ABBREV_TTY|ABBREV_PTS); if (!(R->result.str = strdup(buf))) I->seterr = 1; } +-setDECL(UTILIZATION) { double t = I->boot_tics - P->start_time; if (t > 0) R->result.real = ((P->utime + P->stime) * 100.0f) / t; } +-setDECL(UTILIZATION_C) { double t = I->boot_tics - P->start_time; if (t > 0) R->result.real = ((P->utime + P->stime + P->cutime + P->cstime) * 100.0f) / t; } ++setDECL(UTILIZATION) { double t = (double)I->boot_tics - P->start_time; if (t > 0) R->result.real = ((P->utime + P->stime) * 100.0f) / t; } ++setDECL(UTILIZATION_C) { double t = (double)I->boot_tics - P->start_time; if (t > 0) R->result.real = ((P->utime + P->stime + P->cutime + P->cstime) * 100.0f) / t; } + REG_set(VM_DATA, ul_int, vm_data) + REG_set(VM_EXE, ul_int, vm_exe) + REG_set(VM_LIB, ul_int, vm_lib) +@@ -304,7 +304,7 @@ REG_set(VM_STACK, ul_int, vm_stack) + REG_set(VM_SWAP, ul_int, vm_swap) + setDECL(VM_USED) { (void)I; R->result.ul_int = P->vm_swap + P->vm_rss; } + REG_set(VSIZE_BYTES, ul_int, vsize) +-setDECL(WCHAN_NAME) { freNAME(str)(R); if (!(R->result.str = strdup(lookup_wchan(P->tid)))) I->seterr = 1;; } ++setDECL(WCHAN_NAME) { freNAME(str)(R); if (!(R->result.str = strdup(lookup_wchan(P->tid)))) I->seterr = 1; } + + #undef setDECL + #undef CVT_set diff --git a/sysctl-succ-on-fail.patch b/sysctl-succ-on-fail.patch new file mode 100644 index 0000000..efa693d --- /dev/null +++ b/sysctl-succ-on-fail.patch @@ -0,0 +1,48 @@ +From cd3a440b562e6efc713ce1524678dd068a85bf91 Mon Sep 17 00:00:00 2001 +From: Matteo Croce +Date: Fri, 7 Jun 2024 00:29:32 +0200 +Subject: [PATCH] sysctl: return error on permission denied + +When trying to write to a readonly sysctl or a directory by mistake, +sysctl still returns success: + + # sysctl kernel.version=foo + sysctl: setting key "kernel.version": Operation not permitted + # echo $? + 0 + # sysctl kernel=foo + sysctl: setting key "kernel": Operation not permitted + # echo $? + 0 + +Let sysctl return error in both the cases above. + +Signed-off-by: Matteo Croce +--- + src/sysctl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/sysctl.c b/src/sysctl.c +index 087ddabe..1914203c 100644 +--- a/src/sysctl.c ++++ b/src/sysctl.c +@@ -585,14 +585,14 @@ static int WriteSetting( + errno = EPERM; + xwarn(_("setting key \"%s\""), dotted_key); + free(dotted_key); +- return rc; ++ return EXIT_FAILURE; + } + + if (S_ISDIR(ts.st_mode)) { + errno = EISDIR; + xwarn(_("setting key \"%s\""), dotted_key); + free(dotted_key); +- return rc; ++ return EXIT_FAILURE; + } + + if (!DryRun) { +-- +GitLab + diff --git a/uptime-w-user-sessions-only.patch b/uptime-w-user-sessions-only.patch new file mode 100644 index 0000000..5f3c0d9 --- /dev/null +++ b/uptime-w-user-sessions-only.patch @@ -0,0 +1,63 @@ +diff --git a/library/uptime.c b/library/uptime.c +index 1826343..d63bde7 100644 +--- a/library/uptime.c ++++ b/library/uptime.c +@@ -54,8 +54,31 @@ static int count_users(void) + struct utmp *ut; + + #if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND) +- if (sd_booted() > 0) +- return sd_get_sessions(NULL); ++ char **sessions_list; ++ int sessions; ++ ++ numuser = 0; ++ ++ sessions = sd_get_sessions(&sessions_list); ++ ++ if (sessions > 0) { ++ int i; ++ ++ for (i = 0; i < sessions; i++) { ++ char *class; ++ ++ if (sd_session_get_class(sessions_list[i], &class) < 0) ++ continue; ++ ++ if (strncmp(class, "user", 4) == 0) // user, user-early, user-incomplete ++ numuser++; ++ free(class); ++ } ++ for (i = 0; i < sessions; i++) ++ free(sessions_list[i]); ++ free(sessions_list); ++ return numuser; ++ } + #endif + + setutent(); +diff --git a/src/w.c b/src/w.c +index fd6e75f..c7bd214 100644 +--- a/src/w.c ++++ b/src/w.c +@@ -814,11 +814,18 @@ int main(int argc, char **argv) + if (sessions < 0 && sessions != -ENOENT) + error(EXIT_FAILURE, -sessions, _("error getting sessions")); + +- if (sessions >= 0) { ++ if (sessions > 0) { + for (int i = 0; i < sessions; i++) { +- char *name; ++ char *class, *name; + int r; + ++ if ((r = sd_session_get_class(sessions_list[i], &class)) < 0) ++ error(EXIT_FAILURE, -r, _("session get class failed")); ++ if (strncmp(class, "user", 4) != 0) { // user, user-early, user-incomplete ++ free(class); ++ continue; ++ } ++ free(class); + if ((r = sd_session_get_username(sessions_list[i], &name)) < 0) + error(EXIT_FAILURE, -r, _("get user name failed")); +