Skip to content
Snippets Groups Projects
  1. May 10, 2019
  2. May 08, 2019
  3. May 02, 2019
  4. Apr 30, 2019
  5. 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
  6. Apr 26, 2019
  7. 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
  8. Apr 24, 2019
  9. Apr 18, 2019
  10. Apr 15, 2019
  11. Apr 10, 2019
  12. Apr 08, 2019
  13. Apr 04, 2019
    • Ondrej Mosnacek's avatar
      kernfs: fix xattr name handling in LSM helpers · 1537ad15
      Ondrej Mosnacek authored
      
      The implementation of kernfs_security_xattr_*() helpers reuses the
      kernfs_node_xattr_*() functions, which take the suffix of the xattr name
      and extract full xattr name from it using xattr_full_name(). However,
      this function relies on the fact that the suffix passed to xattr
      handlers from VFS is always constructed from the full name by just
      incerementing the pointer. This doesn't necessarily hold for the callers
      of kernfs_security_xattr_*(), so their usage will easily lead to
      out-of-bounds access.
      
      Fix this by moving the xattr name reconstruction to the VFS xattr
      handlers and replacing the kernfs_security_xattr_*() helpers with more
      general kernfs_xattr_*() helpers that take full xattr name and allow
      accessing all kernfs node's xattrs.
      
      Reported-by: default avatarkernel test robot <rong.a.chen@intel.com>
      Fixes: b230d5ab ("LSM: add new hook for kernfs node initialization")
      Fixes: ec882da5 ("selinux: implement the kernfs_init_security hook")
      Signed-off-by: default avatarOndrej Mosnacek <omosnace@redhat.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      1537ad15
  14. Apr 03, 2019
  15. Apr 02, 2019
    • Casey Schaufler's avatar
      Smack: Create smack_rule cache to optimize memory usage · 4e328b08
      Casey Schaufler authored
      
      This patch allows for small memory optimization by creating the
      kmem cache for "struct smack_rule" instead of using kzalloc.
      For adding new smack rule, kzalloc is used to allocate the memory
      for "struct smack_rule". kzalloc will always allocate 32 or 64 bytes
      for 1 structure depending upon the kzalloc cache sizes available in
      system. Although the size of structure is 20 bytes only, resulting
      in memory wastage per object in the default pool.
      
      For e.g., if there are 20000 rules, then it will save 240KB(20000*12)
      which is crucial for small memory targets.
      
      Signed-off-by: default avatarVishal Goel <vishal.goel@samsung.com>
      Signed-off-by: default avatarAmit Sahrawat <a.sahrawat@samsung.com>
      Signed-off-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      4e328b08
    • Vishal Goel's avatar
      smack: removal of global rule list · 460d95a1
      Vishal Goel authored
      
      In this patch, global rule list has been removed. Now all
      smack rules will be read using "smack_known_list". This list contains
      all the smack labels and internally each smack label structure
      maintains the list of smack rules corresponding to that smack label.
      So there is no need to maintain extra list.
      
      1) Small Memory Optimization
      For eg. if there are 20000 rules, then it will save 625KB(20000*32),
      which is critical for small embedded systems.
      2) Reducing the time taken in writing rules on load/load2 interface
      3) Since global rule list is just used to read the rules, so there
      will be no performance impact on system
      
      Signed-off-by: default avatarVishal Goel <vishal.goel@samsung.com>
      Signed-off-by: default avatarAmit Sahrawat <a.sahrawat@samsung.com>
      Signed-off-by: default avatarCasey Schaufler <cschaufler@localhost.localdomain>
      460d95a1
  16. Mar 29, 2019
  17. Mar 28, 2019
  18. Mar 27, 2019
  19. Mar 25, 2019
    • Arnd Bergmann's avatar
      selinux: avoid uninitialized variable warning · 98bbbb76
      Arnd Bergmann authored
      
      clang correctly points out a code path that would lead
      to an uninitialized variable use:
      
      security/selinux/netlabel.c:310:6: error: variable 'addr' is used uninitialized whenever 'if' condition is false
            [-Werror,-Wsometimes-uninitialized]
              if (ip_hdr(skb)->version == 4) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
      security/selinux/netlabel.c:322:40: note: uninitialized use occurs here
              rc = netlbl_conn_setattr(ep->base.sk, addr, &secattr);
                                                    ^~~~
      security/selinux/netlabel.c:310:2: note: remove the 'if' if its condition is always true
              if (ip_hdr(skb)->version == 4) {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      security/selinux/netlabel.c:291:23: note: initialize the variable 'addr' to silence this warning
              struct sockaddr *addr;
                                   ^
                                    = NULL
      
      This is probably harmless since we should not see ipv6 packets
      of CONFIG_IPV6 is disabled, but it's better to rearrange the code
      so this cannot happen.
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      [PM: removed old patchwork link, fixed checkpatch.pl style errors]
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      98bbbb76
    • Ondrej Mosnacek's avatar
      selinux: remove useless assignments · 9e0cfe28
      Ondrej Mosnacek authored
      
      The code incorrectly assigned directly to the variables instead of the
      values they point to. Since the values are already set to NULL/0 at the
      beginning of the function, we can simply remove these useless
      assignments.
      
      Reported-by: default avatarHariprasad Kelam <hariprasad.kelam@gmail.com>
      Fixes: fede1483 ("selinux: log invalid contexts in AVCs")
      Signed-off-by: default avatarOndrej Mosnacek <omosnace@redhat.com>
      [PM: removed a bad comment that was causing compiler warnings]
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      9e0cfe28
  20. Mar 22, 2019
  21. Mar 21, 2019
Loading