1. 14 Apr, 2014 2 commits
    • Tejun Heo's avatar
      idr: fix top layer handling · c45821f7
      Tejun Heo authored
      commit 326cf0f0 upstream.
      
      Most functions in idr fail to deal with the high bits when the idr
      tree grows to the maximum height.
      
      * idr_get_empty_slot() stops growing idr tree once the depth reaches
        MAX_IDR_LEVEL - 1, which is one depth shallower than necessary to
        cover the whole range.  The function doesn't even notice that it
        didn't grow the tree enough and ends up allocating the wrong ID
        given sufficiently high @starting_id.
      
        For example, on 64 bit, if the starting id is 0x7fffff01,
        idr_get_empty_slot() will grow the tree 5 layer deep, which only
        covers the 30 bits and then proceed to allocate as if the bit 30
        wasn't specified.  It ends up allocating 0x3fffff01 without the bit
        30 but still returns 0x7fffff01.
      
      * __idr_remove_all() will not remove anything if the tree is fully
        grown.
      
      * idr_find() can't find anything if the tree is fully grown.
      
      * idr_for_each() and idr_get_next() can't iterate anything if the tree
        is fully grown.
      
      Fix it by introducing idr_max() which returns the maximum possible ID
      given the depth of tree and replacing the id limit checks in all
      affected places.
      
      As the idr_layer pointer array pa[] needs to be 1 larger than the
      maximum depth, enlarge pa[] arrays by one.
      
      While this plugs the discovered issues, the whole code base is
      horrible and in desparate need of rewrite.  It's fragile like hell,
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [bwh: Backported to 3.2:
       - Adjust context
       - s/MAX_IDR_LEVEL/MAX_LEVEL/; s/MAX_IDR_SHIFT/MAX_ID_SHIFT/
       - Drop change to idr_alloc()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Cc: Qiang Huang <h.huangqiang@huawei.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Jianguo Wu <wujianguo@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      c45821f7
    • Artem Bityutskiy's avatar
      proc: pid/status: show all supplementary groups · 4ca2cf4a
      Artem Bityutskiy authored
      commit 8d238027 upstream.
      
      We display a list of supplementary group for each process in
      /proc/<pid>/status.  However, we show only the first 32 groups, not all of
      them.
      
      Although this is rare, but sometimes processes do have more than 32
      supplementary groups, and this kernel limitation breaks user-space apps
      that rely on the group list in /proc/<pid>/status.
      
      Number 32 comes from the internal NGROUPS_SMALL macro which defines the
      length for the internal kernel "small" groups buffer.  There is no
      apparent reason to limit to this value.
      
      This patch removes the 32 groups printing limit.
      
      The Linux kernel limits the amount of supplementary groups by NGROUPS_MAX,
      which is currently set to 65536.  And this is the maximum count of groups
      we may possibly print.
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Acked-by: default avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Cc: Qiang Huang <h.huangqiang@huawei.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Jianguo Wu <wujianguo@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4ca2cf4a
  2. 03 Apr, 2014 7 commits
  3. 31 Mar, 2014 14 commits
  4. 24 Mar, 2014 17 commits