1. 11 11月, 2016 3 次提交
    • H
      SMACK: Fix the memory leak in smack_cred_prepare() hook · b437aba8
      Himanshu Shukla 提交于
      Memory leak in smack_cred_prepare()function.
      smack_cred_prepare() hook returns error if there is error in allocating
      memory in smk_copy_rules() or smk_copy_relabel() function.
      If smack_cred_prepare() function returns error then the calling
      function should call smack_cred_free() function for cleanup.
      In smack_cred_free() function first credential is  extracted and
      then all rules are deleted. In smack_cred_prepare() function security
      field is assigned in the end when all function return success. But this
      function may return before and memory will not be freed.
      Signed-off-by: NHimanshu Shukla <himanshu.sh@samsung.com>
      Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
      b437aba8
    • H
      SMACK: Do not apply star label in smack_setprocattr hook · 7128ea15
      Himanshu Shukla 提交于
      Smack prohibits processes from using the star ("*") and web ("@") labels.
      Checks have been added in other functions. In smack_setprocattr()
      hook, only check for web ("@") label has been added and restricted
      from applying web ("@") label.
      Check for star ("*") label should also be added in smack_setprocattr()
      hook. Return error should be "-EINVAL" not "-EPERM" as permission
      is there for setting label but not the label value as star ("*") or
      web ("@").
      Signed-off-by: NHimanshu Shukla <himanshu.sh@samsung.com>
      Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
      7128ea15
    • H
      smack: parse mnt opts after privileges check · 2097f599
      Himanshu Shukla 提交于
      In smack_set_mnt_opts()first the SMACK mount options are being
      parsed and later it is being checked whether the user calling
      mount has CAP_MAC_ADMIN capability.
      This sequence of operationis will allow unauthorized user to add
      SMACK labels in label list and may cause denial of security attack
      by adding many labels by allocating kernel memory by unauthorized user.
      Superblock smack flag is also being set as initialized though function
      may return with EPERM error.
      First check the capability of calling user then set the SMACK attributes
      and smk_flags.
      Signed-off-by: NHimanshu Shukla <himanshu.sh@samsung.com>
      Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
      2097f599
  2. 05 11月, 2016 1 次提交
  3. 08 10月, 2016 1 次提交
  4. 09 9月, 2016 1 次提交
    • C
      Smack: Signal delivery as an append operation · c60b9066
      Casey Schaufler 提交于
      Under a strict subject/object security policy delivering a
      signal or delivering network IPC could be considered either
      a write or an append operation. The original choice to make
      both write operations leads to an issue where IPC delivery
      is desired under policy, but delivery of signals is not.
      This patch provides the option of making signal delivery
      an append operation, allowing Smack rules that deny signal
      delivery while allowing IPC. This was requested for Tizen.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      c60b9066
  5. 28 6月, 2016 1 次提交
  6. 25 6月, 2016 1 次提交
  7. 24 6月, 2016 1 次提交
    • S
      Smack: Add support for unprivileged mounts from user namespaces · 9f50eda2
      Seth Forshee 提交于
      Security labels from unprivileged mounts cannot be trusted.
      Ideally for these mounts we would assign the objects in the
      filesystem the same label as the inode for the backing device
      passed to mount. Unfortunately it's currently impossible to
      determine which inode this is from the LSM mount hooks, so we
      settle for the label of the process doing the mount.
      
      This label is assigned to s_root, and also to smk_default to
      ensure that new inodes receive this label. The transmute property
      is also set on s_root to make this behavior more explicit, even
      though it is technically not necessary.
      
      If a filesystem has existing security labels, access to inodes is
      permitted if the label is the same as smk_root, otherwise access
      is denied. The SMACK64EXEC xattr is completely ignored.
      
      Explicit setting of security labels continues to require
      CAP_MAC_ADMIN in init_user_ns.
      
      Altogether, this ensures that filesystem objects are not
      accessible to subjects which cannot already access the backing
      store, that MAC is not violated for any objects in the fileystem
      which are already labeled, and that a user cannot use an
      unprivileged mount to gain elevated MAC privileges.
      
      sysfs, tmpfs, and ramfs are already mountable from user
      namespaces and support security labels. We can't rule out the
      possibility that these filesystems may already be used in mounts
      from user namespaces with security lables set from the init
      namespace, so failing to trust lables in these filesystems may
      introduce regressions. It is safe to trust labels from these
      filesystems, since the unprivileged user does not control the
      backing store and thus cannot supply security labels, so an
      explicit exception is made to trust labels from these
      filesystems.
      Signed-off-by: NSeth Forshee <seth.forshee@canonical.com>
      Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      9f50eda2
  8. 09 6月, 2016 1 次提交
    • R
      Smack: ignore null signal in smack_task_kill · 18d872f7
      Rafal Krypa 提交于
      Kill with signal number 0 is commonly used for checking PID existence.
      Smack treated such cases like any other kills, although no signal is
      actually delivered when sig == 0.
      
      Checking permissions when sig == 0 didn't prevent an unprivileged caller
      from learning whether PID exists or not. When it existed, kernel returned
      EPERM, when it didn't - ESRCH. The only effect of policy check in such
      case is noise in audit logs.
      
      This change lets Smack silently ignore kill() invocations with sig == 0.
      Signed-off-by: NRafal Krypa <r.krypa@samsung.com>
      Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
      18d872f7
  9. 28 5月, 2016 1 次提交
  10. 11 4月, 2016 2 次提交
  11. 17 2月, 2016 1 次提交
  12. 12 2月, 2016 1 次提交
    • C
      Smack: Remove pointless hooks · 491a0b08
      Casey Schaufler 提交于
      Prior to the 4.2 kernel there no no harm in providing
      a security module hook that does nothing, as the default
      hook would get called if the module did not supply one.
      With the list based infrastructure an empty hook adds
      overhead. This patch removes the three Smack hooks that
      don't actually do anything.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      491a0b08
  13. 21 1月, 2016 1 次提交
  14. 25 12月, 2015 2 次提交
  15. 18 12月, 2015 1 次提交
  16. 14 12月, 2015 1 次提交
  17. 10 12月, 2015 1 次提交
    • C
      Smack: File receive for sockets · 79be0935
      Casey Schaufler 提交于
      The existing file receive hook checks for access on
      the file inode even for UDS. This is not right, as
      the inode is not used by Smack to make access checks
      for sockets. This change checks for an appropriate
      access relationship between the receiving (current)
      process and the socket. If the process can't write
      to the socket's send label or the socket's receive
      label can't write to the process fail.
      
      This will allow the legitimate cases, where the
      socket sender and socket receiver can freely communicate.
      Only strangly set socket labels should cause a problem.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      79be0935
  18. 20 10月, 2015 1 次提交
    • Z
      Smack: limited capability for changing process label · 38416e53
      Zbigniew Jasinski 提交于
      This feature introduces new kernel interface:
      
      - <smack_fs>/relabel-self - for setting transition labels list
      
      This list is used to control smack label transition mechanism.
      List is set by, and per process. Process can transit to new label only if
      label is on the list. Only process with CAP_MAC_ADMIN capability can add
      labels to this list. With this list, process can change it's label without
      CAP_MAC_ADMIN but only once. After label changing, list is unset.
      
      Changes in v2:
      * use list_for_each_entry instead of _rcu during label write
      * added missing description in security/Smack.txt
      
      Changes in v3:
      * squashed into one commit
      
      Changes in v4:
      * switch from global list to per-task list
      * since the per-task list is accessed only by the task itself
        there is no need to use synchronization mechanisms on it
      
      Changes in v5:
      * change smackfs interface of relabel-self to the one used for onlycap
        multiple labels are accepted, separated by space, which
        replace the previous list upon write
      Signed-off-by: NZbigniew Jasinski <z.jasinski@samsung.com>
      Signed-off-by: NRafal Krypa <r.krypa@samsung.com>
      Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
      38416e53
  19. 10 10月, 2015 3 次提交
  20. 13 8月, 2015 1 次提交
  21. 01 8月, 2015 1 次提交
  22. 28 7月, 2015 1 次提交
    • C
      Smack: IPv6 host labeling · 21abb1ec
      Casey Schaufler 提交于
      IPv6 appears to be (finally) coming of age with the
      influx of autonomous devices. In support of this, add
      the ability to associate a Smack label with IPv6 addresses.
      
      This patch also cleans up some of the conditional
      compilation associated with the introduction of
      secmark processing. It's now more obvious which bit
      of code goes with which feature.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      21abb1ec
  23. 23 7月, 2015 1 次提交
  24. 15 5月, 2015 2 次提交
    • L
      smack: pass error code through pointers · e774ad68
      Lukasz Pawelczyk 提交于
      This patch makes the following functions to use ERR_PTR() and related
      macros to pass the appropriate error code through returned pointers:
      
      smk_parse_smack()
      smk_import_entry()
      smk_fetch()
      
      It also makes all the other functions that use them to handle the
      error cases properly. This ways correct error codes from places
      where they happened can be propagated to the user space if necessary.
      
      Doing this it fixes a bug in onlycap and unconfined files
      handling. Previously their content was cleared on any error from
      smk_import_entry/smk_parse_smack, be it EINVAL (as originally intended)
      or ENOMEM. Right now it only reacts on EINVAL passing other codes
      properly to userspace.
      
      Comments have been updated accordingly.
      Signed-off-by: NLukasz Pawelczyk <l.pawelczyk@samsung.com>
      e774ad68
    • S
      Smack: ignore private inode for smack_file_receive · 9777582e
      Seung-Woo Kim 提交于
      The dmabuf fd can be shared between processes via unix domain
      socket. The file of dmabuf fd is came from anon_inode. The inode
      has no set and get xattr operations, so it can not be shared
      between processes with smack. This patch fixes just to ignore
      private inode including anon_inode for smack_file_receive.
      Signed-off-by: NSeung-Woo Kim <sw0312.kim@samsung.com>
      9777582e
  25. 12 5月, 2015 2 次提交
  26. 16 4月, 2015 1 次提交
  27. 12 4月, 2015 1 次提交
  28. 24 3月, 2015 3 次提交
    • C
      Smack: Allow an unconfined label in bringup mode · bf4b2fee
      Casey Schaufler 提交于
      I have vehemently opposed adding a "permissive" mode to Smack
      for the simple reasons that it would be subject to massive abuse
      and that developers refuse to turn it off come product release.
      I still believe that this is true, and still refuse to add a
      general "permissive mode". So don't ask again.
      
      Bumjin Im suggested an approach that addresses most of the concerns,
      and I have implemented it here. I still believe that we'd be better
      off without this sort of thing, but it looks like this minimizes the
      abuse potential.
      
      Firstly, you have to configure Smack Bringup Mode. That allows
      for "release" software to be ammune from abuse. Second, only one
      label gets to be "permissive" at a time. You can use it for
      debugging, but that's about it.
      
      A label written to smackfs/unconfined is treated specially.
      If either the subject or object label of an access check
      matches the "unconfined" label, and the access would not
      have been allowed otherwise an audit record and a console
      message are generated. The audit record "request" string is
      marked with either "(US)" or "(UO)", to indicate that the
      request was granted because of an unconfined label. The
      fact that an inode was accessed by an unconfined label is
      remembered, and subsequent accesses to that "impure"
      object are noted in the log. The impurity is not stored in
      the filesystem, so a file mislabled as a side effect of
      using an unconfined label may still cause concern after
      a reboot.
      
      So, it's there, it's dangerous, but so many application
      developers seem incapable of living without it I have
      given in. I've tried to make it as safe as I can, but
      in the end it's still a chain saw.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      bf4b2fee
    • J
      Smack: getting the Smack security context of keys · 7fc5f36e
      José Bollo 提交于
      With this commit, the LSM Smack implements the LSM
      side part of the system call keyctl with the action
      code KEYCTL_GET_SECURITY.
      
      It is now possible to get the context of, for example,
      the user session key using the command "keyctl security @s".
      
      The original patch has been modified for merge.
      Signed-off-by: NJosé Bollo <jose.bollo@open.eurogiciel.org>
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      7fc5f36e
    • M
      Smack: Assign smack_known_web as default smk_in label for kernel thread's socket · 7412301b
      Marcin Lis 提交于
      This change fixes the bug associated with sockets owned by kernel threads. These
      sockets, created usually by network devices' drivers tasks, received smk_in
      label from the task that created them - the "floor" label in the most cases. The
      result was that they were not able to receive data packets because of missing
      smack rules. The main reason of the access deny is that the socket smk_in label
      is placed as the object during smk check, kernel thread's capabilities are
      omitted.
      Signed-off-by: NMarcin Lis <m.lis@samsung.com>
      7412301b
  29. 23 2月, 2015 1 次提交
  30. 12 2月, 2015 1 次提交