Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
A build with system malloc, and valgrind logs (without debuginfo) show:
==29580== Invalid read of size 8
==29580== at 0x45890A: sh_exec (in /usr/bin/ksh93)
==29580== by 0x45AAF9: sh_exec (in /usr/bin/ksh93)
==29580== by 0x457C6A: sh_exec (in /usr/bin/ksh93)
==29580== by 0x459A3A: sh_exec (in /usr/bin/ksh93)
==29580== by 0x459A3A: sh_exec (in /usr/bin/ksh93)
==29580== by 0x459A3A: sh_exec (in /usr/bin/ksh93)
==29580== by 0x459A3A: sh_exec (in /usr/bin/ksh93)
==29580== by 0x459A3A: sh_exec (in /usr/bin/ksh93)
==29580== by 0x459A3A: sh_exec (in /usr/bin/ksh93)
==29580== by 0x45ACF6: sh_exec (in /usr/bin/ksh93)
==29580== by 0x457C6A: sh_exec (in /usr/bin/ksh93)
==29580== by 0x456CD9: sh_funscope (in /usr/bin/ksh93)
==29580== Address 0x5c1a888 is 8,184 bytes inside a block of size 8,192 free'd
==29580== at 0x4C2B06D: free (vg_replace_malloc.c:540)
==29580== by 0x49C768: stkset (in /usr/bin/ksh93)
==29580== by 0x4587A2: sh_exec (in /usr/bin/ksh93)
==29580== by 0x457C6A: sh_exec (in /usr/bin/ksh93)
==29580== by 0x456CD9: sh_funscope (in /usr/bin/ksh93)
==29580== by 0x4570E7: sh_funct (in /usr/bin/ksh93)
==29580== by 0x459658: sh_exec (in /usr/bin/ksh93)
==29580== by 0x457C89: sh_exec (in /usr/bin/ksh93)
==29580== by 0x45AAF9: sh_exec (in /usr/bin/ksh93)
==29580== by 0x406AD7: exfile (in /usr/bin/ksh93)
==29580== by 0x4075C4: sh_main (in /usr/bin/ksh93)
==29580== by 0x5562554: (below main) (libc-start.c:266)
==29580== Block was alloc'd at
==29580== at 0x4C2C089: calloc (vg_replace_malloc.c:762)
==29580== by 0x49C19D: stkgrow (in /usr/bin/ksh93)
==29580== by 0x49CA22: stkalloc (in /usr/bin/ksh93)
==29580== by 0x45AE5D: sh_exec (in /usr/bin/ksh93)
==29580== by 0x457C6A: sh_exec (in /usr/bin/ksh93)
==29580== by 0x456CD9: sh_funscope (in /usr/bin/ksh93)
==29580== by 0x4570E7: sh_funct (in /usr/bin/ksh93)
==29580== by 0x459658: sh_exec (in /usr/bin/ksh93)
==29580== by 0x457C89: sh_exec (in /usr/bin/ksh93)
==29580== by 0x45AAF9: sh_exec (in /usr/bin/ksh93)
==29580== by 0x406AD7: exfile (in /usr/bin/ksh93)
==29580== by 0x4075C4: sh_main (in /usr/bin/ksh93)
The issue should be fixed with https://github.com/ksh93/ksh/commit/4604df9ada906e0a6537157a63b6ce7c0509f34d
[Stack robustness fixes from OpenSUSE]
Probably could ask someone from OpenSuSE, with a bugzilla account with enough
permissions, to check if there is a reproducer.
I was aware something was wrong in this code path for some time, and the
few other cases I saw it as root cause ended up with minor modifications
to shell code, to avoid hitting the condition.
Did not find time to work on a patch, and did not know OpenSuSE had a patch
for it. Also, not fully understanding the code, could just end up with a
patch that could break elsewhere...
It should be triggered by local function variables and some kind of control
flow change in some stack of function calls.
Possibly due to, in C code, some longjmp back to stack base, and due to saving
state in the stack, restoring an invalid value.
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 (ksh bug fix and enhancement update), 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-2021:4776