diff --git a/backport-pmap-Increase-memory-allocation-failure-judgment.patch b/backport-pmap-Increase-memory-allocation-failure-judgment.patch new file mode 100644 index 0000000000000000000000000000000000000000..6ca63c34cc8e8fa21f3226fbc76f44cb627a527b --- /dev/null +++ b/backport-pmap-Increase-memory-allocation-failure-judgment.patch @@ -0,0 +1,41 @@ +From b51ef773ad5cbd3eb9e348df4f70eb03307ce044 Mon Sep 17 00:00:00 2001 +From: EulerOSWander <314264452@qq.com> +Date: Mon, 12 Jun 2023 14:19:30 +0800 +Subject: [PATCH] pmap: Increase memory allocation failure judgment + +Call trace: + #0 __vsnprintf_internal + #1 0x00007f967aedd656 in __GI___snprintf + #2 0x00005612da28c707 in snprintf + #3 config_read (rc_filename=) at pmap.c:885 + #4 0x00005612da28b8c0 int main at pmap.c:1144 + +The above stack is caused by calling a null pointer +after the memory allocation fails. Increase the null +pointer judgment. + +signed-off-by: zhoujie +--- + src/pmap.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/pmap.c b/src/pmap.c +index 658b2501..74d57dab 100644 +--- a/src/pmap.c ++++ b/src/pmap.c +@@ -881,7 +881,11 @@ static int config_read (char *rc_filename) + } + + /* add the field in the list */ +- cnf_listnode = calloc(1, sizeof *cnf_listnode); ++ if (!(cnf_listnode = calloc(1, sizeof *cnf_listnode))) { ++ xwarnx(_("memory allocation failed")); ++ fclose(f); ++ return 0; ++ } + snprintf(cnf_listnode -> description, sizeof(cnf_listnode -> description), "%s", token); + cnf_listnode -> next = cnf_listhead; + cnf_listhead = cnf_listnode; +-- +2.33.0 + diff --git a/backport-top-lessen-summary-cpu-distortions-with-first-displa.patch b/backport-top-lessen-summary-cpu-distortions-with-first-displa.patch new file mode 100644 index 0000000000000000000000000000000000000000..1e34a747459591574ea615d9e1cb75c78b3e8247 --- /dev/null +++ b/backport-top-lessen-summary-cpu-distortions-with-first-displa.patch @@ -0,0 +1,51 @@ +From 786335b9673f9c3af0b3897799b30b205e99748a Mon Sep 17 00:00:00 2001 +From: hdzhoujie +Date: Fri, 5 May 2023 20:00:25 +0800 +Subject: [PATCH] top: lessen summary cpu distortions with first display + +When the cpu utilization is displayed for +the first time, the reading of the /proc/stat +file is very close to each other, resulting +in large fluctuations. The version before +refactoring, such as v3.3.17, has a delay +before reading the /proc/stat file for the +second time, and the same delay is added here. + +signed-off-by: zhoujie +signed-off-by: he jingxian +Signed-off-by: Jim Warner +--- + src/top/top.c | 3 +++ + src/top/top.h | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/top/top.c b/src/top/top.c +index 757b8d3b..98444fd4 100644 +--- a/src/top/top.c ++++ b/src/top/top.c +@@ -3735,6 +3735,9 @@ static void before (char *me) { + Graph_cpus = alloc_c(sizeof(struct graph_parms)); + Graph_mems = alloc_c(sizeof(struct graph_parms)); + #undef doALL ++ ++ // don't distort startup cpu(s) display ... ++ usleep(LIB_USLEEP); + } // end: before + + +diff --git a/src/top/top.h b/src/top/top.h +index d633f3e1..03de1ca3 100644 +--- a/src/top/top.h ++++ b/src/top/top.h +@@ -121,7 +121,7 @@ char *strcasestr(const char *haystack, const char *needle); + /* Length of time a message is displayed and the duration + of a 'priming' wait during library startup (in microseconds) */ + #define MSG_USLEEP 1250000 +-#define LIB_USLEEP 150000 ++#define LIB_USLEEP 100000 + + /* Specific process id monitoring support (command line only) */ + #define MONPIDMAX 20 +-- +2.33.0 + diff --git a/procps-ng.spec b/procps-ng.spec index 5dc9c1c0d1cfe64a12d7c5853daa8498196c6f30..4b00e9574470825f03cfb4e2cc9230e49a27b5b6 100644 --- a/procps-ng.spec +++ b/procps-ng.spec @@ -1,6 +1,6 @@ Name: procps-ng Version: 4.0.2 -Release: 3 +Release: 5 Summary: Utilities that provide system information. License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ URL: https://sourceforge.net/projects/procps-ng/ @@ -15,6 +15,8 @@ Patch3: skill-Restore-the-p-flag-functionality.patch Patch4: backport-top-address-the-missing-guest-tics-for-summary-area.patch Patch5: backport-0001-ps-address-missing-or-corrupted-fields-with-m-option.patch Patch6: backport-0002-ps-trade-previous-fix-for-final-solution-to-m-option.patch +Patch7: backport-top-lessen-summary-cpu-distortions-with-first-displa.patch +Patch8: backport-pmap-Increase-memory-allocation-failure-judgment.patch BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel @@ -97,6 +99,12 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof %{_mandir}/man* %changelog +* Mon Jun 26 2023 zhoujie - 4.0.2-5 +- pmap: increase memory allocation failure judgment + +* Tue Jun 13 2023 zhoujie - 4.0.2-4 +- top: first time display delay + * Tue May 30 2023 zhoujie - 4.0.2-3 - ps: fix ps -lm dump problem