Commit Graph

2499 Commits

Author SHA1 Message Date
Benny Baumann 9d3a1d4981 Elaborate the highlighting of outdated/deleted executables and libraries 2021-10-19 00:39:24 +02:00
Christian Göttsche 60cfa2edce FreeBSD: add comment for memory leak workaround
Follow-up of #841

[ci skip]
2021-10-15 22:22:30 +02:00
Christian Göttsche 604744f68d Header: allocate memory for terminating entry
The names array is terminated by a NULL entry, thus allocate space for
one more than entries.

Fixes: #844

==6708==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000045b8 at pc 0x000000589ee1 bp 0x7ffcd1dee220 sp 0x7ffcd1dee218
READ of size 8 at 0x6060000045b8 thread T0
    #0 0x589ee0 in String_freeArray ./XUtils.c:157:23
    #1 0x56c9af in Settings_delete ./Settings.c:31:7
    #2 0x4ee44b in CommandLine_run ./CommandLine.c:395:4
    #3 0x4d6fb2 in main ./htop.c:15:11
    #4 0x7ff3b8154e49 in __libc_start_main csu/../csu/libc-start.c:314:16
    #5 0x428aa9 in _start (./htop+0x428aa9)

0x6060000045b8 is located 0 bytes to the right of 56-byte region [0x606000004580,0x6060000045b8)
allocated by thread T0 here:
    #0 0x4a53f2 in __interceptor_calloc (./htop+0x4a53f2)
    #1 0x5890ba in xCalloc ./XUtils.c:55:17
    #2 0x50a044 in Header_writeBackToSettings ./Header.c:148:34
    #3 0x4de861 in Action_runSetup ./Action.c:91:7
    #4 0x4de861 in actionSetup ./Action.c:386:4
    #5 0x515caf in MainPanel_eventHandler ./MainPanel.c:106:19
    #6 0x56a5c1 in ScreenManager_run ./ScreenManager.c:235:19
    #7 0x4ee13b in CommandLine_run ./CommandLine.c:364:4
    #8 0x4d6fb2 in main ./htop.c:15:11
    #9 0x7ff3b8154e49 in __libc_start_main csu/../csu/libc-start.c:314:16
2021-10-15 12:16:41 +02:00
Benny Baumann 13fe58f54a Update version number to 3.2.0-dev to identify git repo builds 2021-10-14 23:53:41 +02:00
Benny Baumann e785693ef9 Release 3.1.1 2021-10-14 23:42:05 +02:00
Ximalas 4cf74de1f1 Suppress reporting memory leaks originating from libdevstat
Based on https://cgit.freebsd.org/src/tree/lib/libdevstat/devstat.c
the following four functions call memory allocation functions:

- devstat_getdevs()
- devstat_selectdevs()
- devstat_buildmatch()
- get_devstat_kvm()
2021-10-14 23:25:19 +02:00
Nathan Scott 0a5890d332 Updates to the ChangeLog for 3.1.1 release 2021-10-13 17:03:35 +11:00
Ximalas 2128edfba2 Plug the memory leak for the Disk I/O meter
There are no functions in libdevstat to initialise or clean up memory. The simplest change is to mark the local variable info as static.
2021-10-12 09:09:00 +02:00
Nathan Scott d1c833fe95 Merge branch 'revert-used-memory' 2021-10-12 17:47:03 +11:00
Nathan Scott 868b0b3574 Ensure consistent reporting of MemoryMeter used memory
Resolves #821
2021-10-12 17:46:44 +11:00
Nathan Scott 04871a2d04 Report hugepage memory as real and used memory (as before)
This is real, physical memory available for applications to
use.  We should not try to pretend otherwise; its confusing
for users and inconsistent with all other tools.
2021-10-12 17:46:16 +11:00
Benny Baumann b7248f6cb8 Handle procExeDeleted & usesDeletedLib without mergedCommandline mode 2021-10-07 08:42:08 +02:00
Benny Baumann 74afca7bc1 Validate meter configuration before proceeding 2021-10-06 08:59:02 +02:00
Benny Baumann 2a13e15ad0 Properly release memory on partially read configuration 2021-10-06 08:59:02 +02:00
Nathan Scott 8ac8542b6e Handle interrupted sampling from within libpcp PDU transfers
This situation can arise if pcp-htop screen is resized right
at the same time sampling from pmcd(1) is happening.  Have a
couple more goes at it before giving up entirely; once there
is no data available though we cannot proceed into accessing
the sample result data structure (segv will result) so a new
short-circuit guard is added there also.
2021-10-05 15:53:18 +11:00
Benny Baumann f75a8bc3a1 Memory leak on OpenBSD when querying full command line 2021-10-03 19:18:25 +02:00
Benny Baumann d520199e62 Memory leak on NetBSD when querying full command line 2021-10-03 19:18:25 +02:00
Benny Baumann 9d8d87e1d5 Memory leak on DragonFlyBSD when querying full command line 2021-10-03 19:18:25 +02:00
Benny Baumann 57c1538887 Don't force allocation, as failure is handled 2021-10-03 19:18:25 +02:00
Ximalas 9eb52d5932 Release memory for cmdline when Process_updateCmdline() returns.
This closes a nasty memory leak. There is at least another leak looming somewhere when Disk I/O is shown in the header area. That could very well be an issue within libdevstat native to FreeBSD.
2021-10-03 19:18:11 +02:00
Christian Göttsche 970885edc3 Linux: improve tryRead macro safety
Add an explicit else clause so a following else branch for a prior if
condition does not get mixed up.

Also force a trailing semicolon and thereby silence current
-Wextra-semi-stmt warnings.

Improve readability of the hwloc_bitmap_foreach_begin loop macro.
2021-10-01 18:36:35 +02:00
Christian Göttsche ae1816e563 Settings: use size_t for meter count in header
Header.c:150:26: error: implicit conversion loses integer precision: 'int' to 'uint8_t' (aka 'unsigned char') [-Werror,-Wimplicit-int-conversion]
          colSettings->len = len;
                           ~ ^~~
2021-10-01 18:36:35 +02:00
Christian Göttsche 53732ab0bb Resolve -Wimplicit-int-conversion warnings
Panel.c:414:49: error: implicit conversion loses integer precision: 'int' to 'short' [-Werror,-Wimplicit-int-conversion]
      this->scrollH = MAXIMUM(this->selectedLen - this->w, 0);
                    ~         ~~~~~~~~~~~~~~~~~~^~~~~~~~~
./Macros.h:11:54: note: expanded from macro 'MAXIMUM'
#define MAXIMUM(a, b)                  ((a) > (b) ? (a) : (b))
                                                     ^

IncSet.c:159:38: error: implicit conversion loses integer precision: 'int' to 'char' [-Werror,-Wimplicit-int-conversion]
         mode->buffer[mode->index] = ch;
                                   ~ ^~

Panel.c:456:24: error: implicit conversion loses integer precision: 'int' to 'char' [-Werror,-Wimplicit-int-conversion]
         buffer[len] = ch;
                     ~ ^~
Panel.c:473:22: error: implicit conversion loses integer precision: 'int' to 'char' [-Werror,-Wimplicit-int-conversion]
         buffer[0] = ch;
                   ~ ^~
2021-10-01 18:36:35 +02:00
Sohaib Mohamed 8932efece9 astyle: Add `--pad-header` option
Insert space padding between a header (e.g. 'if', 'for', 'while'...) and the
following paren. ex:

if(isFoo((a+2), b))
    bar(a, b);

becomes:

if (isFoo((a+2), b))
    bar(a, b);

Link: http://astyle.sourceforge.net/astyle.html#_pad-paren
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
2021-10-01 15:01:51 +02:00
fraggerfox d23627fda9 Adds a missing HAVE_GETMOUSE check.
Fixes builds failing with error
MainPanel.c:65:62: error: 'Settings {aka struct Settings_}' has no member named 'enableMouse'
    if (ch != ERR && (ch != KEY_MOUSE || this->state->settings->enableMouse))
2021-09-29 22:21:53 +02:00
Nathan Scott 4c846921a6 Improve configuration file version diagnostic formatting slightly 2021-09-27 15:13:01 +10:00
Nathan Scott c5e789db1b Prepare changelog contents for the 3.1.1 bugfix release 2021-09-27 13:33:48 +10:00
Nathan Scott eb94c4f9c9 Merge branch 'amomchilov-workaround-for-FB9546856' 2021-09-27 13:15:58 +10:00
Nathan Scott 8361c6c1ae Merge branch 'workaround-for-FB9546856' of https://github.com/amomchilov/htop into amomchilov-workaround-for-FB9546856 2021-09-27 13:15:50 +10:00
Nathan Scott 07f934ccfb Update the README to drop now redundant glibc version requirement 2021-09-27 13:14:23 +10:00
Nathan Scott 6f751d5929 Merge branch 'o_path' of https://github.com/cgzones/htop into cgzones-o_path 2021-09-27 13:13:13 +10:00
Alexander Momchilov e26a2cf431 Workaround for Rosetta 2 on Darwin
rdar://FB9546856

https://openradar.appspot.com/radar?id=5055988478509056
2021-09-26 10:58:47 -04:00
Alexander Momchilov d527bc9132 Refactor Platform_CompareKernelVersion API 2021-09-26 10:58:47 -04:00
Alexander Momchilov dadcb87ad0 Extract Darwin "PlatformHelpers" 2021-09-26 10:58:47 -04:00
Christian Göttsche 754c0d6bb9 Linux: always compute procExeDeleted if already set
A process, whose executable has been replaced and thus marked by htop,
can be re-executed with the replaced executable, with the same PID, in
two ways: the Linux feature checkpoint/restore or re-execution of PID 1.
The actual check is just a string comparison, like the dropped
condition, leading to (almost) no computation overhead.
2021-09-24 22:03:16 +02:00
Daniel Lange 9f4a4faab9 Merge branch 'license' of cgzones/htop 2021-09-24 21:25:00 +02:00
Christian Göttsche a710deeaa7 Linux: define O_PATH if not defined
Defining O_PATH if not defined by <fcntl.h> does not really add any
maintenance cost and might improve some portability.

Related: #804
2021-09-24 20:31:48 +02:00
Christian Göttsche 466d6f99e2 Update remaining license headers to explicitly say GPLv2+
Also change ReadMe badge.
2021-09-24 20:28:26 +02:00
Nathan Scott 1601931bbf Merge branch 'fasterit-clarify-license' 2021-09-24 11:59:41 +10:00
Nathan Scott 41f9c0ab77 Merge branch 'clarify-license' of https://github.com/fasterit/htop into fasterit-clarify-license 2021-09-24 11:59:32 +10:00
Nathan Scott e28d022716 Merge branch 'automake-compat' 2021-09-24 11:59:09 +10:00
Nathan Scott d5ac75a5c7 Merge branch 'fasterit-fix-mouse-wheel' 2021-09-24 11:58:03 +10:00
Nathan Scott 2ba7d5ff36 Merge branch 'fix-mouse-wheel' of https://github.com/fasterit/htop into fasterit-fix-mouse-wheel 2021-09-24 11:57:52 +10:00
Daniel Lange 3d99c306b9 Document minimum versions for glibc and libcap. Thank you to James Brown (Roguelazer).
Closes #804
2021-09-23 18:10:51 +02:00
Nathan Scott 3d3474b3fc Adjust Makefile.am macro definitions for older automake versions
Fixes: #803
2021-09-23 10:06:38 +10:00
Daniel Lange 94ad111391 Update license headers to explicitly say GPLv2+ 2021-09-22 14:28:19 +02:00
Daniel Lange 976fa3b121 Make the "Released under the GNU GPLv2+. See 'man' page for more info." from ScreenManager.c valid 2021-09-22 14:23:49 +02:00
Daniel Lange 61227793de Clarify licensing
htop has been licensed as GPLv2 but there was inconsistency regarding the
option to choose "any later version" as granted by the license.

This commit clarifies the htop dev team is fine with that choice.
2021-09-22 14:23:38 +02:00
Daniel Lange e6ded48d1a Update version to 3.1.1-dev 2021-09-22 11:49:25 +02:00
Daniel Lange 87c992739b Fix mouse wheel collision with autogroups nice adjustment
Fixes #805
2021-09-22 09:00:31 +02:00