Bug 1263765 - free -h segfault
free -h segfault
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: procps-ng (Show other bugs)
Unspecified Unspecified
low Severity medium
: rc
: ---
Assigned To: Jan Rybar
BaseOS QE - Apps
: Patch, Upstream
: 1362588 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2015-09-16 11:53 EDT by Branislav Náter
Modified: 2018-04-20 04:52 EDT (History)
3 users (show)

See Also:
Fixed In Version: procps-ng-3.3.10-20.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Upstream backport patch with additional CLI options (5.10 KB, patch)
2017-07-27 10:32 EDT, Jan Rybar
no flags Details | Diff
Cherrypicked backport patch (3.35 KB, patch)
2018-01-17 09:06 EST, Jan Rybar
kdudka: review+
Details | Diff

  None (edit)
Description Branislav Náter 2015-09-16 11:53:55 EDT
Description of problem:
During testing of BZ#1246379, I've tried to pass huge numbers (petabytes of memory) to free utility. When trying to produce output in human readable form (-h), free segfaults.

Version-Release number of selected component (if applicable):

Steps to Reproduce:
1. copy /proc/meminfo file and change "MemTotal" value to "123123123123123"
2. mount modified meminfo:
mount --bind meminfo /proc/meminfo
3. free -h

Actual results:
              total        used        free      shared  buff/cache   available
Segmentation fault

Expected results:
No segfault
Comment 2 Jaromír Cápík 2016-01-14 11:31:30 EST
In my case the free tool starts to crash when I get over 1192928601000 kB and the probability of crashing gets higher when the value is increased even more. That means it probably depends on other values which change in time. However, it's very probably an overflow in the evaluations and needs to be fixed.
Comment 6 Jan Rybar 2017-07-13 12:53:18 EDT
*** Bug 1362588 has been marked as a duplicate of this bug. ***
Comment 7 Jan Rybar 2017-07-13 13:05:09 EDT
According to the comment in code made by the author, 'free -h' generally acts as described above on systems with memory exceeding 1PB.

Problem is caused by character overflow in reserved Memory info column. Solution preventing this behaviour was deferred by upstream as no computer with that much memory exists so far.

Patch under construction.
Comment 9 Jan Rybar 2017-07-27 10:32 EDT
Created attachment 1305425 [details]
Upstream backport patch with additional CLI options
Comment 10 Jan Rybar 2018-01-17 09:06 EST
Created attachment 1382414 [details]
Cherrypicked backport patch
Comment 11 Kamil Dudka 2018-01-17 16:40:08 EST
Comment on attachment 1382414 [details]
Cherrypicked backport patch

Looks good to me.

Note You need to log in before you can comment on or make changes to this bug.