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.
Bug 1300958 - segfault in script after ulimit -v [RHEL-6]
Summary: segfault in script after ulimit -v [RHEL-6]
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: zsh
Version: 6.7
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Kamil Dudka
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On: 1302229
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-22 08:22 UTC by Martin Kyral
Modified: 2017-07-03 12:47 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1302229 (view as bug list)
Environment:
Last Closed: 2017-07-03 12:47:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
backtrace (40.70 KB, text/plain)
2016-01-22 08:22 UTC, Martin Kyral
no flags Details
proof-of-concept reproducer (699 bytes, text/plain)
2016-01-25 13:56 UTC, Kamil Dudka
no flags Details

Description Martin Kyral 2016-01-22 08:22:15 UTC
Created attachment 1117132 [details]
backtrace

Description of problem:
Script containing ulimit -v 100000 causes zsh to segfault:

[0 root@qeos-21 test]# cat segv.sh
ulimit -v 100000
ls
[0 root@qeos-21 test]# zsh segv.sh
Segmentation fault (core dumped)
[0 root@qeos-21 test]# echo $?
139

By further examination I found out, that the problem is bad handling of the memory allocation if the memory limit set by ulimit -v is too strict.

ksh and bash are ok with this particular value. When I set it really low (ulimit -v 100), the script gets killed by SIGKILL which is better than SIGSEGV.

Version-Release number of selected component (if applicable):
zsh-4.3.11-4.el6_7.1

How reproducible:
always

Steps to Reproduce:
1. see description
2.
3.

Actual results:
[0 root@qeos-21 test]# zsh segv.sh
Segmentation fault (core dumped)
[0 root@qeos-21 test]# echo $?
139

Expected results:
[0 root@qeos-21 test]# zsh segv.sh
Killed
[0 root@qeos-21 test]# echo $?
137


Additional info:
It may be necessary to use lower ulimit -v value to reproduce.

Comment 1 Kamil Dudka 2016-01-22 09:36:34 UTC
Thank you for reporting the bug.  From the backtrace it is clear that it crashes due to infinite recursion and stack overflow.  zalloc() fails to allocate memory, so it wants to print a fatal error message and exit.  The problem is that zerr(), which is used to print the error message, transitively calls back to zalloc().

In order to prevent the stack overflow, we need to:
1. either make zalloc() not call zerr(),
2. make zerr() not transitively call back to zalloc(), or
3. introduce a flag that will break the recursion in cases like this.

Comment 2 Kamil Dudka 2016-01-25 13:56:37 UTC
Created attachment 1118021 [details]
proof-of-concept reproducer

I have attached a universal reproducer script.  It is not completely reliable because dynamic linker and pthread run-time may run out of memory sooner than zsh itself in some cases.  Nevertheless, I am able to trigger the infinite recursion with upstream git HEAD if I create a statically linked executable.

Comment 3 Kamil Dudka 2016-01-25 15:22:58 UTC
reported upstream:

http://www.zsh.org/mla/workers/2016/msg00310.html

Comment 4 Martin Kyral 2016-01-25 15:53:12 UTC
.. and there's already proposed fix. Thanks!

Comment 6 Kamil Dudka 2016-01-27 09:08:07 UTC
fixed in zsh-5.2-4.fc24

Comment 9 Kamil Dudka 2017-07-03 12:47:09 UTC
Red Hat Enterprise Linux 6 transitioned to the Production 3 Phase on May 10, 2017.  During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available.

The official life cycle policy can be reviewed here:

http://redhat.com/rhel/lifecycle

This issue does not appear to meet the inclusion criteria for the Production Phase 3 and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification.  Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL:

https://access.redhat.com


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