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 1463312 - shp.fdstatus may be accessed with -1 offset, corrupting last element of shp.fdptrs
Summary: shp.fdstatus may be accessed with -1 offset, corrupting last element of shp.f...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: ksh
Version: 6.5
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Siteshwar Vashisht
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks: 1464409
TreeView+ depends on / blocked
 
Reported: 2017-06-20 14:37 UTC by Paulo Andrade
Modified: 2020-07-16 09:51 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1464409 (view as bug list)
Environment:
Last Closed: 2017-08-16 16:48:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
ksh-20120801-fdstatus.patch (779 bytes, patch)
2017-06-20 14:37 UTC, Paulo Andrade
no flags Details | Diff

Description Paulo Andrade 2017-06-20 14:37:29 UTC
Created attachment 1289676 [details]
ksh-20120801-fdstatus.patch

Based on coredump state:

Program terminated with signal 11, Segmentation fault.
#0  sh_close (fd=4095) at /usr/src/debug/ksh-20120801/src/cmd/ksh93/sh/io.c:704
704			*shp->fdptrs[fd] = -1;
(gdb) p fd
$1 = 4095
(gdb) p shp.gd.lim.open_max
$2 = 4096
(gdb) p shp.fdptrs[4095]
$3 = (int *) 0xa00000000000000
(gdb) p shp.fdptrs+4096
$4 = (int **) 0x7f302e64a050
(gdb) p shp.fdstatus
$5 = (unsigned char *) 0x7f302e64a050 "\t\022"
(gdb) p/o shp.fdstatus[-1]
$6 = 012
(gdb) p/x shp.fdstatus[-1]
$7 = 0xa

so, it apparently has set shp.fdstatus[-1] to
#define IOWRITE		002
#define IOSEEK		010

  Also possibly indicating the cause of the problem:

(gdb) frame 1
#1  0x0000000000457f07 in iousepipe (shp=0x76e340)
    at /usr/src/debug/ksh-20120801/src/cmd/ksh93/sh/xec.c:130
130		sh_close(subpipe[1]);
(gdb) p subpipe
$8 = {5, 4095, -1}

  At first, I will try a somewhat brute force patch, by allowing
a -1 offset to fdptrs and fdstatus, as the user is already using
the patch in bz 1259898 to avoid other crashes.

  The "somewhat" brute force patch is because there are several
places that do not check for a -1 file descriptor, but, if problems
happen again with the patch, it might be required to add a fatal
termination error to sh_iomovefd if the "dup(fdold)" call fails,
as otherwise it (sh_iomovefd) will set a -1 offset, and return a -1
fd that other code will also use as offset in shp->fdstatus.
  At first, I believe the issue is in sh_iomovefd, and likely, the
process run out of file descriptors, due to leaking them.


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