Re: Patch for proc w/ no supplementary groups

From: mukti jain (muktijn_at_gmail_dot_com)
Date: Wed Aug 13 2008 - 01:57:49 PDT

  • Next message: mukti jain: "Re: Patch for proc w/ no supplementary groups"
    We have not seen the issue on x86 with the same application,
    why is this problem arm specific?
    
    >
    > On Tue, Aug 12, 2008 at 12:04 AM, Paul H. Hargrove <PHHargrove_at_lbl_dot_gov>wrote:
    >
    >> It seems the ENOMEM problem reported by Manish Dwivedi recently is due to
    >> having zero supplementary group ids.  When BLCR goes to save the group ids,
    >> this results in vmalloc(0) which rightly returns NULL.  BLCR, however,
    >> interprets the NULL return as an out of memory condition.  Mukti Jain has
    >> observed that the same exists on the corresponding restore path.
    >>
    >> Attached is a patch that should resolve these problems (works in my
    >> limited testing).
    >>
    >> I had planned to release 0.7.3 today, but will probably delay that until
    >> I've gotten confirmation from Manish and/or Mukti that this patch solves the
    >> problem, or until somebody finds a problem with this patch.
    >>
    >> -Paul
    >>
    >> --
    >> Paul H. Hargrove                          PHHargrove_at_lbl_dot_gov
    >> Future Technologies Group
    >> HPC Research Department                   Tel: +1-510-495-2352
    >> Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
    >>
    >> Index: cr_module/cr_dump_self.c
    >> ===================================================================
    >> RCS file: /var/local/cvs/lbnl_cr/cr_module/cr_dump_self.c,v
    >> retrieving revision 1.202.2.5
    >> diff -u -r1.202.2.5 cr_dump_self.c
    >> --- cr_module/cr_dump_self.c    26 Jun 2008 00:05:42 -0000      1.202.2.5
    >> +++ cr_module/cr_dump_self.c    11 Aug 2008 18:22:40 -0000
    >> @@ -819,7 +819,7 @@
    >>         }
    >>
    >>  #if HAVE_TASK_GROUP_INFO
    >> -        {
    >> +        if (sizeof_groups != 0) {
    >>             /* copy current->groups into an array and write it out */
    >>             int i;
    >>             gid_t *groups;
    >> Index: cr_module/cr_rstrt_req.c
    >> ===================================================================
    >> RCS file: /var/local/cvs/lbnl_cr/cr_module/cr_rstrt_req.c,v
    >> retrieving revision 1.292.2.8
    >> diff -u -r1.292.2.8 cr_rstrt_req.c
    >> --- cr_module/cr_rstrt_req.c    5 Aug 2008 00:39:59 -0000       1.292.2.8
    >> +++ cr_module/cr_rstrt_req.c    11 Aug 2008 18:22:40 -0000
    >> @@ -144,8 +144,7 @@
    >>  {
    >>     struct cr_context_creds cf_creds;
    >>     int retval;
    >> -    gid_t *groups;
    >> -    size_t sizeof_groups;
    >> +    gid_t *groups = NULL;
    >>
    >>     retval = cr_kread(proc_req->file, &cf_creds, sizeof(cf_creds));
    >>     if (retval < sizeof(cf_creds)) {
    >> @@ -162,20 +161,21 @@
    >>        CR_ERR("Invalid supplemental group count (%d)",
    >> (int)cf_creds.ngroups);
    >>        retval = -EINVAL;
    >>        goto out;
    >> -    }
    >> +    } else if (cf_creds.ngroups) {
    >> +       size_t sizeof_groups = cf_creds.ngroups*sizeof(gid_t);
    >> +       groups = vmalloc(sizeof_groups);
    >> +       retval = -ENOMEM;
    >> +       if (groups == NULL) {
    >> +           goto out;
    >> +       }
    >>
    >> -    sizeof_groups = cf_creds.ngroups*sizeof(gid_t);
    >> -    groups = vmalloc(sizeof_groups);
    >> -    retval = -ENOMEM;
    >> -    if (groups == NULL) {
    >> -       goto out;
    >> +       retval = cr_kread(proc_req->file, groups, sizeof_groups);
    >> +       if (retval < sizeof_groups) {
    >> +           CR_ERR("groups: read returned %d", retval);
    >> +            goto out_vfree;
    >> +       }
    >>     }
    >>
    >> -    retval = cr_kread(proc_req->file, groups, sizeof_groups);
    >> -    if (retval < sizeof_groups) {
    >> -       CR_ERR("groups: read returned %d", retval);
    >> -        goto out_vfree;
    >> -    }
    >>
    >>  #if CR_RESTORE_IDS
    >>     {
    >>
    >>
    >
    

  • Next message: mukti jain: "Re: Patch for proc w/ no supplementary groups"