ksh script execution results in a memory fault (coredump)

Solution Verified - Updated -

Issue

  • ksh script execution results in a Memory fault (coredump). User executed:
./script -U
  • Further looking and debugging at the code we observed one particular line of code where redirection is done while sourcing a utility function shell script:
. /path/to/utility/functions/script 1>/dev/null 2>&1

This redirection leads to the core.

Corresponding stack trace shows invalid descriptor number:

fcntl(12, F_DUPFD, 2)                   = 2
close(12)                               = 0
fcntl(11, F_DUPFD, 4294967295)          = -1 EINVAL (Invalid argument)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV (core dumped) +++
Memory fault(coredump)

Environment

  • Red Hat Enterprise Linux (RHEL) 6.4
  • ksh-20100621-19.el6.x86_64

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content