#42 cgroup_get_cgroup() gives segmentation fault

open
Dhaval Giani
None
5
2008-11-22
2008-11-18
Sudhir Kumar
No

Hi,
In the latest revision of libcg I find segmentation fault when trying to fill a cgroup from a group existing in filesystem.
The code snippet I used to test is below.

/* Create, get and compare a cgroup under both mounts */

/* get cgroup_a ds and create group_a in filesystem */
cgroup_a = get_new_cgroup_ds(ctl1, "group_a", STRING, 00);
if (fs_mounted == FS_MULTI_MOUNTED) {
/* Create under another controller also */
ret = set_controller(ctl2, controller_name, control_file);
controller = cgroup_add_controller(cgroup_a, controller_name);
}
test_cgroup_create_cgroup(0, cgroup_a, "group_a", 0, 1, 1, 00);

/* create group_b ds to be filled by cgroup_get_cgroup */
cgroup_b = cgroup_new_cgroup("group_a");
if (!cgroup_b)
message(i++, FAIL, "new_cgroup()", 0, info[NOMESSAGE]);
/* Fill the ds and compare the two */
cgroup_b = cgroup_get_cgroup(cgroup_b);
if (cgroup_b) {
ret = cgroup_compare_cgroup(cgroup_a, cgroup_b);
if (ret == 0)
message(i++, PASS, "get_cgroup()", ret, info[SAMEGRP]);
else
message(i++, FAIL, "get_cgroup()", ret, info[SAMEGRP]);
} else {
message(i++, FAIL, "get_cgroup()", -1, info[SAMEGRP]);
}

cgroup_free(&cgroup_a);
cgroup_free(&cgroup_b);

Discussion

  • Dhaval Giani
    Dhaval Giani
    2008-11-22

    Could I ask you to run it through gdb and drop the backtrace here?

     
  • Dhaval Giani
    Dhaval Giani
    2008-11-22

    • assigned_to: nobody --> dhaval_giani