1. 30 5月, 2018 1 次提交
    • S
      selinux: KASAN: slab-out-of-bounds in xattr_getsecurity · efe3de79
      Sachin Grover 提交于
      Call trace:
       [<ffffff9203a8d7a8>] dump_backtrace+0x0/0x428
       [<ffffff9203a8dbf8>] show_stack+0x28/0x38
       [<ffffff920409bfb8>] dump_stack+0xd4/0x124
       [<ffffff9203d187e8>] print_address_description+0x68/0x258
       [<ffffff9203d18c00>] kasan_report.part.2+0x228/0x2f0
       [<ffffff9203d1927c>] kasan_report+0x5c/0x70
       [<ffffff9203d1776c>] check_memory_region+0x12c/0x1c0
       [<ffffff9203d17cdc>] memcpy+0x34/0x68
       [<ffffff9203d75348>] xattr_getsecurity+0xe0/0x160
       [<ffffff9203d75490>] vfs_getxattr+0xc8/0x120
       [<ffffff9203d75d68>] getxattr+0x100/0x2c8
       [<ffffff9203d76fb4>] SyS_fgetxattr+0x64/0xa0
       [<ffffff9203a83f70>] el0_svc_naked+0x24/0x28
      
      If user get root access and calls security.selinux setxattr() with an
      embedded NUL on a file and then if some process performs a getxattr()
      on that file with a length greater than the actual length of the string,
      it would result in a panic.
      
      To fix this, add the actual length of the string to the security context
      instead of the length passed by the userspace process.
      Signed-off-by: NSachin Grover <sgrover@codeaurora.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      efe3de79
  2. 21 3月, 2018 2 次提交
  3. 03 3月, 2018 1 次提交
  4. 02 3月, 2018 1 次提交
    • S
      selinux: wrap global selinux state · aa8e712c
      Stephen Smalley 提交于
      Define a selinux state structure (struct selinux_state) for
      global SELinux state and pass it explicitly to all security server
      functions.  The public portion of the structure contains state
      that is used throughout the SELinux code, such as the enforcing mode.
      The structure also contains a pointer to a selinux_ss structure whose
      definition is private to the security server and contains security
      server specific state such as the policy database and SID table.
      
      This change should have no effect on SELinux behavior or APIs
      (userspace or LSM).  It merely wraps SELinux state and passes it
      explicitly as needed.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      [PM: minor fixups needed due to collisions with the SCTP patches]
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      aa8e712c
  5. 06 12月, 2017 1 次提交
  6. 29 11月, 2017 1 次提交
  7. 21 9月, 2017 1 次提交
  8. 18 8月, 2017 1 次提交
  9. 03 8月, 2017 1 次提交
    • S
      selinux: Generalize support for NNP/nosuid SELinux domain transitions · af63f419
      Stephen Smalley 提交于
      As systemd ramps up enabling NNP (NoNewPrivileges) for system services,
      it is increasingly breaking SELinux domain transitions for those services
      and their descendants.  systemd enables NNP not only for services whose
      unit files explicitly specify NoNewPrivileges=yes but also for services
      whose unit files specify any of the following options in combination with
      running without CAP_SYS_ADMIN (e.g. specifying User= or a
      CapabilityBoundingSet= without CAP_SYS_ADMIN): SystemCallFilter=,
      SystemCallArchitectures=, RestrictAddressFamilies=, RestrictNamespaces=,
      PrivateDevices=, ProtectKernelTunables=, ProtectKernelModules=,
      MemoryDenyWriteExecute=, or RestrictRealtime= as per the systemd.exec(5)
      man page.
      
      The end result is bad for the security of both SELinux-disabled and
      SELinux-enabled systems.  Packagers have to turn off these
      options in the unit files to preserve SELinux domain transitions.  For
      users who choose to disable SELinux, this means that they miss out on
      at least having the systemd-supported protections.  For users who keep
      SELinux enabled, they may still be missing out on some protections
      because it isn't necessarily guaranteed that the SELinux policy for
      that service provides the same protections in all cases.
      
      commit 7b0d0b40 ("selinux: Permit bounded transitions under
      NO_NEW_PRIVS or NOSUID.") allowed bounded transitions under NNP in
      order to support limited usage for sandboxing programs.  However,
      defining typebounds for all of the affected service domains
      is impractical to implement in policy, since typebounds requires us
      to ensure that each domain is allowed everything all of its descendant
      domains are allowed, and this has to be repeated for the entire chain
      of domain transitions.  There is no way to clone all allow rules from
      descendants to their ancestors in policy currently, and doing so would
      be undesirable even if it were practical, as it requires leaking
      permissions to objects and operations into ancestor domains that could
      weaken their own security in order to allow them to the descendants
      (e.g. if a descendant requires execmem permission, then so do all of
      its ancestors; if a descendant requires execute permission to a file,
      then so do all of its ancestors; if a descendant requires read to a
      symbolic link or temporary file, then so do all of its ancestors...).
      SELinux domains are intentionally not hierarchical / bounded in this
      manner normally, and making them so would undermine their protections
      and least privilege.
      
      We have long had a similar tension with SELinux transitions and nosuid
      mounts, albeit not as severe.  Users often have had to choose between
      retaining nosuid on a mount and allowing SELinux domain transitions on
      files within those mounts.  This likewise leads to unfortunate tradeoffs
      in security.
      
      Decouple NNP/nosuid from SELinux transitions, so that we don't have to
      make a choice between them. Introduce a nnp_nosuid_transition policy
      capability that enables transitions under NNP/nosuid to be based on
      a permission (nnp_transition for NNP; nosuid_transition for nosuid)
      between the old and new contexts in addition to the current support
      for bounded transitions.  Domain transitions can then be allowed in
      policy without requiring the parent to be a strict superset of all of
      its children.
      
      With this change, systemd unit files can be left unmodified from upstream.
      SELinux-disabled and SELinux-enabled users will benefit from retaining any
      of the systemd-provided protections.  SELinux policy will only need to
      be adapted to enable the new policy capability and to allow the
      new permissions between domain pairs as appropriate.
      
      NB: Allowing nnp_transition between two contexts opens up the potential
      for the old context to subvert the new context by installing seccomp
      filters before the execve.  Allowing nosuid_transition between two contexts
      opens up the potential for a context transition to occur on a file from
      an untrusted filesystem (e.g. removable media or remote filesystem).  Use
      with care.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      af63f419
  10. 10 6月, 2017 1 次提交
  11. 24 5月, 2017 2 次提交
  12. 23 5月, 2017 1 次提交
    • S
      selinux: log policy capability state when a policy is loaded · 4dc2fce3
      Stephen Smalley 提交于
      Log the state of SELinux policy capabilities when a policy is loaded.
      For each policy capability known to the kernel, log the policy capability
      name and the value set in the policy.  For policy capabilities that are
      set in the loaded policy but unknown to the kernel, log the policy
      capability index, since this is the only information presently available
      in the policy.
      
      Sample output with a policy created with a new capability defined
      that is not known to the kernel:
      SELinux:  policy capability network_peer_controls=1
      SELinux:  policy capability open_perms=1
      SELinux:  policy capability extended_socket_class=1
      SELinux:  policy capability always_check_network=0
      SELinux:  policy capability cgroup_seclabel=0
      SELinux:  unknown policy capability 5
      
      Resolves: https://github.com/SELinuxProject/selinux-kernel/issues/32Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      4dc2fce3
  13. 30 3月, 2017 1 次提交
  14. 02 3月, 2017 1 次提交
  15. 09 1月, 2017 1 次提交
    • S
      selinux: support distinctions among all network address families · da69a530
      Stephen Smalley 提交于
      Extend SELinux to support distinctions among all network address families
      implemented by the kernel by defining new socket security classes
      and mapping to them. Otherwise, many sockets are mapped to the generic
      socket class and are indistinguishable in policy.  This has come up
      previously with regard to selectively allowing access to bluetooth sockets,
      and more recently with regard to selectively allowing access to AF_ALG
      sockets.  Guido Trentalancia submitted a patch that took a similar approach
      to add only support for distinguishing AF_ALG sockets, but this generalizes
      his approach to handle all address families implemented by the kernel.
      Socket security classes are also added for ICMP and SCTP sockets.
      Socket security classes were not defined for AF_* values that are reserved
      but unimplemented in the kernel, e.g. AF_NETBEUI, AF_SECURITY, AF_ASH,
      AF_ECONET, AF_SNA, AF_WANPIPE.
      
      Backward compatibility is provided by only enabling the finer-grained
      socket classes if a new policy capability is set in the policy; older
      policies will behave as before.  The legacy redhat1 policy capability
      that was only ever used in testing within Fedora for ptrace_child
      is reclaimed for this purpose; as far as I can tell, this policy
      capability is not enabled in any supported distro policy.
      
      Add a pair of conditional compilation guards to detect when new AF_* values
      are added so that we can update SELinux accordingly rather than having to
      belatedly update it long after new address families are introduced.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      da69a530
  16. 01 6月, 2016 1 次提交
    • S
      selinux: Only apply bounds checking to source types · 7ea59202
      Stephen Smalley 提交于
      The current bounds checking of both source and target types
      requires allowing any domain that has access to the child
      domain to also have the same permissions to the parent, which
      is undesirable.  Drop the target bounds checking.
      
      KaiGai Kohei originally removed all use of target bounds in
      commit 7d52a155 ("selinux: remove dead code in
      type_attribute_bounds_av()") but this was reverted in
      commit 2ae3ba39 ("selinux: libsepol: remove dead code in
      check_avtab_hierarchy_callback()") because it would have
      required explicitly allowing the parent any permissions
      to the child that the child is allowed to itself.
      
      This change in contrast retains the logic for the case where both
      source and target types are bounded, thereby allowing access
      if the parent of the source is allowed the corresponding
      permissions to the parent of the target.  Further, this change
      reworks the logic such that we only perform a single computation
      for each case and there is no ambiguity as to how to resolve
      a bounds violation.
      
      Under the new logic, if the source type and target types are both
      bounded, then the parent of the source type must be allowed the same
      permissions to the parent of the target type.  If only the source
      type is bounded, then the parent of the source type must be allowed
      the same permissions to the target type.
      
      Examples of the new logic and comparisons with the old logic:
      1. If we have:
      	typebounds A B;
      then:
      	allow B self:process <permissions>;
      will satisfy the bounds constraint iff:
      	allow A self:process <permissions>;
      is also allowed in policy.
      
      Under the old logic, the allow rule on B satisfies the
      bounds constraint if any of the following three are allowed:
      	allow A B:process <permissions>; or
      	allow B A:process <permissions>; or
      	allow A self:process <permissions>;
      However, either of the first two ultimately require the third to
      satisfy the bounds constraint under the old logic, and therefore
      this degenerates to the same result (but is more efficient - we only
      need to perform one compute_av call).
      
      2. If we have:
      	typebounds A B;
      	typebounds A_exec B_exec;
      then:
      	allow B B_exec:file <permissions>;
      will satisfy the bounds constraint iff:
      	allow A A_exec:file <permissions>;
      is also allowed in policy.
      
      This is essentially the same as #1; it is merely included as
      an example of dealing with object types related to a bounded domain
      in a manner that satisfies the bounds relationship.  Note that
      this approach is preferable to leaving B_exec unbounded and having:
      	allow A B_exec:file <permissions>;
      in policy because that would allow B's entrypoints to be used to
      enter A.  Similarly for _tmp or other related types.
      
      3. If we have:
      	typebounds A B;
      and an unbounded type T, then:
      	allow B T:file <permissions>;
      will satisfy the bounds constraint iff:
      	allow A T:file <permissions>;
      is allowed in policy.
      
      The old logic would have been identical for this example.
      
      4. If we have:
      	typebounds A B;
      and an unbounded domain D, then:
      	allow D B:unix_stream_socket <permissions>;
      is not subject to any bounds constraints under the new logic
      because D is not bounded.  This is desirable so that we can
      allow a domain to e.g. connectto a child domain without having
      to allow it to do the same to its parent.
      
      The old logic would have required:
      	allow D A:unix_stream_socket <permissions>;
      to also be allowed in policy.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      [PM: re-wrapped description to appease checkpatch.pl]
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      7ea59202
  17. 14 4月, 2016 1 次提交
    • P
      selinux: Change bool variable name to index. · 0fd71a62
      Prarit Bhargava 提交于
      security_get_bool_value(int bool) argument "bool" conflicts with
      in-kernel macros such as BUILD_BUG().  This patch changes this to
      index which isn't a type.
      
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Stephen Smalley <sds@tycho.nsa.gov>
      Cc: Eric Paris <eparis@parisplace.org>
      Cc: James Morris <james.l.morris@oracle.com>
      Cc: "Serge E. Hallyn" <serge@hallyn.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Andrew Perepechko <anserper@ya.ru>
      Cc: Jeff Vander Stoep <jeffv@google.com>
      Cc: selinux@tycho.nsa.gov
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Paul Moore <pmoore@redhat.com>
      Cc: David Howells <dhowells@redhat.com>
      Signed-off-by: NPrarit Bhargava <prarit@redhat.com>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      [PM: wrapped description for checkpatch.pl, use "selinux:..." as subj]
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      0fd71a62
  18. 25 12月, 2015 1 次提交
  19. 22 10月, 2015 4 次提交
  20. 14 7月, 2015 1 次提交
    • J
      selinux: extended permissions for ioctls · fa1aa143
      Jeff Vander Stoep 提交于
      Add extended permissions logic to selinux. Extended permissions
      provides additional permissions in 256 bit increments. Extend the
      generic ioctl permission check to use the extended permissions for
      per-command filtering. Source/target/class sets including the ioctl
      permission may additionally include a set of commands. Example:
      
      allowxperm <source> <target>:<class> ioctl unpriv_app_socket_cmds
      auditallowxperm <source> <target>:<class> ioctl priv_gpu_cmds
      
      Where unpriv_app_socket_cmds and priv_gpu_cmds are macros
      representing commonly granted sets of ioctl commands.
      
      When ioctl commands are omitted only the permissions are checked.
      This feature is intended to provide finer granularity for the ioctl
      permission that may be too imprecise. For example, the same driver
      may use ioctls to provide important and benign functionality such as
      driver version or socket type as well as dangerous capabilities such
      as debugging features, read/write/execute to physical memory or
      access to sensitive data. Per-command filtering provides a mechanism
      to reduce the attack surface of the kernel, and limit applications
      to the subset of commands required.
      
      The format of the policy binary has been modified to include ioctl
      commands, and the policy version number has been incremented to
      POLICYDB_VERSION_XPERMS_IOCTL=30 to account for the format
      change.
      
      The extended permissions logic is deliberately generic to allow
      components to be reused e.g. netlink filters
      Signed-off-by: NJeff Vander Stoep <jeffv@google.com>
      Acked-by: NNick Kralevich <nnk@google.com>
      Signed-off-by: NPaul Moore <pmoore@redhat.com>
      fa1aa143
  21. 07 4月, 2015 1 次提交
  22. 23 9月, 2014 1 次提交
  23. 24 6月, 2014 1 次提交
    • W
      selinux: no recursive read_lock of policy_rwlock in security_genfs_sid() · f31e7994
      Waiman Long 提交于
      With the introduction of fair queued rwlock, recursive read_lock()
      may hang the offending process if there is a write_lock() somewhere
      in between.
      
      With recursive read_lock checking enabled, the following error was
      reported:
      
      =============================================
      [ INFO: possible recursive locking detected ]
      3.16.0-rc1 #2 Tainted: G            E
      ---------------------------------------------
      load_policy/708 is trying to acquire lock:
       (policy_rwlock){.+.+..}, at: [<ffffffff8125b32a>]
      security_genfs_sid+0x3a/0x170
      
      but task is already holding lock:
       (policy_rwlock){.+.+..}, at: [<ffffffff8125b48c>]
      security_fs_use+0x2c/0x110
      
      other info that might help us debug this:
       Possible unsafe locking scenario:
      
             CPU0
             ----
        lock(policy_rwlock);
        lock(policy_rwlock);
      
      This patch fixes the occurrence of recursive read_lock() of
      policy_rwlock by adding a helper function __security_genfs_sid()
      which requires caller to take the lock before calling it. The
      security_fs_use() was then modified to call the new helper function.
      Signed-off-by: NWaiman Long <Waiman.Long@hp.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NPaul Moore <pmoore@redhat.com>
      f31e7994
  24. 10 3月, 2014 1 次提交
    • N
      selinux: add gfp argument to security_xfrm_policy_alloc and fix callers · 52a4c640
      Nikolay Aleksandrov 提交于
      security_xfrm_policy_alloc can be called in atomic context so the
      allocation should be done with GFP_ATOMIC. Add an argument to let the
      callers choose the appropriate way. In order to do so a gfp argument
      needs to be added to the method xfrm_policy_alloc_security in struct
      security_operations and to the internal function
      selinux_xfrm_alloc_user. After that switch to GFP_ATOMIC in the atomic
      callers and leave GFP_KERNEL as before for the rest.
      The path that needed the gfp argument addition is:
      security_xfrm_policy_alloc -> security_ops.xfrm_policy_alloc_security ->
      all users of xfrm_policy_alloc_security (e.g. selinux_xfrm_policy_alloc) ->
      selinux_xfrm_alloc_user (here the allocation used to be GFP_KERNEL only)
      
      Now adding a gfp argument to selinux_xfrm_alloc_user requires us to also
      add it to security_context_to_sid which is used inside and prior to this
      patch did only GFP_KERNEL allocation. So add gfp argument to
      security_context_to_sid and adjust all of its callers as well.
      
      CC: Paul Moore <paul@paul-moore.com>
      CC: Dave Jones <davej@redhat.com>
      CC: Steffen Klassert <steffen.klassert@secunet.com>
      CC: Fan Du <fan.du@windriver.com>
      CC: David S. Miller <davem@davemloft.net>
      CC: LSM list <linux-security-module@vger.kernel.org>
      CC: SELinux list <selinux@tycho.nsa.gov>
      Signed-off-by: NNikolay Aleksandrov <nikolay@redhat.com>
      Acked-by: NPaul Moore <paul@paul-moore.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      52a4c640
  25. 06 2月, 2014 1 次提交
    • S
      SELinux: Fix kernel BUG on empty security contexts. · 2172fa70
      Stephen Smalley 提交于
      Setting an empty security context (length=0) on a file will
      lead to incorrectly dereferencing the type and other fields
      of the security context structure, yielding a kernel BUG.
      As a zero-length security context is never valid, just reject
      all such security contexts whether coming from userspace
      via setxattr or coming from the filesystem upon a getxattr
      request by SELinux.
      
      Setting a security context value (empty or otherwise) unknown to
      SELinux in the first place is only possible for a root process
      (CAP_MAC_ADMIN), and, if running SELinux in enforcing mode, only
      if the corresponding SELinux mac_admin permission is also granted
      to the domain by policy.  In Fedora policies, this is only allowed for
      specific domains such as livecd for setting down security contexts
      that are not defined in the build host policy.
      
      Reproducer:
      su
      setenforce 0
      touch foo
      setfattr -n security.selinux foo
      
      Caveat:
      Relabeling or removing foo after doing the above may not be possible
      without booting with SELinux disabled.  Any subsequent access to foo
      after doing the above will also trigger the BUG.
      
      BUG output from Matthew Thode:
      [  473.893141] ------------[ cut here ]------------
      [  473.962110] kernel BUG at security/selinux/ss/services.c:654!
      [  473.995314] invalid opcode: 0000 [#6] SMP
      [  474.027196] Modules linked in:
      [  474.058118] CPU: 0 PID: 8138 Comm: ls Tainted: G      D   I
      3.13.0-grsec #1
      [  474.116637] Hardware name: Supermicro X8ST3/X8ST3, BIOS 2.0
      07/29/10
      [  474.149768] task: ffff8805f50cd010 ti: ffff8805f50cd488 task.ti:
      ffff8805f50cd488
      [  474.183707] RIP: 0010:[<ffffffff814681c7>]  [<ffffffff814681c7>]
      context_struct_compute_av+0xce/0x308
      [  474.219954] RSP: 0018:ffff8805c0ac3c38  EFLAGS: 00010246
      [  474.252253] RAX: 0000000000000000 RBX: ffff8805c0ac3d94 RCX:
      0000000000000100
      [  474.287018] RDX: ffff8805e8aac000 RSI: 00000000ffffffff RDI:
      ffff8805e8aaa000
      [  474.321199] RBP: ffff8805c0ac3cb8 R08: 0000000000000010 R09:
      0000000000000006
      [  474.357446] R10: 0000000000000000 R11: ffff8805c567a000 R12:
      0000000000000006
      [  474.419191] R13: ffff8805c2b74e88 R14: 00000000000001da R15:
      0000000000000000
      [  474.453816] FS:  00007f2e75220800(0000) GS:ffff88061fc00000(0000)
      knlGS:0000000000000000
      [  474.489254] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  474.522215] CR2: 00007f2e74716090 CR3: 00000005c085e000 CR4:
      00000000000207f0
      [  474.556058] Stack:
      [  474.584325]  ffff8805c0ac3c98 ffffffff811b549b ffff8805c0ac3c98
      ffff8805f1190a40
      [  474.618913]  ffff8805a6202f08 ffff8805c2b74e88 00068800d0464990
      ffff8805e8aac860
      [  474.653955]  ffff8805c0ac3cb8 000700068113833a ffff880606c75060
      ffff8805c0ac3d94
      [  474.690461] Call Trace:
      [  474.723779]  [<ffffffff811b549b>] ? lookup_fast+0x1cd/0x22a
      [  474.778049]  [<ffffffff81468824>] security_compute_av+0xf4/0x20b
      [  474.811398]  [<ffffffff8196f419>] avc_compute_av+0x2a/0x179
      [  474.843813]  [<ffffffff8145727b>] avc_has_perm+0x45/0xf4
      [  474.875694]  [<ffffffff81457d0e>] inode_has_perm+0x2a/0x31
      [  474.907370]  [<ffffffff81457e76>] selinux_inode_getattr+0x3c/0x3e
      [  474.938726]  [<ffffffff81455cf6>] security_inode_getattr+0x1b/0x22
      [  474.970036]  [<ffffffff811b057d>] vfs_getattr+0x19/0x2d
      [  475.000618]  [<ffffffff811b05e5>] vfs_fstatat+0x54/0x91
      [  475.030402]  [<ffffffff811b063b>] vfs_lstat+0x19/0x1b
      [  475.061097]  [<ffffffff811b077e>] SyS_newlstat+0x15/0x30
      [  475.094595]  [<ffffffff8113c5c1>] ? __audit_syscall_entry+0xa1/0xc3
      [  475.148405]  [<ffffffff8197791e>] system_call_fastpath+0x16/0x1b
      [  475.179201] Code: 00 48 85 c0 48 89 45 b8 75 02 0f 0b 48 8b 45 a0 48
      8b 3d 45 d0 b6 00 8b 40 08 89 c6 ff ce e8 d1 b0 06 00 48 85 c0 49 89 c7
      75 02 <0f> 0b 48 8b 45 b8 4c 8b 28 eb 1e 49 8d 7d 08 be 80 01 00 00 e8
      [  475.255884] RIP  [<ffffffff814681c7>]
      context_struct_compute_av+0xce/0x308
      [  475.296120]  RSP <ffff8805c0ac3c38>
      [  475.328734] ---[ end trace f076482e9d754adc ]---
      Reported-by: NMatthew Thode <mthode@mthode.org>
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPaul Moore <pmoore@redhat.com>
      2172fa70
  26. 14 1月, 2014 1 次提交
  27. 16 12月, 2013 1 次提交
  28. 14 12月, 2013 1 次提交
    • P
      selinux: revert 102aefdd · 4d546f81
      Paul Moore 提交于
      Revert "selinux: consider filesystem subtype in policies"
      
      This reverts commit 102aefdd.
      
      Explanation from Eric Paris:
      
      	SELinux policy can specify if it should use a filesystem's
      	xattrs or not.  In current policy we have a specification that
      	fuse should not use xattrs but fuse.glusterfs should use
      	xattrs.  This patch has a bug in which non-glusterfs
      	filesystems would match the rule saying fuse.glusterfs should
      	use xattrs.  If both fuse and the particular filesystem in
      	question are not written to handle xattr calls during the mount
      	command, they will deadlock.
      
      	I have fixed the bug to do proper matching, however I believe a
      	revert is still the correct solution.  The reason I believe
      	that is because the code still does not work.  The s_subtype is
      	not set until after the SELinux hook which attempts to match on
      	the ".gluster" portion of the rule.  So we cannot match on the
      	rule in question.  The code is useless.
      Signed-off-by: NPaul Moore <pmoore@redhat.com>
      4d546f81
  29. 20 11月, 2013 1 次提交
    • T
      SELinux: security_load_policy: Silence frame-larger-than warning · b5495b42
      Tim Gardner 提交于
      Dynamically allocate a couple of the larger stack variables in order to
      reduce the stack footprint below 1024. gcc-4.8
      
      security/selinux/ss/services.c: In function 'security_load_policy':
      security/selinux/ss/services.c:1964:1: warning: the frame size of 1104 bytes is larger than 1024 bytes [-Wframe-larger-than=]
       }
      
      Also silence a couple of checkpatch warnings at the same time.
      
      WARNING: sizeof policydb should be sizeof(policydb)
      +	memcpy(oldpolicydb, &policydb, sizeof policydb);
      
      WARNING: sizeof policydb should be sizeof(policydb)
      +	memcpy(&policydb, newpolicydb, sizeof policydb);
      
      Cc: Stephen Smalley <sds@tycho.nsa.gov>
      Cc: James Morris <james.l.morris@oracle.com>
      Cc: Eric Paris <eparis@parisplace.org>
      Signed-off-by: NTim Gardner <tim.gardner@canonical.com>
      Signed-off-by: NPaul Moore <pmoore@redhat.com>
      b5495b42
  30. 29 8月, 2013 1 次提交
    • A
      selinux: consider filesystem subtype in policies · 102aefdd
      Anand Avati 提交于
      Not considering sub filesystem has the following limitation. Support
      for SELinux in FUSE is dependent on the particular userspace
      filesystem, which is identified by the subtype. For e.g, GlusterFS,
      a FUSE based filesystem supports SELinux (by mounting and processing
      FUSE requests in different threads, avoiding the mount time
      deadlock), whereas other FUSE based filesystems (identified by a
      different subtype) have the mount time deadlock.
      
      By considering the subtype of the filesytem in the SELinux policies,
      allows us to specify a filesystem subtype, in the following way:
      
      fs_use_xattr fuse.glusterfs gen_context(system_u:object_r:fs_t,s0);
      
      This way not all FUSE filesystems are put in the same bucket and
      subjected to the limitations of the other subtypes.
      Signed-off-by: NAnand Avati <avati@redhat.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      102aefdd
  31. 26 7月, 2013 3 次提交
    • C
      Add SELinux policy capability for always checking packet and peer classes. · 2be4d74f
      Chris PeBenito 提交于
      Currently the packet class in SELinux is not checked if there are no
      SECMARK rules in the security or mangle netfilter tables.  Some systems
      prefer that packets are always checked, for example, to protect the system
      should the netfilter rules fail to load or if the nefilter rules
      were maliciously flushed.
      
      Add the always_check_network policy capability which, when enabled, treats
      SECMARK as enabled, even if there are no netfilter SECMARK rules and
      treats peer labeling as enabled, even if there is no Netlabel or
      labeled IPSEC configuration.
      
      Includes definition of "redhat1" SELinux policy capability, which
      exists in the SELinux userpace library, to keep ordering correct.
      
      The SELinux userpace portion of this was merged last year, but this kernel
      change fell on the floor.
      Signed-off-by: NChris PeBenito <cpebenito@tresys.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      2be4d74f
    • E
      SELinux: pass a superblock to security_fs_use · a64c54cf
      Eric Paris 提交于
      Rather than passing pointers to memory locations, strings, and other
      stuff just give up on the separation and give security_fs_use the
      superblock.  It just makes the code easier to read (even if not easier to
      reuse on some other OS)
      Signed-off-by: NEric Paris <eparis@redhat.com>
      a64c54cf
    • E
      SELinux: change sbsec->behavior to short · f936c6e5
      Eric Paris 提交于
      We only have 6 options, so char is good enough, but use a short as that
      packs nicely.  This shrinks the superblock_security_struct just a little
      bit.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      f936c6e5
  32. 21 9月, 2012 1 次提交
  33. 10 4月, 2012 1 次提交