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.

Bug 868031

Summary: programs run under sudo cannot dump core
Product: Red Hat Enterprise Linux 6 Reporter: bartarr
Component: sudoAssignee: Daniel Kopeček <dkopecek>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: dkinon, jhunt
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-19 15:47:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test support program none

Description bartarr 2012-10-18 23:25:00 UTC
Created attachment 629686 [details]
test support program

Description of problem:

    This is a regression due to the changes in bug 667120.  I do not
    have access to that bug report so I don't know its intentions.

    The way sudo works is that it (1) sets its RLIMIT_CORE soft limit
    to zero for itself, and then (2) restores the original limit
    before exec'ing the child process.

    The problem with the bug 667120 changes were that they disabled
    the first part yet left the restoration part.  Since (1) doesn't
    run, (2) does not have the original values to restore and restores
    a zeroed out struct rlimit, forcing the hard and soft limits of
    the child to be zero.

    There is no workaround for this as a hard limit of zero allows no
    modification.

Version-Release number of selected component (if applicable):

    sudo-1.7.4p5-13.el6_3.x86_64.rpm

How reproducible:

    Always

Steps to Reproduce:

    I've attached a program that prints its RLIMIT_CORE soft and hard
    limits.  Running this with and without sudo should yield the same
    results (in absence of any PAM rules, etc).

    1. Compile test program: cc -o /tmp/rlimit rlimit.c
    2. Run directly, it will show you your RLIMIT_CORE values (if your
       values are already zero, set them to something nonzero)
    3. Run under sudo, it will always have zero cur/hard values.
  
Actual results:

    Hard-limit on RLIMIT_CORE is set to zero.

Expected results:

    RLIMIT_CORE limits unaffected.

Additional info:

Here are verbose repro steps.

Set up core limit to 1M soft, no hard limit

    $ ulimit -H -c unlimited
    $ ulimit -S -c 1024

.....................................................................
Try with OLDER version
.....................................................................

    $ rpm -q sudo
    sudo-1.7.4p5-5.el6.x86_64

Verify settings

    $ ulimit -c
    1024
    $ egrep 'Limit|core' /proc/$$/limits
    Limit                     Soft Limit   Hard Limit    Units
    Max core file size        102400000    unlimited     bytes

Run program with and without sudo, as root and as self

    $ /tmp/rlimit
    s:1048576 h:-1
    $ sudo /tmp/rlimit
    s:1048576 h:-1          <<<<<<<<<<< good
    $ sudo -u `id -nu` /tmp/rlimit
    s:1048576 h:-1          <<<<<<<<<<< good

.....................................................................
Try with NEWER version
.....................................................................

    $ rpm -q sudo
    sudo-1.7.4p5-13.el6_3.x86_64

Verify settings

    $ ulimit -c
    1024
    $ egrep 'Limit|core' /proc/$$/limits
    Limit                     Soft Limit   Hard Limit    Units
    Max core file size        102400000    unlimited     bytes

Run program with and without sudo, as root and as self

    $ /tmp/rlimit
    s:1048576 h:-1
    $ sudo /tmp/rlimit
    s:0 h:0                <<<<<<<<<<<< wrong
    $ sudo -u `id -nu` /tmp/rlimit
    s:0 h:0                <<<<<<<<<<<< wrong

Comment 2 RHEL Program Management 2012-12-14 08:40:52 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 4 Jacob Hunt 2013-03-19 15:47:15 UTC

*** This bug has been marked as a duplicate of bug 836242 ***

Comment 5 Jacob Hunt 2013-03-19 15:48:39 UTC
This is resolved with the errata from bug 836242:

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.

http://rhn.redhat.com/errata/RHBA-2013-0363.html