apparmor: fix oops in profile_unpack() when policy_db is not present
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / security / yama / yama_lsm.c
index 13c88fbcf0371cc32340791e335eeb0b4758f875..0038834b558eb6a86e6d5330ea6011a2bafa4bf9 100644 (file)
@@ -292,7 +292,7 @@ int yama_ptrace_access_check(struct task_struct *child,
                return rc;
 
        /* require ptrace target be a child of ptracer on attach */
-       if (mode == PTRACE_MODE_ATTACH) {
+       if (mode & PTRACE_MODE_ATTACH) {
                switch (ptrace_scope) {
                case YAMA_SCOPE_DISABLED:
                        /* No additional restrictions. */
@@ -318,7 +318,7 @@ int yama_ptrace_access_check(struct task_struct *child,
                }
        }
 
-       if (rc) {
+       if (rc && (mode & PTRACE_MODE_NOAUDIT) == 0) {
                printk_ratelimited(KERN_NOTICE
                        "ptrace of pid %d was attempted by: %s (pid %d)\n",
                        child->pid, current->comm, current->pid);