1. 14 11月, 2018 2 次提交
  2. 25 9月, 2018 1 次提交
  3. 14 9月, 2018 1 次提交
    • J
      Revert "x86/mm/legacy: Populate the user page-table with user pgd's" · 61a6bd83
      Joerg Roedel 提交于
      This reverts commit 1f40a46c.
      
      It turned out that this patch is not sufficient to enable PTI on 32 bit
      systems with legacy 2-level page-tables. In this paging mode the huge-page
      PTEs are in the top-level page-table directory, where also the mirroring to
      the user-space page-table happens. So every huge PTE exits twice, in the
      kernel and in the user page-table.
      
      That means that accessed/dirty bits need to be fetched from two PTEs in
      this mode to be safe, but this is not trivial to implement because it needs
      changes to generic code just for the sake of enabling PTI with 32-bit
      legacy paging. As all systems that need PTI should support PAE anyway,
      remove support for PTI when 32-bit legacy paging is used.
      
      Fixes: 7757d607 ('x86/pti: Allow CONFIG_PAGE_TABLE_ISOLATION for x86_32')
      Reported-by: NMeelis Roos <mroos@linux.ee>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: hpa@zytor.com
      Cc: linux-mm@kvack.org
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Link: https://lkml.kernel.org/r/1536922754-31379-1-git-send-email-joro@8bytes.org
      61a6bd83
  4. 05 9月, 2018 1 次提交
  5. 04 9月, 2018 1 次提交
    • J
      apparmor: fix bad debug check in apparmor_secid_to_secctx() · edf4e7b7
      John Johansen 提交于
      apparmor_secid_to_secctx() has a bad debug statement tripping on a
      condition handle by the code.  When kconfig SECURITY_APPARMOR_DEBUG is
      enabled the debug WARN_ON will trip when **secdata is NULL resulting
      in the following trace.
      
      ------------[ cut here ]------------
      AppArmor WARN apparmor_secid_to_secctx: ((!secdata)):
      WARNING: CPU: 0 PID: 14826 at security/apparmor/secid.c:82 apparmor_secid_to_secctx+0x2b5/0x2f0 security/apparmor/secid.c:82
      Kernel panic - not syncing: panic_on_warn set ...
      
      CPU: 0 PID: 14826 Comm: syz-executor1 Not tainted 4.19.0-rc1+ #193
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
       panic+0x238/0x4e7 kernel/panic.c:184
       __warn.cold.8+0x163/0x1ba kernel/panic.c:536
       report_bug+0x252/0x2d0 lib/bug.c:186
       fixup_bug arch/x86/kernel/traps.c:178 [inline]
       do_error_trap+0x1fc/0x4d0 arch/x86/kernel/traps.c:296
       do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:316
       invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:993
      RIP: 0010:apparmor_secid_to_secctx+0x2b5/0x2f0 security/apparmor/secid.c:82
      Code: c7 c7 40 66 58 87 e8 6a 6d 0f fe 0f 0b e9 6c fe ff ff e8 3e aa 44 fe 48 c7 c6 80 67 58 87 48 c7 c7 a0 65 58 87 e8 4b 6d 0f fe <0f> 0b e9 3f fe ff ff 48 89 df e8 fc a7 83 fe e9 ed fe ff ff bb f4
      RSP: 0018:ffff8801ba1bed10 EFLAGS: 00010286
      RAX: 0000000000000000 RBX: ffff8801ba1beed0 RCX: ffffc9000227e000
      RDX: 0000000000018482 RSI: ffffffff8163ac01 RDI: 0000000000000001
      RBP: ffff8801ba1bed30 R08: ffff8801b80ec080 R09: ffffed003b603eca
      R10: ffffed003b603eca R11: ffff8801db01f657 R12: 0000000000000001
      R13: 0000000000000000 R14: 0000000000000000 R15: ffff8801ba1beed0
       security_secid_to_secctx+0x63/0xc0 security/security.c:1314
       ctnetlink_secctx_size net/netfilter/nf_conntrack_netlink.c:621 [inline]
       ctnetlink_nlmsg_size net/netfilter/nf_conntrack_netlink.c:659 [inline]
       ctnetlink_conntrack_event+0x303/0x1470 net/netfilter/nf_conntrack_netlink.c:706
       nf_conntrack_eventmask_report+0x55f/0x930 net/netfilter/nf_conntrack_ecache.c:151
       nf_conntrack_event_report include/net/netfilter/nf_conntrack_ecache.h:112 [inline]
       nf_ct_delete+0x33c/0x5d0 net/netfilter/nf_conntrack_core.c:601
       nf_ct_iterate_cleanup+0x48c/0x5e0 net/netfilter/nf_conntrack_core.c:1892
       nf_ct_iterate_cleanup_net+0x23c/0x2d0 net/netfilter/nf_conntrack_core.c:1974
       ctnetlink_flush_conntrack net/netfilter/nf_conntrack_netlink.c:1226 [inline]
       ctnetlink_del_conntrack+0x66c/0x850 net/netfilter/nf_conntrack_netlink.c:1258
       nfnetlink_rcv_msg+0xd88/0x1070 net/netfilter/nfnetlink.c:228
       netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2454
       nfnetlink_rcv+0x1c0/0x4d0 net/netfilter/nfnetlink.c:560
       netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
       netlink_unicast+0x5a0/0x760 net/netlink/af_netlink.c:1343
       netlink_sendmsg+0xa18/0xfc0 net/netlink/af_netlink.c:1908
       sock_sendmsg_nosec net/socket.c:621 [inline]
       sock_sendmsg+0xd5/0x120 net/socket.c:631
       ___sys_sendmsg+0x7fd/0x930 net/socket.c:2114
       __sys_sendmsg+0x11d/0x290 net/socket.c:2152
       __do_sys_sendmsg net/socket.c:2161 [inline]
       __se_sys_sendmsg net/socket.c:2159 [inline]
       __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2159
       do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x457089
      Code: fd b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007f7bc6e03c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007f7bc6e046d4 RCX: 0000000000457089
      RDX: 0000000000000000 RSI: 0000000020d65000 RDI: 0000000000000003
      RBP: 00000000009300a0 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
      R13: 00000000004d4588 R14: 00000000004c8d5c R15: 0000000000000000
      Dumping ftrace buffer:
         (ftrace buffer empty)
      Kernel Offset: disabled
      Rebooting in 86400 seconds..
      
      CC: <stable@vger.kernel.org> #4.18
      Fixes: c0929212 ("apparmor: add support for mapping secids and using secctxes")
      Reported-by: syzbot+21016130b0580a9de3b5@syzkaller.appspotmail.com
      Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
      edf4e7b7
  6. 23 8月, 2018 2 次提交
  7. 22 8月, 2018 1 次提交
  8. 11 8月, 2018 1 次提交
    • E
      cap_inode_getsecurity: use d_find_any_alias() instead of d_find_alias() · 355139a8
      Eddie.Horng 提交于
      The code in cap_inode_getsecurity(), introduced by commit 8db6c34f
      ("Introduce v3 namespaced file capabilities"), should use
      d_find_any_alias() instead of d_find_alias() do handle unhashed dentry
      correctly. This is needed, for example, if execveat() is called with an
      open but unlinked overlayfs file, because overlayfs unhashes dentry on
      unlink.
      This is a regression of real life application, first reported at
      https://www.spinics.net/lists/linux-unionfs/msg05363.html
      
      Below reproducer and setup can reproduce the case.
        const char* exec="echo";
        const char *newargv[] = { "echo", "hello", NULL};
        const char *newenviron[] = { NULL };
        int fd, err;
      
        fd = open(exec, O_PATH);
        unlink(exec);
        err = syscall(322/*SYS_execveat*/, fd, "", newargv, newenviron,
      AT_EMPTY_PATH);
        if(err<0)
          fprintf(stderr, "execveat: %s\n", strerror(errno));
      
      gcc compile into ~/test/a.out
      mount -t overlay -orw,lowerdir=/mnt/l,upperdir=/mnt/u,workdir=/mnt/w
      none /mnt/m
      cd /mnt/m
      cp /bin/echo .
      ~/test/a.out
      
      Expected result:
      hello
      Actually result:
      execveat: Invalid argument
      dmesg:
      Invalid argument reading file caps for /dev/fd/3
      
      The 2nd reproducer and setup emulates similar case but for
      regular filesystem:
        const char* exec="echo";
        int fd, err;
        char buf[256];
      
        fd = open(exec, O_RDONLY);
        unlink(exec);
        err = fgetxattr(fd, "security.capability", buf, 256);
        if(err<0)
          fprintf(stderr, "fgetxattr: %s\n", strerror(errno));
      
      gcc compile into ~/test_fgetxattr
      
      cd /tmp
      cp /bin/echo .
      ~/test_fgetxattr
      
      Result:
      fgetxattr: Invalid argument
      
      On regular filesystem, for example, ext4 read xattr from
      disk and return to execveat(), will not trigger this issue, however,
      the overlay attr handler pass real dentry to vfs_getxattr() will.
      This reproducer calls fgetxattr() with an unlinked fd, involkes
      vfs_getxattr() then reproduced the case that d_find_alias() in
      cap_inode_getsecurity() can't find the unlinked dentry.
      Suggested-by: NAmir Goldstein <amir73il@gmail.com>
      Acked-by: NAmir Goldstein <amir73il@gmail.com>
      Acked-by: NSerge E. Hallyn <serge@hallyn.com>
      Fixes: 8db6c34f ("Introduce v3 namespaced file capabilities")
      Cc: <stable@vger.kernel.org> # v4.14
      Signed-off-by: NEddie Horng <eddie.horng@mediatek.com>
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      355139a8
  9. 08 8月, 2018 1 次提交
  10. 28 7月, 2018 2 次提交
  11. 24 7月, 2018 4 次提交
  12. 23 7月, 2018 1 次提交
  13. 20 7月, 2018 4 次提交
  14. 18 7月, 2018 12 次提交
  15. 17 7月, 2018 6 次提交