1. 28 11月, 2017 1 次提交
  2. 09 2月, 2017 1 次提交
  3. 08 10月, 2016 1 次提交
    • A
      cred: simpler, 1D supplementary groups · 81243eac
      Alexey Dobriyan 提交于
      Current supplementary groups code can massively overallocate memory and
      is implemented in a way so that access to individual gid is done via 2D
      array.
      
      If number of gids is <= 32, memory allocation is more or less tolerable
      (140/148 bytes).  But if it is not, code allocates full page (!)
      regardless and, what's even more fun, doesn't reuse small 32-entry
      array.
      
      2D array means dependent shifts, loads and LEAs without possibility to
      optimize them (gid is never known at compile time).
      
      All of the above is unnecessary.  Switch to the usual
      trailing-zero-len-array scheme.  Memory is allocated with
      kmalloc/vmalloc() and only as much as needed.  Accesses become simpler
      (LEA 8(gi,idx,4) or even without displacement).
      
      Maximum number of gids is 65536 which translates to 256KB+8 bytes.  I
      think kernel can handle such allocation.
      
      On my usual desktop system with whole 9 (nine) aux groups, struct
      group_info shrinks from 148 bytes to 44 bytes, yay!
      
      Nice side effects:
      
       - "gi->gid[i]" is shorter than "GROUP_AT(gi, i)", less typing,
      
       - fix little mess in net/ipv4/ping.c
         should have been using GROUP_AT macro but this point becomes moot,
      
       - aux group allocation is persistent and should be accounted as such.
      
      Link: http://lkml.kernel.org/r/20160817201927.GA2096@p183.telecom.bySigned-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Cc: Vasily Kulikov <segoon@openwall.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      81243eac
  4. 25 11月, 2015 1 次提交
  5. 09 7月, 2013 1 次提交
  6. 02 7月, 2013 1 次提交
    • N
      net/sunrpc: xpt_auth_cache should be ignored when expired. · 7715cde8
      NeilBrown 提交于
      commit d202cce8
          sunrpc: never return expired entries in sunrpc_cache_lookup
      
      moved the 'entry is expired' test from cache_check to
      sunrpc_cache_lookup, so that it happened early and some races could
      safely be ignored.
      
      However the ip_map (in svcauth_unix.c) has a separate single-item
      cache which allows quick lookup without locking.  An entry in this
      case would not be subject to the expiry test and so could be used
      well after it has expired.
      
      This is not normally a big problem because the first time it is used
      after it is expired an up-call will be scheduled to refresh the entry
      (if it hasn't been scheduled already) and the old entry will then
      be invalidated.  So on the second attempt to use it after it has
      expired, ip_map_cached_get will discard it.
      
      However that is subtle and not ideal, so replace the "!cache_valid"
      test with "cache_is_expired".
      In doing this we drop the test on the "CACHE_VALID" bit.  This is
      unnecessary as the bit is never cleared, and an entry will only
      be cached if the bit is set.
      Reported-by: NBodo Stroesser <bstroesser@ts.fujitsu.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      7715cde8
  7. 29 5月, 2013 1 次提交
  8. 15 2月, 2013 2 次提交
  9. 13 2月, 2013 6 次提交
    • E
      sunrpc: Properly decode kuids and kgids in RPC_AUTH_UNIX credentials · f025adf1
      Eric W. Biederman 提交于
      When reading kuids from the wire map them into the initial user
      namespace, and validate the mapping succeded.
      
      When reading kgids from the wire map them into the initial user
      namespace, and validate the mapping succeded.
      
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      f025adf1
    • E
      sunrpc: Properly encode kuids and kgids in auth.unix.gid rpc pipe upcalls. · 25da9263
      Eric W. Biederman 提交于
      When a new rpc connection is established with an in-kernel server, the
      traffic passes through svc_process_common, and svc_set_client and down
      into svcauth_unix_set_client if it is of type RPC_AUTH_NULL or
      RPC_AUTH_UNIX.
      
      svcauth_unix_set_client then looks at the uid of the credential we
      have assigned to the incomming client and if we don't have the groups
      already cached makes an upcall to get a list of groups that the client
      can use.
      
      The upcall encodes send a rpc message to user space encoding the uid
      of the user whose groups we want to know.  Encode the kuid of the user
      in the initial user namespace as nfs mounts can only happen today in
      the initial user namespace.
      
      When a reply to an upcall comes in convert interpret the uid and gid values
      from the rpc pipe as uids and gids in the initial user namespace and convert
      them into kuids and kgids before processing them further.
      
      When reading proc files listing the uid to gid list cache convert the
      kuids and kgids from into uids and gids the initial user namespace.  As we are
      displaying server internal details it makes sense to display these values
      from the servers perspective.
      
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      25da9263
    • E
      sunrpc: Hash uids by first computing their value in the initial userns · 9e469e30
      Eric W. Biederman 提交于
      In svcauth_unix introduce a helper unix_gid_hash as otherwise the
      expresion to generate the hash value is just too long.
      
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      9e469e30
    • E
      sunrpc: Use uid_eq and gid_eq where appropriate · 0b4d51b0
      Eric W. Biederman 提交于
      When comparing uids use uid_eq instead of ==.
      When comparing gids use gid_eq instead of ==.
      
      And unfortunate cost of type safety.
      
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      0b4d51b0
    • E
      sunrpc: Use kuid_t and kgid_t where appropriate · 7eaf040b
      Eric W. Biederman 提交于
      Convert variables that store uids and gids to be of type
      kuid_t and kgid_t instead of type uid_t and gid_t.
      
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      7eaf040b
    • E
      sunrpc: Use userns friendly constants. · bf37f794
      Eric W. Biederman 提交于
      Instead of (uid_t)0 use GLOBAL_ROOT_UID.
      Instead of (gid_t)0 use GLOBAL_ROOT_GID.
      Instead of (uid_t)-1 use INVALID_UID
      Instead of (gid_t)-1 use INVALID_GID.
      Instead of NOGROUP use INVALID_GID.
      
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      bf37f794
  10. 05 2月, 2013 1 次提交
  11. 19 7月, 2012 1 次提交
    • E
      ipv6: add ipv6_addr_hash() helper · ddbe5032
      Eric Dumazet 提交于
      Introduce ipv6_addr_hash() helper doing a XOR on all bits
      of an IPv6 address, with an optimized x86_64 version.
      
      Use it in flow dissector, as suggested by Andrew McGregor,
      to reduce hash collision probabilities in fq_codel (and other
      users of flow dissector)
      
      Use it in ip6_tunnel.c and use more bit shuffling, as suggested
      by David Laight, as existing hash was ignoring most of them.
      
      Use it in sunrpc and use more bit shuffling, using hash_32().
      
      Use it in net/ipv6/addrconf.c, using hash_32() as well.
      
      As a cleanup, use it in net/ipv4/tcp_metrics.c
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: NAndrew McGregor <andrewmcgr@gmail.com>
      Cc: Dave Taht <dave.taht@gmail.com>
      Cc: Tom Herbert <therbert@google.com>
      Cc: David Laight <David.Laight@ACULAB.COM>
      Cc: Joe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ddbe5032
  12. 01 6月, 2012 2 次提交
  13. 03 5月, 2012 1 次提交
  14. 12 4月, 2012 1 次提交
  15. 04 2月, 2012 1 次提交
  16. 01 2月, 2012 3 次提交
  17. 12 12月, 2011 1 次提交
  18. 23 11月, 2011 1 次提交
  19. 16 7月, 2011 2 次提交
  20. 10 3月, 2011 1 次提交
    • J
      svcrpc: fix bad argument in unix_domain_find · 352b5d13
      J. Bruce Fields 提交于
      "After merging the nfsd tree, today's linux-next build (powerpc
      ppc64_defconfig) produced this warning:
      
      net/sunrpc/svcauth_unix.c: In function 'unix_domain_find':
      net/sunrpc/svcauth_unix.c:58: warning: passing argument 1 of
      +'svcauth_unix_domain_release' from incompatible pointer type
      net/sunrpc/svcauth_unix.c:41: note: expected 'struct auth_domain *' but
      argument
      +is of type 'struct unix_domain *'
      
      Introduced by commit 8b3e07ac ("svcrpc: fix rare race on unix_domain
      creation")."
      Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      352b5d13
  21. 09 3月, 2011 1 次提交
  22. 05 1月, 2011 2 次提交
  23. 18 12月, 2010 1 次提交
  24. 12 10月, 2010 1 次提交
  25. 27 9月, 2010 5 次提交