From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755909AbcE0TJO (ORCPT ); Fri, 27 May 2016 15:09:14 -0400 Received: from nm16.bullet.mail.bf1.yahoo.com ([98.139.212.175]:38009 "EHLO nm16.bullet.mail.bf1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751307AbcE0TJM (ORCPT ); Fri, 27 May 2016 15:09:12 -0400 X-Greylist: delayed 326 seconds by postgrey-1.27 at vger.kernel.org; Fri, 27 May 2016 15:09:12 EDT X-Yahoo-Newman-Id: 83686.75055.bm@smtp203.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Wffx_aAVM1kfXitXXYmCtg4SpBlZ_YYuhDTu7Abm.ol2R_2 mDMoRlye652YYrF4t63UB64whLeyMMyNFX84NzHamxRYh1lMVUOfMjzsIuyb QsqZ69OGOM.b6EMzG0COjpHnb4KR5u2Vm4154RAUWQGxRKWGjAFc_AgqLCFc vDpRE.boGW8ZTZYcxaU5L7NKyU1SCuZzDQytxaD1mCHeLQCLBvjWxk0dUthZ VthQKvhXSGkd7iNUJHMzRtWhnR5ETyFG35FjZz6s5iaX9HhqKx0t5ObBf4kg P8_FiFqiY1WwvHNFXJRoo6UOqNnvG0g96ouQ2pXQhoKR9p0piTbSofepBQDH Y1YYWsCNVAi9r1MKJrMbY9HCWxO6l.RcyUptMmctB3fk6DIhKCvVxztVwKDH sc.ocUlV9Xp5T535V_nEQSd6EVHyoo7SyG5KJTbfja0pRH8BNxTX2seXK97W BKeVJ4kjHQGMN2icY9gBt_kd60aXX8P6HDAfZVMBC5nJ.J1AFZZ3qRZRYqJt FT7ukfNupB1RlIICliuuZiEZxRNeLfWcW8OlehV.Iwg-- X-Yahoo-SMTP: OIJXglSswBDfgLtXluJ6wiAYv6_cnw-- Subject: Re: [BUG] Panic when systemd boot do mkdir on tmpfs mounted path with smack enabled environment To: Al Viro , Seung-Woo Kim References: <001301d1b808$31a437f0$94eca7d0$@samsung.com> <20160527151141.GO14480@ZenIV.linux.org.uk> <20160527185150.GP14480@ZenIV.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, jh80.chung@sungmsung.com, cw00.choi@samsung.com, Linus Torvalds , Casey Schaufler From: Casey Schaufler Message-ID: <9f2efc48-1778-d850-8bc3-a8ce77d6cdd7@schaufler-ca.com> Date: Fri, 27 May 2016 12:03:37 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160527185150.GP14480@ZenIV.linux.org.uk> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/27/2016 11:51 AM, Al Viro wrote: > On Fri, May 27, 2016 at 04:11:41PM +0100, Al Viro wrote: > >>> 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. >> /* >> * If this is a new directory and the label was >> * transmuted when the inode was initialized >> * set the transmute attribute on the directory >> * and mark the inode. >> * >> * If there is a transmute attribute on the >> * directory mark the inode. >> */ >> if (isp->smk_flags & SMK_INODE_CHANGED) { >> isp->smk_flags &= ~SMK_INODE_CHANGED; >> rc = inode->i_op->setxattr(dp, >> XATTR_NAME_SMACKTRANSMUTE, >> TRANS_TRUE, TRANS_TRUE_SIZE, >> 0); >> >> Damnation ;-/ That change (separating inode and dentry arguments of >> ->getxattr() so that security_d_instantiate() could be called before dentry >> is hashed or attached to inode) had been discussed back in early March and >> reaction of Casey back then had been basically "I believe that smack can >> live with that, will verify that in about a week". With no followup >> objections - neither immediate, nor in a week. As the matter of fact, >> your posting is the first time anyone has reported stepping into that problem. >> And that change had been present in linux-next since the beginning of May ;-/ >> Sigh... >> >>> 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. >> Can't be reverted in mainline. Not without shitloads of other stuff. >> >> There is a fairly straightforward way to handle that - do to ->setxattr() >> what we'd already done to ->getxattr(). See vfs.git#smack-fix. Warning: >> it's only build-tested. I'm going to have it go through LTP and xfstests >> shortly; _please_ check if it works on your setup, because I've no idea >> how to put together a testing setup for smack. > FWIW, that couple of commits seems to survive the testing here and is > pretty obvious. I have _NOT_ tested it on smack setups, so I really want > somebody (Casey or someone in Samsung) to check if it fixes the problem. > The change itself isn't tricky, but I fucking _hate_ doing that this late > in the merge window ;-/ I haven't actually seen the problem, but I've been having real trouble getting a systemd configuration working properly. The quickest validation will probably be coming from Seung-Woo Kim, who reported the issue initially. I am working to verify both the problem and the fix.