From patchwork Fri May 27 11:09:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seung-Woo Kim X-Patchwork-Id: 9138153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BDE660467 for ; Fri, 27 May 2016 11:09:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CAFE274F3 for ; Fri, 27 May 2016 11:09:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 010A128135; Fri, 27 May 2016 11:09:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7A16274F3 for ; Fri, 27 May 2016 11:09:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753180AbcE0LJE (ORCPT ); Fri, 27 May 2016 07:09:04 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:45512 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753163AbcE0LJB (ORCPT ); Fri, 27 May 2016 07:09:01 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O7U0165L1MZMS10@mailout2.samsung.com>; Fri, 27 May 2016 20:08:59 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.112]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id F0.08.05251.BCA28475; Fri, 27 May 2016 20:08:59 +0900 (KST) X-AuditID: cbfee691-f79196d000001483-a7-57482acb43ee Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id F3.FA.06706.ACA28475; Fri, 27 May 2016 04:08:59 -0700 (MST) Received: from NOSW0312KIM01 ([10.113.62.208]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O7U00M2T1MX5000@mmp2.samsung.com>; Fri, 27 May 2016 20:08:58 +0900 (KST) From: Seung-Woo Kim To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, sw0312.kim@samsung.com Cc: jh80.chung@sungmsung.com, cw00.choi@samsung.com, casey@schaufler-ca.com Subject: [BUG] Panic when systemd boot do mkdir on tmpfs mounted path with smack enabled environment Date: Fri, 27 May 2016 20:09:09 +0900 Message-id: <001301d1b808$31a437f0$94eca7d0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdG4B20uK1QM8krBRLG0VgY7N11JCg== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLIsWRmVeSWpSXmKPExsWyRsSkQPe0lke4Qfs/Lot7236xWVz/8pzV YnLHUlaLPXtPslhc3jWHzWLG5JdsFuf/Hmd1YPfo27KK0ePo/kVsHhfX3WP2+LxJzmPTk7dM AaxRXDYpqTmZZalF+nYJXBl3ZycULFGtaJmwn7GBcbp8FyMnh4SAicSzhvXMELaYxIV769m6 GLk4hARWMEo0bHrBBlO0fn8bC0RiFqPEm71tTBDOB0aJ1o3PWECq2AR0JPYv+c0KYosIFEl0 LP7O2MXIwcEs4C2xcbYtSFhYIE1i+9ylYCUsAqoSly9NZQSxeQUsJT4t/MgKYQtK/Jh8D2wk s4CWxOZtTawQtrzE5j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MTDq5HmHi7EmlhWXJl7iFGCg1lJhFdA0yNciDclsbIqtSg/vqg0J7X4EKMp0LMTmaVE k/OBySivJN7Q2MTMyNLI3NDCyNhcSZz38f91YUIC6YklqdmpqQWpRTB9TBycUg2MsxI8vFKK su0OqccIOio+Cz72pqn4aaRw9H5Xhmf+GrrVBpURenLc9UvT9dmZZxqzeu7o+6RTptTGsnHj o+PzBb5P9GDj4jdbLbrWqyrh6VOm+Cu2af0qOv+aOm/WLt1X+d5311lhTcaWgi9rA1K2RjP4 968/w7jN6dr1vRd7ti/Y91rxGZMSS3FGoqEWc1FxIgCM3mlKDgMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, After commit, "b968091 security_d_instantiate(): move to the point prior to attaching dentry to inode", booting on system with systemd and security smack, following kernel panic occurs. --- Unable to handle kernel paging request at virtual address fffffff4 pgd = eda74000 [fffffff4] *pgd=6fffd861, *pte=00000000, *ppte=00000000 Internal error: Oops: 37 [#1] PREEMPT SMP ARM Modules linked in: CPU: 0 PID: 1 Comm: systemd Not tainted 4.6.0-11010-gdc03c0f-dirty #54 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) task: ee948000 ti: ee942000 task.ti: ee942000 PC is at do_raw_spin_lock+0x14/0x1c0 LR is at _raw_spin_lock+0x28/0x2c pc : [] lr : [] psr: 000f0013 sp : ee943d98 ip : ee943dc0 fp : ee943dbc r10: 00000000 r9 : ed8a1f80 r8 : fffffff0 r7 : eea57d40 r6 : c0d5c764 r5 : ffffffe8 r4 : fffffff0 r3 : ee948000 r2 : 00000001 r1 : c0d5c77e r0 : fffffff0 Flags: nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none Control: 10c5387d Table: 6da7406a DAC: 00000051 Process systemd (pid: 1, stack limit = 0xee942210) Stack: (0xee943d98 to 0xee944000) 3d80: fffffff0 ffffffe8 3da0: c0d5c764 eea57d40 fffffff0 ed8a1f80 ee943dd4 ee943dc0 c0a9f608 c016e694 3dc0: 00000004 00000000 ee943dfc ee943dd8 c0271bf8 c0a9f5ec 00000000 c0d5c7ec 3de0: 00000000 ed5f9428 ee314480 ed8a1f80 ee943e24 ee943e00 c0202e40 c0271ba4 3e00: 00000000 c0270d28 00000004 ed5f9428 c0d5c7ec 00000004 ee943e54 ee943e28 3e20: c0270d54 c0202e08 00000004 00000000 00000100 c0d5c76d eda8d380 eda8d380 3e40: eea51430 eda8d38c ee943e9c ee943e58 c03aa4c0 c0270cec 00000000 ed5f9440 3e60: c114a3c8 00000004 ee943edc ee943e78 c03a4e60 c114ad70 c114a678 eea51430 3e80: ed5f9428 00000000 ffffff9c 00000000 ee943ebc ee943ea0 c03a4d84 c03aa1c4 3ea0: eea51430 ed5f9428 eea51430 ed5f9428 ee943edc ee943ec0 c0262c18 c03a4d4c 3ec0: eea507d0 00000000 eea50780 eea51430 ee943f1c ee943ee0 c020363c c0262bf8 3ee0: 00000000 c01014c4 386d439a 00000000 35a4e900 c02038cc 000001ed 000001ed 3f00: eea50780 ed5f9428 00000000 7f65f7f8 ee943f34 ee943f20 c02038f0 c0203568 3f20: 000001ed eea50780 ee943f64 ee943f38 c0255fbc c02038d8 ee3a4015 ffffffff 3f40: 000001ed 000001ed ed5f9428 7f65f7f8 00000002 000001ed ee943f94 ee943f68 3f60: c025a1ec c0255f08 eda96310 ed5f8d10 000001ed 7f65f7f8 003520a2 00000027 3f80: c0109248 ee942000 ee943fa4 ee943f98 c025a25c c025a180 00000000 ee943fa8 3fa0: c0109040 c025a244 000001ed 7f65f7f8 7f65f7f8 000001ed 00000000 00104000 3fc0: 000001ed 7f65f7f8 003520a2 00000027 b6f9beb0 7f6bb9b0 bebe3998 bebe3988 3fe0: 7f6bb9e8 bebe387c 7f60419d b6df434c 600f0010 7f65f7f8 ffffffff fffffffb [] (do_raw_spin_lock) from [] (_raw_spin_lock+0x28/0x2c) [] (_raw_spin_lock) from [] (simple_xattr_set+0x60/0x158) [] (simple_xattr_set) from [] (shmem_xattr_handler_set+0x44/0x4c) [] (shmem_xattr_handler_set) from [] (generic_setxattr+0x74/0x7c) [] (generic_setxattr) from [] (smack_d_instantiate+0x308/0x390) [] (smack_d_instantiate) from [] (security_d_instantiate+0x44/0x64) [] (security_d_instantiate) from [] (d_instantiate+0x2c/0x5c) [] (d_instantiate) from [] (shmem_mknod+0xe0/0xfc) [] (shmem_mknod) from [] (shmem_mkdir+0x24/0x3c) [] (shmem_mkdir) from [] (vfs_mkdir+0xc0/0x10c) [] (vfs_mkdir) from [] (SyS_mkdirat+0x78/0xc4) [] (SyS_mkdirat) from [] (SyS_mkdir+0x24/0x28) [] (SyS_mkdir) from [] (ret_fast_syscall+0x0/0x3c) Code: e92ddbf0 e24cb004 e52de004 e8bd4000 (e5902004) ---[ end trace ec9873d14ae12b14 ]--- It works fine if reverting the commit, "b968091 security_d_instantiate(): move to the point prior to attaching dentry to inode", for d_instantiate() like following. --- --- In my test environment, following related configs are enabled. CONFIG_SHMEM=y CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TMPFS_XATTR=y CONFIG_SECURITY_SMACK=y CONFIG_DEFAULT_SECURITY_SMACK=y CONFIG_DEFAULT_SECURITY="smack" Best Regards, - Seung-Woo Kim -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1793,11 +1793,11 @@ void d_instantiate(struct dentry *entry, struct inode * inode) { BUG_ON(!hlist_unhashed(&entry->d_u.d_alias)); if (inode) { - security_d_instantiate(entry, inode); spin_lock(&inode->i_lock); __d_instantiate(entry, inode); spin_unlock(&inode->i_lock); } + security_d_instantiate(entry, inode); } EXPORT_SYMBOL(d_instantiate);