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 1002161 - large number of sudo rules results in error - Unable to create response: Invalid argument
Summary: large number of sudo rules results in error - Unable to create response: Inva...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sssd
Version: 6.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Jakub Hrozek
QA Contact: Kaushik Banerjee
URL:
Whiteboard:
Depends On:
Blocks: 1003567
TreeView+ depends on / blocked
 
Reported: 2013-08-28 14:29 UTC by Jakub Hrozek
Modified: 2020-05-02 17:26 UTC (History)
9 users (show)

Fixed In Version: sssd-1.9.2-125.el6
Doc Type: Bug Fix
Doc Text:
If a large amount of sudo rules with a combined size that exceeded 265 KB was configured on the system, due to the way the sss_packet_grow() function computed the total length of a response packet, SSSD failed with a "Unable to create response: Invalid argument" error message. With this update, the sss_package_grow() function code has been fixed to properly compute the response packet length, and SSSD no longer fails in the aforementioned scenario.
Clone Of:
Environment:
Last Closed: 2013-11-21 22:22:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github SSSD sssd issues 3101 0 None None None 2020-05-02 17:26:34 UTC
Red Hat Product Errata RHBA-2013:1680 0 normal SHIPPED_LIVE sssd bug fix and enhancement update 2013-11-20 21:52:37 UTC

Description Jakub Hrozek 2013-08-28 14:29:13 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/sssd/ticket/2059

This code in sss_packet_grow() is used to pad data to 512 bytes.

{{{
    if (totlen < len) {
        int n = len % SSSSRV_PACKET_MEM_SIZE + 1;
        totlen += n * SSSSRV_PACKET_MEM_SIZE;
        if (totlen < len) {
            return EINVAL;
        }
    }
}}}

If len % SSSSRV_PACKET_MEM_SIZE == 0 or some low number, we can end up with totlen < len and return EINVAL.

It also does not pad the length, but usually allocates much more memory than is desired.


{{{
    len = 1024
    n = 1024 % 512 + 1 = 0 + 1 = 1
    totlen = 1 * 512 = 512
    => totlen < len

    len = 511
    n = 511 % 512 + 1 = 511 + 1
    totlen = 512 * 512 = 262144
    totlen is way bigger than it was supposed to be
}}}

Operator / should be used instead of %.

Comment 1 Pavel Březina 2013-08-29 12:31:53 UTC
Steps to reproduce:
1. create large amount of large rules so that their combined size exceeds 265KB
2. run sssd
3. login as sudo user associated with these rules
4. $ sudo -l
   User user-1 is not allowed to run sudo on client.

In sssd_sudo.log you will see:
[sudosrv_cmd_send_reply] (0x0020): Unable to create response: Invalid argument

Comment 2 Jakub Hrozek 2013-08-29 17:20:47 UTC
Fixed upstream.

Comment 6 Amith 2013-09-19 11:24:34 UTC
Verified and automated the bug on SSSD version : sssd-1.9.2-127.el6.x86_64

Steps followed during verification:

1. Created hundreds of different groups with an ldap user as member to all.

2. Assigned large sudo rules to all the groups, thereby associating the ldap user with numerous sudo rules.

3. Reproduced the bug with older build by executing "sudo -l". Got the following error message in sssd_sudo.log:

# cat /var/log/sssd/sssd_sudo.log | grep "Invalid argument"
(Wed Sep 11 16:08:14 2013) [sssd[sudo]] [sudosrv_cmd_send_reply] (0x0020): Unable to create response: Invalid argument
(Wed Sep 11 16:09:06 2013) [sssd[sudo]] [sudosrv_cmd_send_reply] (0x0020): Unable to create response: Invalid argument

See the automated beaker output of the bug:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Bug 1002161 - large number of sudo rules results in error
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running '> /var/log/sssd/sssd_sudo.log'
Stopping sssd: [  OK  ]
[  OK  ] sssd: [  OK  ]
:: [07:16:08] ::  Sleeping for 5 seconds
:: [   PASS   ] :: Running 'restart_clearing_cache'
sudo_test_user:*:13111:10021:Kuch toh:/home/sudo_test_user:/bin/bash
:: [   PASS   ] :: Running 'getent passwd -s sss sudo_test_user'
[sudo] password for sudo_test_user: :: [   PASS   ] :: User can execute sudo command
:: [   PASS   ] :: File '/var/log/sssd/sssd_sudo.log' should not contain 'Unable to create response: Invalid argument'


NOTE: With the latest build, user is able to execute sudo commands successfully.

Comment 7 errata-xmlrpc 2013-11-21 22:22:15 UTC
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-1680.html


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