1. 05 9月, 2019 2 次提交
    • L
      smack: fix some kernel-doc notations · a1a07f22
      luanshi 提交于
      Fix/add kernel-doc notation and fix typos in security/smack/.
      Signed-off-by: NLiguang Zhang <zhangliguang@linux.alibaba.com>
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      a1a07f22
    • J
      Smack: Don't ignore other bprm->unsafe flags if LSM_UNSAFE_PTRACE is set · 3675f052
      Jann Horn 提交于
      There is a logic bug in the current smack_bprm_set_creds():
      If LSM_UNSAFE_PTRACE is set, but the ptrace state is deemed to be
      acceptable (e.g. because the ptracer detached in the meantime), the other
      ->unsafe flags aren't checked. As far as I can tell, this means that
      something like the following could work (but I haven't tested it):
      
       - task A: create task B with fork()
       - task B: set NO_NEW_PRIVS
       - task B: install a seccomp filter that makes open() return 0 under some
         conditions
       - task B: replace fd 0 with a malicious library
       - task A: attach to task B with PTRACE_ATTACH
       - task B: execve() a file with an SMACK64EXEC extended attribute
       - task A: while task B is still in the middle of execve(), exit (which
         destroys the ptrace relationship)
      
      Make sure that if any flags other than LSM_UNSAFE_PTRACE are set in
      bprm->unsafe, we reject the execve().
      
      Cc: stable@vger.kernel.org
      Fixes: 5663884c ("Smack: unify all ptrace accesses in the smack")
      Signed-off-by: NJann Horn <jannh@google.com>
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      3675f052
  2. 19 6月, 2019 1 次提交
  3. 15 6月, 2019 1 次提交
    • C
      Smack: Restore the smackfsdef mount option and add missing prefixes · 6e7739fc
      Casey Schaufler 提交于
      The 5.1 mount system rework changed the smackfsdef mount option to
      smackfsdefault.  This fixes the regression by making smackfsdef treated
      the same way as smackfsdefault.
      
      Also fix the smack_param_specs[] to have "smack" prefixes on all the
      names.  This isn't visible to a user unless they either:
      
       (a) Try to mount a filesystem that's converted to the internal mount API
           and that implements the ->parse_monolithic() context operation - and
           only then if they call security_fs_context_parse_param() rather than
           security_sb_eat_lsm_opts().
      
           There are no examples of this upstream yet, but nfs will probably want
           to do this for nfs2 or nfs3.
      
       (b) Use fsconfig() to configure the filesystem - in which case
           security_fs_context_parse_param() will be called.
      
      This issue is that smack_sb_eat_lsm_opts() checks for the "smack" prefix
      on the options, but smack_fs_context_parse_param() does not.
      
      Fixes: c3300aaf ("smack: get rid of match_token()")
      Fixes: 2febd254 ("smack: Implement filesystem context security hooks")
      Cc: stable@vger.kernel.org
      Reported-by: NJose Bollo <jose.bollo@iot.bzh>
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Tested-by: NCasey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6e7739fc
  4. 01 5月, 2019 1 次提交
  5. 30 4月, 2019 1 次提交
    • T
      smack: Check address length before reading address family · b9ef5513
      Tetsuo Handa 提交于
      KMSAN will complain if valid address length passed to bind()/connect()/
      sendmsg() is shorter than sizeof("struct sockaddr"->sa_family) bytes.
      
      Also, since smk_ipv6_port_label()/smack_netlabel_send()/
      smack_ipv6host_label()/smk_ipv6_check()/smk_ipv6_port_check() are not
      checking valid address length and/or address family, make sure we check
      both. The minimal valid length in smack_socket_connect() is changed from
      sizeof(struct sockaddr_in6) bytes to SIN6_LEN_RFC2133 bytes, for it seems
      that Smack is not using "struct sockaddr_in6"->sin6_scope_id field.
      Signed-off-by: NTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      b9ef5513
  6. 04 4月, 2019 1 次提交
  7. 03 4月, 2019 1 次提交
  8. 28 2月, 2019 2 次提交
  9. 23 2月, 2019 1 次提交
    • G
      security: mark expected switch fall-throughs and add a missing break · 09186e50
      Gustavo A. R. Silva 提交于
      In preparation to enabling -Wimplicit-fallthrough, mark switch
      cases where we are expecting to fall through.
      
      This patch fixes the following warnings:
      
      security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
      security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
      security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
      security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
      security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
      security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
      security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
      
      Warning level 3 was used: -Wimplicit-fallthrough=3
      
      Also, add a missing break statement to fix the following warning:
      
      security/integrity/ima/ima_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
      Acked-by: NJohn Johansen <john.johansen@canonical.com>
      Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Acked-by: NMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: NJames Morris <james.morris@microsoft.com>
      09186e50
  10. 01 2月, 2019 1 次提交
  11. 19 1月, 2019 1 次提交
  12. 09 1月, 2019 11 次提交
  13. 22 12月, 2018 10 次提交
  14. 04 12月, 2018 1 次提交
    • Z
      smack: fix access permissions for keyring · 5b841bfa
      Zoran Markovic 提交于
      Function smack_key_permission() only issues smack requests for the
      following operations:
       - KEY_NEED_READ (issues MAY_READ)
       - KEY_NEED_WRITE (issues MAY_WRITE)
       - KEY_NEED_LINK (issues MAY_WRITE)
       - KEY_NEED_SETATTR (issues MAY_WRITE)
      A blank smack request is issued in all other cases, resulting in
      smack access being granted if there is any rule defined between
      subject and object, or denied with -EACCES otherwise.
      
      Request MAY_READ access for KEY_NEED_SEARCH and KEY_NEED_VIEW.
      Fix the logic in the unlikely case when both MAY_READ and
      MAY_WRITE are needed. Validate access permission field for valid
      contents.
      Signed-off-by: NZoran Markovic <zmarkovic@sierrawireless.com>
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      Cc: Casey Schaufler <casey@schaufler-ca.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: "Serge E. Hallyn" <serge@hallyn.com>
      5b841bfa
  15. 11 10月, 2018 2 次提交
  16. 03 10月, 2018 1 次提交
    • E
      signal: Distinguish between kernel_siginfo and siginfo · ae7795bc
      Eric W. Biederman 提交于
      Linus recently observed that if we did not worry about the padding
      member in struct siginfo it is only about 48 bytes, and 48 bytes is
      much nicer than 128 bytes for allocating on the stack and copying
      around in the kernel.
      
      The obvious thing of only adding the padding when userspace is
      including siginfo.h won't work as there are sigframe definitions in
      the kernel that embed struct siginfo.
      
      So split siginfo in two; kernel_siginfo and siginfo.  Keeping the
      traditional name for the userspace definition.  While the version that
      is used internally to the kernel and ultimately will not be padded to
      128 bytes is called kernel_siginfo.
      
      The definition of struct kernel_siginfo I have put in include/signal_types.h
      
      A set of buildtime checks has been added to verify the two structures have
      the same field offsets.
      
      To make it easy to verify the change kernel_siginfo retains the same
      size as siginfo.  The reduction in size comes in a following change.
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      ae7795bc
  17. 19 9月, 2018 2 次提交