diff --git a/SOURCES/procps-ng-3.3.10-find_elf_note-memory-error-fix.patch b/SOURCES/procps-ng-3.3.10-find_elf_note-memory-error-fix.patch new file mode 100644 index 0000000..47b52d9 --- /dev/null +++ b/SOURCES/procps-ng-3.3.10-find_elf_note-memory-error-fix.patch @@ -0,0 +1,89 @@ +diff --git a/proc/sysinfo.c b/proc/sysinfo.c +index 1435de1..1d2b8e2 100644 +--- a/proc/sysinfo.c ++++ b/proc/sysinfo.c +@@ -36,6 +36,9 @@ + #include /* htons */ + #endif + ++#include ++#include ++ + long smp_num_cpus; /* number of CPUs */ + long page_bytes; /* this architecture's page size */ + +@@ -249,15 +252,67 @@ static void old_Hertz_hack(void){ + + extern char** environ; + +-/* for ELF executables, notes are pushed before environment and args */ +-static unsigned long find_elf_note(unsigned long findme){ ++static unsigned long find_elf_note(unsigned long type) ++{ ++ ElfW(auxv_t) auxv_struct; ++ ElfW(auxv_t) *auxv_temp; ++ FILE *fd; ++ int i; ++ static ElfW(auxv_t) *auxv = NULL; + unsigned long *ep = (unsigned long *)environ; +- while(*ep++); +- while(*ep){ +- if(ep[0]==findme) return ep[1]; +- ep+=2; ++ unsigned long ret_val = NOTE_NOT_FOUND; ++ ++ ++ if(!auxv) { ++ ++ fd = fopen("/proc/self/auxv", "rb"); ++ ++ if(!fd) { // can't open auxv? that could be caused by euid change ++ // ... and we need to fall back to the old and unsafe ++ // ... method that doesn't work when calling library ++ // ... functions with dlopen -> FIXME :( ++ ++ while(*ep++); // for ELF executables, notes are pushed ++ while(*ep){ // ... before environment and args ++ if(ep[0]==type) return ep[1]; ++ ep+=2; ++ } ++ return NOTE_NOT_FOUND; ++ } ++ ++ auxv = (ElfW(auxv_t) *) malloc(getpagesize()); ++ if (!auxv) { ++ perror("malloc"); ++ exit(EXIT_FAILURE); ++ } ++ ++ i = 0; ++ do { ++ fread(&auxv_struct, sizeof(ElfW(auxv_t)), 1, fd); ++ auxv[i] = auxv_struct; ++ i++; ++ } while (auxv_struct.a_type != AT_NULL); ++ ++ fclose(fd); ++ ++ } ++ ++ auxv_temp = auxv; ++ i = 0; ++ do { ++ if(auxv_temp[i].a_type == type) { ++ ret_val = (unsigned long)auxv_temp[i].a_un.a_val; ++ break; ++ } ++ i++; ++ } while (auxv_temp[i].a_type != AT_NULL); ++ ++ if (auxv){ ++ auxv_temp = NULL; ++ free(auxv); ++ auxv = NULL; + } +- return NOTE_NOT_FOUND; ++ return ret_val; + } + + int have_privs; diff --git a/SOURCES/procps-ng-3.3.10-ps-scattered-thread-cgroups.patch b/SOURCES/procps-ng-3.3.10-ps-scattered-thread-cgroups.patch new file mode 100644 index 0000000..03ec6d1 --- /dev/null +++ b/SOURCES/procps-ng-3.3.10-ps-scattered-thread-cgroups.patch @@ -0,0 +1,69 @@ +diff --git a/ps/output.c b/ps/output.c +index 501e29a..5f011b1 100644 +--- a/ps/output.c ++++ b/ps/output.c +@@ -1343,6 +1343,41 @@ + return snprintf(outbuf, COLWID, "%s", vals[lines_to_next_header%4u]); + } + ++static int pr_thcgr(char *restrict const outbuf, const proc_t *restrict const pp){ ++ char filename[48]; ++ FILE *fd; ++ int counter = 0; ++ int c; ++ int is_cgroup = 0; ++ ++ outbuf[0]='\0'; ++ snprintf(filename, sizeof filename, "/proc/%d/task/%d/cgroup", pp->tgid, pp->tid); ++ fd = fopen(filename, "r"); ++ if (likely(fd == NULL)) goto fail; ++ while (( (c = fgetc(fd)) != EOF) && (counter<665)) { ++ if (is_cgroup == 0) { ++ if (c == ':') { ++ is_cgroup = 1; ++ if (counter>0) ++ outbuf[counter++]=';'; ++ } ++ }else ++ if ((c == '\n') || (c == '\0')) ++ is_cgroup = 0; ++ else ++ outbuf[counter++]=c; ++ } ++ outbuf[counter]='\0'; ++ fclose(fd); ++ if (counter>0) ++ return counter; ++fail: ++ outbuf[0] = '-'; ++ outbuf[1] = '\0'; ++ return 1; ++} ++ ++ + /***************************************************************************/ + /*************************** other stuff ***********************************/ + +@@ -1623,6 +1658,7 @@ + {"taskid", "TASKID", pr_nop, sr_nop, 5, 0, SUN, TO|PIDMAX|RIGHT}, // is this a thread ID? + {"tdev", "TDEV", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT}, + {"tgid", "TGID", pr_procs, sr_procs, 5, 0, LNX, PO|PIDMAX|RIGHT}, ++{"thcgr", "THCGR", pr_thcgr, sr_nop, 35, 0, LNX, PO|LEFT}, /* thread cgroups */ + {"thcount", "THCNT", pr_nlwp, sr_nlwp, 5, 0, AIX, PO|RIGHT}, + {"tid", "TID", pr_tasks, sr_tasks, 5, 0, AIX, TO|PIDMAX|RIGHT}, + {"time", "TIME", pr_time, sr_time, 8, 0, U98, ET|RIGHT}, /*cputime*/ /* was 6 wide */ +diff --git a/ps/ps.1 b/ps/ps.1 +index b90adc8..b8d6c81 100644 +--- a/ps/ps.1 ++++ b/ps/ps.1 +@@ -1713,6 +1713,10 @@ + It is the process ID of the thread group leader. + T} + ++thcgr THCGR T{ ++display control groups to which the thread belongs. ++T} ++ + thcount THCNT T{ + see + .BR nlwp . diff --git a/SOURCES/procps-ng-3.3.10-ps-thcount-format-option.patch b/SOURCES/procps-ng-3.3.10-ps-thcount-format-option.patch new file mode 100644 index 0000000..7e36b07 --- /dev/null +++ b/SOURCES/procps-ng-3.3.10-ps-thcount-format-option.patch @@ -0,0 +1,13 @@ +diff -aur procps-ng-3.3.10/ps/output.c ../procps-ng-3.3.10/ps/output.c +--- procps-ng-3.3.10/ps/output.c 2014-09-23 13:40:36.000000000 +0200 ++++ ../procps-ng-3.3.10/ps/output.c 2016-06-06 18:58:36.267123736 +0200 +@@ -1622,8 +1622,8 @@ + {"sz", "SZ", pr_sz, sr_nop, 5, 0, HPU, PO|RIGHT}, + {"taskid", "TASKID", pr_nop, sr_nop, 5, 0, SUN, TO|PIDMAX|RIGHT}, // is this a thread ID? + {"tdev", "TDEV", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT}, +-{"thcount", "THCNT", pr_nlwp, sr_nlwp, 5, 0, AIX, PO|RIGHT}, + {"tgid", "TGID", pr_procs, sr_procs, 5, 0, LNX, PO|PIDMAX|RIGHT}, ++{"thcount", "THCNT", pr_nlwp, sr_nlwp, 5, 0, AIX, PO|RIGHT}, + {"tid", "TID", pr_tasks, sr_tasks, 5, 0, AIX, TO|PIDMAX|RIGHT}, + {"time", "TIME", pr_time, sr_time, 8, 0, U98, ET|RIGHT}, /*cputime*/ /* was 6 wide */ + {"timeout", "TMOUT", pr_nop, sr_nop, 5, 0, LNX, AN|RIGHT}, // 2.0.xx era diff --git a/SOURCES/procps-ng-3.3.10-vmstat-devlen.patch b/SOURCES/procps-ng-3.3.10-vmstat-devlen.patch new file mode 100644 index 0000000..e41de18 --- /dev/null +++ b/SOURCES/procps-ng-3.3.10-vmstat-devlen.patch @@ -0,0 +1,57 @@ +diff -Naur procps-ng-3.3.10.orig/proc/sysinfo.c procps-ng-3.3.10/proc/sysinfo.c +--- procps-ng-3.3.10.orig/proc/sysinfo.c 2016-01-14 15:57:33.000000000 +0100 ++++ procps-ng-3.3.10/proc/sysinfo.c 2016-01-14 16:40:01.290000000 +0100 +@@ -988,7 +988,7 @@ + int cPartition = 0; + int fields; + unsigned dummy; +- char devname[32]; ++ char devname[35]; + + *disks = NULL; + *partitions = NULL; +@@ -1001,10 +1001,10 @@ + fclose(fd); + break; + } +- fields = sscanf(buff, " %*d %*d %15s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u", devname, &dummy); ++ fields = sscanf(buff, " %*d %*d %34s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u", devname, &dummy); + if (fields == 2 && is_disk(devname)){ + (*disks) = xrealloc(*disks, (cDisk+1)*sizeof(struct disk_stat)); +- sscanf(buff, " %*d %*d %15s %u %u %llu %u %u %u %llu %u %u %u %u", ++ sscanf(buff, " %*d %*d %31s %u %u %llu %u %u %u %llu %u %u %u %u", + //&disk_major, + //&disk_minor, + (*disks)[cDisk].disk_name, +@@ -1026,8 +1026,8 @@ + (*partitions) = xrealloc(*partitions, (cPartition+1)*sizeof(struct partition_stat)); + fflush(stdout); + sscanf(buff, (fields == 2) +- ? " %*d %*d %15s %u %*u %llu %*u %u %*u %llu %*u %*u %*u %*u" +- : " %*d %*d %15s %u %llu %u %llu", ++ ? " %*d %*d %34s %u %*u %llu %*u %u %*u %llu %*u %*u %*u %*u" ++ : " %*d %*d %34s %u %llu %u %llu", + //&part_major, + //&part_minor, + (*partitions)[cPartition].partition_name, +diff -Naur procps-ng-3.3.10.orig/proc/sysinfo.h procps-ng-3.3.10/proc/sysinfo.h +--- procps-ng-3.3.10.orig/proc/sysinfo.h 2014-09-23 13:40:36.000000000 +0200 ++++ procps-ng-3.3.10/proc/sysinfo.h 2016-01-14 16:30:02.326000000 +0100 +@@ -101,7 +101,7 @@ + typedef struct disk_stat{ + unsigned long long reads_sectors; + unsigned long long written_sectors; +- char disk_name [16]; ++ char disk_name [32]; + unsigned inprogress_IO; + unsigned merged_reads; + unsigned merged_writes; +@@ -115,7 +115,7 @@ + }disk_stat; + + typedef struct partition_stat{ +- char partition_name [16]; ++ char partition_name [35]; + unsigned long long reads_sectors; + unsigned parent_disk; // index into a struct disk_stat array + unsigned reads; diff --git a/SOURCES/procps-ng-3.3.10-vmstat-long-device-name.patch b/SOURCES/procps-ng-3.3.10-vmstat-long-device-name.patch new file mode 100644 index 0000000..91c72ec --- /dev/null +++ b/SOURCES/procps-ng-3.3.10-vmstat-long-device-name.patch @@ -0,0 +1,13 @@ +diff --git a/proc/sysinfo.c b/proc/sysinfo.c +index baa2453..c95f378 100644 +--- a/proc/sysinfo.c ++++ b/proc/sysinfo.c +@@ -979,7 +979,7 @@ unsigned int getpartitions_num(struct disk_stat *disks, int ndisks){ + ///////////////////////////////////////////////////////////////////////////// + static int is_disk(char *dev) + { +- char syspath[32]; ++ char syspath[64]; + char *slash; + + while ((slash = strchr(dev, '/'))) diff --git a/SPECS/procps-ng.spec b/SPECS/procps-ng.spec index 3ba597d..911cc3b 100644 --- a/SPECS/procps-ng.spec +++ b/SPECS/procps-ng.spec @@ -4,7 +4,7 @@ Summary: System and process monitoring utilities Name: procps-ng Version: 3.3.10 -Release: 5%{?dist} +Release: 10%{?dist} License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ Group: Applications/System URL: https://sourceforge.net/projects/procps-ng/ @@ -13,6 +13,11 @@ Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz Patch0: procps-ng-3.3.10-pmap-skip-vmflags.patch Patch1: procps-ng-3.3.10-free-uninitialized-errno.patch +Patch2: procps-ng-3.3.10-ps-thcount-format-option.patch +Patch3: procps-ng-3.3.10-vmstat-devlen.patch +Patch4: procps-ng-3.3.10-find_elf_note-memory-error-fix.patch +Patch5: procps-ng-3.3.10-ps-scattered-thread-cgroups.patch +Patch6: procps-ng-3.3.10-vmstat-long-device-name.patch Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig @@ -80,6 +85,11 @@ Internationalization pack for procps-ng %patch0 -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build @@ -161,6 +171,26 @@ rmdir %{buildroot}/share %{_datadir}/locale/* %changelog +* Tue Jul 26 2016 Jan Rybar - 3.3.10-10 +- Fixes sysinfo - devices with name longer than 20 chars are mistaken for partitions +- Resolves: rhbz#1169349 + +* Thu Jul 07 2016 Jan Rybar - 3.3.10-9 +- Fixes showing same cgroups for threads under process by adding format option +- Resolves: rhbz#1284087 + +* Mon Jul 04 2016 Jan Rybar - 3.3.10-8 +- Fixes obtaining environment variables in find_elf_note function +- Resolves: rhbz#1287752 + +* Thu Jun 09 2016 Jan Rybar - 3.3.10-7 +- Fixing sysinfo - devices with length exceeding 15 chars are not displayed in vmstat -d +- Resolves: #1169349 + +* Mon Jun 06 2016 Jan Rybar - 3.3.10-6 +- #1174311 - ps - thcount not recognized as a format option +- Resolves: #1174311 + * Tue Dec 01 2015 Jaromir Capik - 3.3.10-5 - #1287038 - free - error while parsing arguments - Resolves: #1287038