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.
Building util-linux from git results in a working binary, so Iām guessing that the backport of -o is faulty?
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().
*** Bug 1713396 has been marked as a duplicate of this bug. ***
*** Bug 1739141 has been marked as a duplicate of this bug. ***
*** Bug 1763182 has been marked as a duplicate of this bug. ***
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