1. 06 2月, 2020 1 次提交
    • C
      broken ping to ipv6 linklocal addresses on debian buster · 87fbfffc
      Casey Schaufler 提交于
      I am seeing ping failures to IPv6 linklocal addresses with Debian
      buster. Easiest example to reproduce is:
      
      $ ping -c1 -w1 ff02::1%eth1
      connect: Invalid argument
      
      $ ping -c1 -w1 ff02::1%eth1
      PING ff02::01%eth1(ff02::1%eth1) 56 data bytes
      64 bytes from fe80::e0:f9ff:fe0c:37%eth1: icmp_seq=1 ttl=64 time=0.059 ms
      
      git bisect traced the failure to
      commit b9ef5513 ("smack: Check address length before reading address family")
      
      Arguably ping is being stupid since the buster version is not setting
      the address family properly (ping on stretch for example does):
      
      $ strace -e connect ping6 -c1 -w1 ff02::1%eth1
      connect(5, {sa_family=AF_UNSPEC,
      sa_data="\4\1\0\0\0\0\377\2\0\0\0\0\0\0\0\0\0\0\0\0\0\1\3\0\0\0"}, 28)
      = -1 EINVAL (Invalid argument)
      
      but the command works fine on kernels prior to this commit, so this is
      breakage which goes against the Linux paradigm of "don't break userspace"
      
      Cc: stable@vger.kernel.org
      Reported-by: NDavid Ahern <dsahern@gmail.com>
      Suggested-by: NTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      
       security/smack/smack_lsm.c | 41 +++++++++++++++++++----------------------
       1 file changed, 19 insertions(+), 22 deletions(-)
      87fbfffc
  2. 28 1月, 2020 1 次提交
  3. 23 1月, 2020 7 次提交
  4. 20 1月, 2020 1 次提交
    • S
      selinux: fix regression introduced by move_mount(2) syscall · 98aa0034
      Stephen Smalley 提交于
      commit 2db154b3 ("vfs: syscall: Add move_mount(2) to move mounts around")
      introduced a new move_mount(2) system call and a corresponding new LSM
      security_move_mount hook but did not implement this hook for any existing
      LSM.  This creates a regression for SELinux with respect to consistent
      checking of mounts; the existing selinux_mount hook checks mounton
      permission to the mount point path.  Provide a SELinux hook
      implementation for move_mount that applies this same check for
      consistency.  In the future we may wish to add a new move_mount
      filesystem permission and check as well, but this addresses
      the immediate regression.
      
      Fixes: 2db154b3 ("vfs: syscall: Add move_mount(2) to move mounts around")
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Reviewed-by: NOndrej Mosnacek <omosnace@redhat.com>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      98aa0034
  5. 17 1月, 2020 4 次提交
    • O
      selinux: do not allocate ancillary buffer on first load · dd89b9d9
      Ondrej Mosnacek 提交于
      In security_load_policy(), we can defer allocating the newpolicydb
      ancillary array to after checking state->initialized, thereby avoiding
      the pointless allocation when loading policy the first time.
      Signed-off-by: NOndrej Mosnacek <omosnace@redhat.com>
      [PM: merged portions by hand]
      Reviewed-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      dd89b9d9
    • P
      selinux: remove redundant allocation and helper functions · cb89e246
      Paul Moore 提交于
      This patch removes the inode, file, and superblock security blob
      allocation functions and moves the associated code into the
      respective LSM hooks.  This patch also removes the inode_doinit()
      function as it was a trivial wrapper around
      inode_doinit_with_dentry() and called from one location in the code.
      Reviewed-by: NCasey Schaufler <casey@schaufler-ca.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      cb89e246
    • H
      selinux: remove redundant selinux_nlmsg_perm · df4779b5
      Huaisheng Ye 提交于
      selinux_nlmsg_perm is used for only by selinux_netlink_send. Remove
      the redundant function to simplify the code.
      
      Fix a typo by suggestion from Stephen.
      Signed-off-by: NHuaisheng Ye <yehs1@lenovo.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      df4779b5
    • O
      selinux: fix wrong buffer types in policydb.c · ae3d8c2e
      Ondrej Mosnacek 提交于
      Two places used u32 where there should have been __le32.
      
      Fixes sparse warnings:
        CHECK   [...]/security/selinux/ss/services.c
      [...]/security/selinux/ss/policydb.c:2669:16: warning: incorrect type in assignment (different base types)
      [...]/security/selinux/ss/policydb.c:2669:16:    expected unsigned int
      [...]/security/selinux/ss/policydb.c:2669:16:    got restricted __le32 [usertype]
      [...]/security/selinux/ss/policydb.c:2674:24: warning: incorrect type in assignment (different base types)
      [...]/security/selinux/ss/policydb.c:2674:24:    expected unsigned int
      [...]/security/selinux/ss/policydb.c:2674:24:    got restricted __le32 [usertype]
      [...]/security/selinux/ss/policydb.c:2675:24: warning: incorrect type in assignment (different base types)
      [...]/security/selinux/ss/policydb.c:2675:24:    expected unsigned int
      [...]/security/selinux/ss/policydb.c:2675:24:    got restricted __le32 [usertype]
      [...]/security/selinux/ss/policydb.c:2676:24: warning: incorrect type in assignment (different base types)
      [...]/security/selinux/ss/policydb.c:2676:24:    expected unsigned int
      [...]/security/selinux/ss/policydb.c:2676:24:    got restricted __le32 [usertype]
      [...]/security/selinux/ss/policydb.c:2681:32: warning: incorrect type in assignment (different base types)
      [...]/security/selinux/ss/policydb.c:2681:32:    expected unsigned int
      [...]/security/selinux/ss/policydb.c:2681:32:    got restricted __le32 [usertype]
      [...]/security/selinux/ss/policydb.c:2701:16: warning: incorrect type in assignment (different base types)
      [...]/security/selinux/ss/policydb.c:2701:16:    expected unsigned int
      [...]/security/selinux/ss/policydb.c:2701:16:    got restricted __le32 [usertype]
      [...]/security/selinux/ss/policydb.c:2706:24: warning: incorrect type in assignment (different base types)
      [...]/security/selinux/ss/policydb.c:2706:24:    expected unsigned int
      [...]/security/selinux/ss/policydb.c:2706:24:    got restricted __le32 [usertype]
      [...]/security/selinux/ss/policydb.c:2707:24: warning: incorrect type in assignment (different base types)
      [...]/security/selinux/ss/policydb.c:2707:24:    expected unsigned int
      [...]/security/selinux/ss/policydb.c:2707:24:    got restricted __le32 [usertype]
      Signed-off-by: NOndrej Mosnacek <omosnace@redhat.com>
      Reviewed-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      ae3d8c2e
  6. 15 1月, 2020 1 次提交
  7. 11 1月, 2020 6 次提交
  8. 10 1月, 2020 2 次提交
  9. 08 1月, 2020 1 次提交
    • S
      Documentation,selinux: fix references to old selinuxfs mount point · d41415eb
      Stephen Smalley 提交于
      selinuxfs was originally mounted on /selinux, and various docs and
      kconfig help texts referred to nodes under it.  In Linux 3.0,
      /sys/fs/selinux was introduced as the preferred mount point for selinuxfs.
      Fix all the old references to /selinux/ to /sys/fs/selinux/.
      While we are there, update the description of the selinux boot parameter
      to reflect the fact that the default value is always 1 since
      commit be6ec88f ("selinux: Remove SECURITY_SELINUX_BOOTPARAM_VALUE")
      and drop discussion of runtime disable since it is deprecated.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      d41415eb
  10. 07 1月, 2020 3 次提交
  11. 05 1月, 2020 1 次提交
  12. 02 1月, 2020 3 次提交
  13. 25 12月, 2019 1 次提交
    • Y
      selinux: remove set but not used variable 'sidtab' · f1268534
      YueHaibing 提交于
      security/selinux/ss/services.c: In function security_port_sid:
      security/selinux/ss/services.c:2346:17: warning: variable sidtab set but not used [-Wunused-but-set-variable]
      security/selinux/ss/services.c: In function security_ib_endport_sid:
      security/selinux/ss/services.c:2435:17: warning: variable sidtab set but not used [-Wunused-but-set-variable]
      security/selinux/ss/services.c: In function security_netif_sid:
      security/selinux/ss/services.c:2480:17: warning: variable sidtab set but not used [-Wunused-but-set-variable]
      security/selinux/ss/services.c: In function security_fs_use:
      security/selinux/ss/services.c:2831:17: warning: variable sidtab set but not used [-Wunused-but-set-variable]
      
      Since commit 66f8e2f0 ("selinux: sidtab reverse lookup hash table")
      'sidtab' is not used any more, so remove it.
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      f1268534
  14. 24 12月, 2019 1 次提交
  15. 21 12月, 2019 1 次提交
  16. 19 12月, 2019 2 次提交
    • S
      selinux: randomize layout of key structures · 5c108d4e
      Stephen Smalley 提交于
      Randomize the layout of key selinux data structures.
      Initially this is applied to the selinux_state, selinux_ss,
      policydb, and task_security_struct data structures.
      
      NB To test/use this mechanism, one must install the
      necessary build-time dependencies, e.g. gcc-plugin-devel on Fedora,
      and enable CONFIG_GCC_PLUGIN_RANDSTRUCT in the kernel configuration.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      [PM: double semi-colon fixed]
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      5c108d4e
    • S
      selinux: clean up selinux_enabled/disabled/enforcing_boot · 6c5a682e
      Stephen Smalley 提交于
      Rename selinux_enabled to selinux_enabled_boot to make it clear that
      it only reflects whether SELinux was enabled at boot.  Replace the
      references to it in the MAC_STATUS audit log in sel_write_enforce()
      with hardcoded "1" values because this code is only reachable if SELinux
      is enabled and does not change its value, and update the corresponding
      MAC_STATUS audit log in sel_write_disable().  Stop clearing
      selinux_enabled in selinux_disable() since it is not used outside of
      initialization code that runs before selinux_disable() can be reached.
      Mark both selinux_enabled_boot and selinux_enforcing_boot as __initdata
      since they are only used in initialization code.
      
      Wrap the disabled field in the struct selinux_state with
      CONFIG_SECURITY_SELINUX_DISABLE since it is only used for
      runtime disable.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      6c5a682e
  17. 17 12月, 2019 1 次提交
  18. 16 12月, 2019 1 次提交
  19. 13 12月, 2019 1 次提交
  20. 12 12月, 2019 1 次提交
    • L
      IMA: Read keyrings= option from the IMA policy · 2b60c0ec
      Lakshmi Ramasubramanian 提交于
      Read "keyrings=" option, if specified in the IMA policy, and store in
      the list of IMA rules when the configured IMA policy is read.
      
      This patch defines a new policy token enum namely Opt_keyrings
      and an option flag IMA_KEYRINGS for reading "keyrings=" option
      from the IMA policy.
      
      Updated ima_parse_rule() to parse "keyrings=" option in the policy.
      Updated ima_policy_show() to display "keyrings=" option.
      
      The following example illustrates how key measurement can be verified.
      
      Sample "key" measurement rule in the IMA policy:
      
      measure func=KEY_CHECK uid=0 keyrings=.ima|.evm template=ima-buf
      
      Display "key" measurement in the IMA measurement list:
      
      cat /sys/kernel/security/ima/ascii_runtime_measurements
      
      10 faf3...e702 ima-buf sha256:27c915b8ddb9fae7214cf0a8a7043cc3eeeaa7539bcb136f8427067b5f6c3b7b .ima 308202863082...4aee
      
      Verify "key" measurement data for a key added to ".ima" keyring:
      
      cat /sys/kernel/security/integrity/ima/ascii_runtime_measurements | grep -m 1 "\.ima" | cut -d' ' -f 6 | xxd -r -p |tee ima-cert.der | sha256sum | cut -d' ' -f 1
      
      The output of the above command should match the template hash
      of the first "key" measurement entry in the IMA measurement list for
      the key added to ".ima" keyring.
      
      The file namely "ima-cert.der" generated by the above command
      should be a valid x509 certificate (in DER format) and should match
      the one that was used to import the key to the ".ima" keyring.
      The certificate file can be verified using openssl tool.
      Signed-off-by: NLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
      2b60c0ec