Skip to content
Snippets Groups Projects
  1. Jun 26, 2019
  2. Jun 19, 2019
    • David Howells's avatar
      keys: Cache result of request_key*() temporarily in task_struct · 7743c48e
      David Howells authored
      
      If a filesystem uses keys to hold authentication tokens, then it needs a
      token for each VFS operation that might perform an authentication check -
      either by passing it to the server, or using to perform a check based on
      authentication data cached locally.
      
      For open files this isn't a problem, since the key should be cached in the
      file struct since it represents the subject performing operations on that
      file descriptor.
      
      During pathwalk, however, there isn't anywhere to cache the key, except
      perhaps in the nameidata struct - but that isn't exposed to the
      filesystems.  Further, a pathwalk can incur a lot of operations, calling
      one or more of the following, for instance:
      
      	->lookup()
      	->permission()
      	->d_revalidate()
      	->d_automount()
      	->get_acl()
      	->getxattr()
      
      on each dentry/inode it encounters - and each one may need to call
      request_key().  And then, at the end of pathwalk, it will call the actual
      operation:
      
      	->mkdir()
      	->mknod()
      	->getattr()
      	->open()
      	...
      
      which may need to go and get the token again.
      
      However, it is very likely that all of the operations on a single
      dentry/inode - and quite possibly a sequence of them - will all want to use
      the same authentication token, which suggests that caching it would be a
      good idea.
      
      To this end:
      
       (1) Make it so that a positive result of request_key() and co. that didn't
           require upcalling to userspace is cached temporarily in task_struct.
      
       (2) The cache is 1 deep, so a new result displaces the old one.
      
       (3) The key is released by exit and by notify-resume.
      
       (4) The cache is cleared in a newly forked process.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      7743c48e
    • David Howells's avatar
      keys: Provide request_key_rcu() · 896f1950
      David Howells authored
      
      Provide a request_key_rcu() function that can be used to request a key
      under RCU conditions.  It can only search and check permissions; it cannot
      allocate a new key, upcall or wait for an upcall to complete.  It may
      return a partially constructed key.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      896f1950
    • David Howells's avatar
      keys: Move the RCU locks outwards from the keyring search functions · e59428f7
      David Howells authored
      
      Move the RCU locks outwards from the keyring search functions so that it
      will become possible to provide an RCU-capable partial request_key()
      function in a later commit.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      e59428f7
    • David Howells's avatar
      keys: Invalidate used request_key authentication keys · a09003b5
      David Howells authored
      
      Invalidate used request_key authentication keys rather than revoking them
      so that they get cleaned up immediately rather than potentially hanging
      around.  There doesn't seem any need to keep the revoked keys around.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      a09003b5
    • David Howells's avatar
      keys: Fix request_key() lack of Link perm check on found key · 504b69eb
      David Howells authored
      
      The request_key() syscall allows a process to gain access to the 'possessor'
      permits of any key that grants it Search permission by virtue of request_key()
      not checking whether a key it finds grants Link permission to the caller.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      504b69eb
    • David Howells's avatar
      keys: Add capability-checking keyctl function · 45e0f30c
      David Howells authored
      
      Add a keyctl function that requests a set of capability bits to find out
      what features are supported.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      45e0f30c
  3. May 30, 2019
  4. May 29, 2019
  5. May 22, 2019
  6. May 10, 2019
  7. May 08, 2019
  8. May 02, 2019
  9. Apr 30, 2019
  10. Apr 29, 2019
    • Paulo Alcantara's avatar
      selinux: use kernel linux/socket.h for genheaders and mdp · dfbd199a
      Paulo Alcantara authored
      
      When compiling genheaders and mdp from a newer host kernel, the
      following error happens:
      
          In file included from scripts/selinux/genheaders/genheaders.c:18:
          ./security/selinux/include/classmap.h:238:2: error: #error New
          address family defined, please update secclass_map.  #error New
          address family defined, please update secclass_map.  ^~~~~
          make[3]: *** [scripts/Makefile.host:107:
          scripts/selinux/genheaders/genheaders] Error 1 make[2]: ***
          [scripts/Makefile.build:599: scripts/selinux/genheaders] Error 2
          make[1]: *** [scripts/Makefile.build:599: scripts/selinux] Error 2
          make[1]: *** Waiting for unfinished jobs....
      
      Instead of relying on the host definition, include linux/socket.h in
      classmap.h to have PF_MAX.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaulo Alcantara <paulo@paulo.ac>
      Acked-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      [PM: manually merge in mdp.c, subject line tweaks]
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      dfbd199a
  11. Apr 26, 2019
  12. Apr 25, 2019
    • Eric Biggers's avatar
      crypto: shash - remove shash_desc::flags · 877b5691
      Eric Biggers authored
      
      The flags field in 'struct shash_desc' never actually does anything.
      The only ostensibly supported flag is CRYPTO_TFM_REQ_MAY_SLEEP.
      However, no shash algorithm ever sleeps, making this flag a no-op.
      
      With this being the case, inevitably some users who can't sleep wrongly
      pass MAY_SLEEP.  These would all need to be fixed if any shash algorithm
      actually started sleeping.  For example, the shash_ahash_*() functions,
      which wrap a shash algorithm with the ahash API, pass through MAY_SLEEP
      from the ahash API to the shash API.  However, the shash functions are
      called under kmap_atomic(), so actually they're assumed to never sleep.
      
      Even if it turns out that some users do need preemption points while
      hashing large buffers, we could easily provide a helper function
      crypto_shash_update_large() which divides the data into smaller chunks
      and calls crypto_shash_update() and cond_resched() for each chunk.  It's
      not necessary to have a flag in 'struct shash_desc', nor is it necessary
      to make individual shash algorithms aware of this at all.
      
      Therefore, remove shash_desc::flags, and document that the
      crypto_shash_*() functions can be called from any context.
      
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      877b5691
  13. Apr 24, 2019
  14. Apr 18, 2019
  15. Apr 15, 2019
  16. Apr 10, 2019
Loading