1. 24 Nov, 2009 2 commits
    • Serge E. Hallyn's avatar
      remove CONFIG_SECURITY_FILE_CAPABILITIES compile option · b3a222e5
      Serge E. Hallyn authored
      As far as I know, all distros currently ship kernels with default
      CONFIG_SECURITY_FILE_CAPABILITIES=y.  Since having the option on
      leaves a 'no_file_caps' option to boot without file capabilities,
      the main reason to keep the option is that turning it off saves
      you (on my s390x partition) 5k.  In particular, vmlinux sizes
      came to:
      
      without patch fscaps=n:		 	53598392
      without patch fscaps=y:		 	53603406
      with this patch applied:		53603342
      
      with the security-next tree.
      
      Against this we must weigh the fact that there is no simple way for
      userspace to figure out whether file capabilities are supported,
      while things like per-process securebits, capability bounding
      sets, and adding bits to pI if CAP_SETPCAP is in pE are not supported
      with SECURITY_FILE_CAPABILITIES=n, leaving a bit of a problem for
      applications wanting to know whether they can use them and/or why
      something failed.
      
      It also adds another subtly different set of semantics which we must
      maintain at the risk of severe security regressions.
      
      So this patch removes the SECURITY_FILE_CAPABILITIES compile
      option.  It drops the kernel size by about 50k over the stock
      SECURITY_FILE_CAPABILITIES=y kernel, by removing the
      cap_limit_ptraced_target() function.
      
      Changelog:
      	Nov 20: remove cap_limit_ptraced_target() as it's logic
      		was ifndef'ed.
      Signed-off-by: default avatarSerge E. Hallyn <serue@us.ibm.com>
      Acked-by: default avatarAndrew G. Morgan" <morgan@kernel.org>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      b3a222e5
    • Eric Paris's avatar
      SELinux: print denials for buggy kernel with unknown perms · 0bce9527
      Eric Paris authored
      Historically we've seen cases where permissions are requested for classes
      where they do not exist.  In particular we have seen CIFS forget to set
      i_mode to indicate it is a directory so when we later check something like
      remove_name we have problems since it wasn't defined in tclass file.  This
      used to result in a avc which included the permission 0x2000 or something.
      Currently the kernel will deny the operations (good thing) but will not
      print ANY information (bad thing).  First the auditdeny field is no
      extended to include unknown permissions.  After that is fixed the logic in
      avc_dump_query to output this information isn't right since it will remove
      the permission from the av and print the phrase "<NULL>".  This takes us
      back to the behavior before the classmap rewrite.
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      0bce9527
  2. 23 Nov, 2009 2 commits
  3. 22 Nov, 2009 1 commit
  4. 18 Nov, 2009 1 commit
  5. 09 Nov, 2009 1 commit
    • Eric Paris's avatar
      security: report the module name to security_module_request · dd8dbf2e
      Eric Paris authored
      For SELinux to do better filtering in userspace we send the name of the
      module along with the AVC denial when a program is denied module_request.
      
      Example output:
      
      type=SYSCALL msg=audit(11/03/2009 10:59:43.510:9) : arch=x86_64 syscall=write success=yes exit=2 a0=3 a1=7fc28c0d56c0 a2=2 a3=7fffca0d7440 items=0 ppid=1727 pid=1729 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=rpc.nfsd exe=/usr/sbin/rpc.nfsd subj=system_u:system_r:nfsd_t:s0 key=(null)
      type=AVC msg=audit(11/03/2009 10:59:43.510:9) : avc:  denied  { module_request } for  pid=1729 comm=rpc.nfsd kmod="net-pf-10" scontext=system_u:system_r:nfsd_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=system
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      dd8dbf2e
  6. 08 Nov, 2009 2 commits
  7. 03 Nov, 2009 1 commit
  8. 01 Nov, 2009 1 commit
  9. 29 Oct, 2009 3 commits
    • Serge E. Hallyn's avatar
      define convenient securebits masks for prctl users (v2) · 5975c725
      Serge E. Hallyn authored
      Hi James, would you mind taking the following into
      security-testing?
      
      The securebits are used by passing them to prctl with the
      PR_{S,G}ET_SECUREBITS commands.  But the defines must be
      shifted to be used in prctl, which begs to be confused and
      misused by userspace.  So define some more convenient
      values for userspace to specify.  This way userspace does
      
      	prctl(PR_SET_SECUREBITS, SECBIT_NOROOT);
      
      instead of
      
      	prctl(PR_SET_SECUREBITS, 1 << SECURE_NOROOT);
      
      (Thanks to Michael for the idea)
      
      This patch also adds include/linux/securebits to the installed headers.
      Then perhaps it can be included by glibc's sys/prctl.h.
      
      Changelog:
      	Oct 29: Stephen Rothwell points out that issecure can
      		be under __KERNEL__.
      	Oct 14: (Suggestions by Michael Kerrisk):
      		1. spell out SETUID in SECBIT_NO_SETUID*
      		2. SECBIT_X_LOCKED does not imply SECBIT_X
      		3. add definitions for keepcaps
              Oct 14: As suggested by Michael Kerrisk, don't
      		use SB_* as that convention is already in
      		use.  Use SECBIT_ prefix instead.
      Signed-off-by: default avatarSerge E. Hallyn <serue@us.ibm.com>
      Acked-by: default avatarAndrew G. Morgan <morgan@kernel.org>
      Acked-by: default avatarMichael Kerrisk <mtk.manpages@gmail.com>
      Cc: Ulrich Drepper <drepper@redhat.com>
      Cc: James Morris <jmorris@namei.org>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      5975c725
    • Randy Dunlap's avatar
      tpm: fix header for modular build · ff76ec18
      Randy Dunlap authored
      Fix build for TCG_TPM=m.  Header file doesn't handle this
      and incorrectly builds stubs.
      
      drivers/char/tpm/tpm.c:720: error: redefinition of 'tpm_pcr_read'
      include/linux/tpm.h:35: error:previous definition of 'tpm_pcr_read' was here
      drivers/char/tpm/tpm.c:752: error: redefinition of 'tpm_pcr_extend'
      include/linux/tpm.h:38: error:previous definition of 'tpm_pcr_extend' was here
      
      Repairs linux-next's
      
      commit d6ba4521
      Author: Mimi Zohar <zohar@linux.vnet.ibm.com>
      Date:   Mon Oct 26 09:26:18 2009 -0400
      
          tpm add default function definitions
      Signed-off-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
      Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
      Cc: Mimi Zohar <zohar@us.ibm.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Eric Paris <eparis@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      ff76ec18
    • Stephen Hemminger's avatar
      tomoyo: improve hash bucket dispersion · 024e1a49
      Stephen Hemminger authored
      When examining the network device name hash, it was discovered that
      the low order bits of full_name_hash() are not very well dispersed
      across the possible values. When used by filesystem code, this is handled
      by folding with the function hash_long().
      
      The only other non-filesystem usage of full_name_hash() at this time
      appears to be in TOMOYO. This patch should fix that.
      
      I do not use TOMOYO at this time, so this patch is build tested only.
      Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
      Acked-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      024e1a49
  10. 27 Oct, 2009 1 commit
  11. 25 Oct, 2009 1 commit
  12. 24 Oct, 2009 1 commit
  13. 20 Oct, 2009 2 commits
  14. 13 Oct, 2009 1 commit
  15. 11 Oct, 2009 3 commits
  16. 07 Oct, 2009 3 commits
    • Stephen Smalley's avatar
      selinux: drop remapping of netlink classes · 941fc5b2
      Stephen Smalley authored
      Drop remapping of netlink classes and bypass of permission checking
      based on netlink message type for policy version < 18.  This removes
      compatibility code introduced when the original single netlink
      security class used for all netlink sockets was split into
      finer-grained netlink classes based on netlink protocol and when
      permission checking was added based on netlink message type in Linux
      2.6.8.  The only known distribution that shipped with SELinux and
      policy < 18 was Fedora Core 2, which was EOL'd on 2005-04-11.
      
      Given that the remapping code was never updated to address the
      addition of newer netlink classes, that the corresponding userland
      support was dropped in 2005, and that the assumptions made by the
      remapping code about the fixed ordering among netlink classes in the
      policy may be violated in the future due to the dynamic class/perm
      discovery support, we should drop this compatibility code now.
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      941fc5b2
    • Stephen Smalley's avatar
      selinux: generate flask headers during kernel build · 8753f6be
      Stephen Smalley authored
      Add a simple utility (scripts/selinux/genheaders) and invoke it to
      generate the kernel-private class and permission indices in flask.h
      and av_permissions.h automatically during the kernel build from the
      security class mapping definitions in classmap.h.  Adding new kernel
      classes and permissions can then be done just by adding them to classmap.h.
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      8753f6be
    • Stephen Smalley's avatar
      selinux: dynamic class/perm discovery · c6d3aaa4
      Stephen Smalley authored
      Modify SELinux to dynamically discover class and permission values
      upon policy load, based on the dynamic object class/perm discovery
      logic from libselinux.  A mapping is created between kernel-private
      class and permission indices used outside the security server and the
      policy values used within the security server.
      
      The mappings are only applied upon kernel-internal computations;
      similar mappings for the private indices of userspace object managers
      is handled on a per-object manager basis by the userspace AVC.  The
      interfaces for compute_av and transition_sid are split for kernel
      vs. userspace; the userspace functions are distinguished by a _user
      suffix.
      
      The kernel-private class indices are no longer tied to the policy
      values and thus do not need to skip indices for userspace classes;
      thus the kernel class index values are compressed.  The flask.h
      definitions were regenerated by deleting the userspace classes from
      refpolicy's definitions and then regenerating the headers.  Going
      forward, we can just maintain the flask.h, av_permissions.h, and
      classmap.h definitions separately from policy as they are no longer
      tied to the policy values.  The next patch introduces a utility to
      automate generation of flask.h and av_permissions.h from the
      classmap.h definitions.
      
      The older kernel class and permission string tables are removed and
      replaced by a single security class mapping table that is walked at
      policy load to generate the mapping.  The old kernel class validation
      logic is completely replaced by the mapping logic.
      
      The handle unknown logic is reworked.  reject_unknown=1 is handled
      when the mappings are computed at policy load time, similar to the old
      handling by the class validation logic.  allow_unknown=1 is handled
      when computing and mapping decisions - if the permission was not able
      to be mapped (i.e. undefined, mapped to zero), then it is
      automatically added to the allowed vector.  If the class was not able
      to be mapped (i.e. undefined, mapped to zero), then all permissions
      are allowed for it if allow_unknown=1.
      
      avc_audit leverages the new security class mapping table to lookup the
      class and permission names from the kernel-private indices.
      
      The mdp program is updated to use the new table when generating the
      class definitions and allow rules for a minimal boot policy for the
      kernel.  It should be noted that this policy will not include any
      userspace classes, nor will its policy index values for the kernel
      classes correspond with the ones in refpolicy (they will instead match
      the kernel-private indices).
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      c6d3aaa4
  17. 30 Sep, 2009 2 commits
  18. 29 Sep, 2009 1 commit
  19. 27 Sep, 2009 11 commits