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 1057676

Summary: Cgroup templates not getting applied because of bad struct copy
Product: Red Hat Enterprise Linux 6 Reporter: Josko Plazonic <plazonic>
Component: libcgroupAssignee: Jan Chaloupka <jchaloup>
Status: CLOSED ERRATA QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6CC: ccui, gbailey, jsafrane, ovasik, varekova
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 06:44:59 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:

Description Josko Plazonic 2014-01-24 15:26:25 UTC
Description of problem:
With the latest libcgroup-0.40.rc1-5.el6_5.1 in our testing we had template limits (like template users/%u in cgconfig.conf) not getting applied to users.  We tracked it down to:
cgroup_copy_cgroup(&config_template_table[i], &template_table[i]);
line 1533 of src/config.c - which has the wrong order (should be DEST,SRC) so the just parsed config_template_table is getting overwritten with an empty one.  Also template name and other params are not getting copied. Indeed 0.41 version of libcgroup has that fixed.

Version-Release number of selected component (if applicable):
libcgroup-0.40.rc1-5.el6_5.1

How reproducible:
every time

Steps to Reproduce:
1. add to /etc/cgconfig.conf template like:
group everyone {
        cpu {
                cpu.shares = 100;
        }
        memory {
                memory.limit_in_bytes = 61G;
                memory.memsw.limit_in_bytes = 65G;
                memory.use_hierarchy = 1;
        }
}
template everyone/%u {
        cpu {
                cpu.shares = 10;
        }
        memory {
                memory.limit_in_bytes = 30G;
                memory.memsw.limit_in_bytes = 32G;
        }
}
2. and add to /etc/cgrules.conf:
*               cpu,memory      everyone/%u
3. Start cgconfig and cgred services, login as a user

Actual results:
Check /cgroups/everyone/username/memory.limits_in_bytes and notice that there are no limits imposed.

Expected results:
Expecting limits as specified.

Additional info:
This is fixed in libcgroup-0.41 - this is the relevant excerpt from diff on src/config.c:
@@ -1483,7 +1483,24 @@
        }
 
        for (i = 0; i < template_table_index; i++) {
-               cgroup_copy_cgroup(&config_template_table[i], &template_table[i]);
+               cgroup_copy_cgroup(&template_table[i],
+                       &config_template_table[i]);
+               strcpy((template_table[i]).name,
+                       (config_template_table[i]).name);
+               template_table[i].tasks_uid =
+                       config_template_table[i].tasks_uid;
+               template_table[i].tasks_gid =
+                       config_template_table[i].tasks_gid;
+               template_table[i].task_fperm =
+                       config_template_table[i].task_fperm;
+               template_table[i].control_uid =
+                       config_template_table[i].control_uid;
+               template_table[i].control_gid =
+                       config_template_table[i].control_gid;
+               template_table[i].control_fperm =
+                       config_template_table[i].control_fperm;
+               template_table[i].control_dperm =
+                       config_template_table[i].control_dperm;
        }
 
        return ret;
@@ -1530,7 +1547,24 @@
        }
 
        for (i = 0; i < template_table_index; i++) {
-               cgroup_copy_cgroup(&config_template_table[i], &template_table[i]);
+               cgroup_copy_cgroup(&template_table[i],
+                       &config_template_table[i]);
+               strcpy((template_table[i]).name,
+                       (config_template_table[i]).name);
+               template_table[i].tasks_uid =
+                       config_template_table[i].tasks_uid;
+               template_table[i].tasks_gid =
+                       config_template_table[i].tasks_gid;
+               template_table[i].task_fperm =
+                       config_template_table[i].task_fperm;
+               template_table[i].control_uid =
+                       config_template_table[i].control_uid;
+               template_table[i].control_gid =
+                       config_template_table[i].control_gid;
+               template_table[i].control_fperm =
+                       config_template_table[i].control_fperm;
+               template_table[i].control_dperm =
+                       config_template_table[i].control_dperm;
        }
 
        return ret;

Comment 5 errata-xmlrpc 2014-10-14 06:44:59 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-2014-1480.html