Bug 1712768

Summary: lsmem segfaults on ppc64 wih -o
Product: Red Hat Enterprise Linux 7 Reporter: ekulik
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED ERRATA QA Contact: Radka Brychtova <rskvaril>
Severity: high Docs Contact:
Priority: urgent    
Version: 7.7CC: bugproxy, fkrska, hannsj_uhl, rmetrich, sgoveas
Target Milestone: rcKeywords: Patch, ZStream
Target Release: 7.8   
Hardware: ppc64   
OS: Linux   
Whiteboard:
Fixed In Version: util-linux-2.23.2-62.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1766091 (view as bug list) Environment:
Last Closed: 2020-03-31 20:00:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1689150, 1689420, 1766091    

Description ekulik 2019-05-22 08:35:08 UTC
Description of problem:
lsmem segfaults when using -o (--output).

Version-Release number of selected component (if applicable):
2.23.2-61.el7

How reproducible:
Always.

Steps to Reproduce:
1. lsmem -o NODE

Actual results:
lsmem segfaults.

Expected results:
lsmem does not segfault.

Additional info:

Running under GDB reveals this:

lsmem: sys-utils/lsmem.c:187: get_column_id: Assertion `columns[num] < (int) (sizeof(coldescs) / sizeof((coldescs)[0]) + (sizeof(struct { int:-!!(__builtin_types_compatible_p(__typeof__(coldescs), __typeof__(&coldescs[0]))); })))' failed.

Comment 2 ekulik 2019-05-22 08:37:12 UTC
Building util-linux from git results in a working binary, so I’m guessing that the backport of -o is faulty?

Comment 3 Karel Zak 2019-05-22 14:44:27 UTC
The problem is lib/strutils.c:string_add_to_idarray() where is still original code which is not compatible with utils where we use size_t to count columns... (affected are probably lsipc, lsmem and lsns).

It was fixed by upstream commit http://github.com/karelzak/util-linux/commit/40b175084ff4c57468fb67600c8c66703e17cd75. For RHEL-7 we probably need to use "int" in the affected tools to be compatible with the original version of the string_add_to_idarray().

Comment 4 Karel Zak 2019-05-24 10:02:18 UTC
*** Bug 1713396 has been marked as a duplicate of this bug. ***

Comment 6 Karel Zak 2019-08-12 16:50:37 UTC
*** Bug 1739141 has been marked as a duplicate of this bug. ***

Comment 9 Karel Zak 2019-10-22 08:39:50 UTC
*** Bug 1763182 has been marked as a duplicate of this bug. ***

Comment 13 errata-xmlrpc 2020-03-31 20:00:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1102