From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TvarF-000545-EY for linux-mtd@lists.infradead.org; Wed, 16 Jan 2013 21:49:18 +0000 Message-ID: <50F72047.6000904@pengutronix.de> Date: Wed, 16 Jan 2013 22:48:55 +0100 From: Marc Kleine-Budde MIME-Version: 1.0 To: Subodh Nijsure Subject: Re: [v4] Add security.* XATTR support for the UBIFS References: <1336915488-23943-1-git-send-email-snijsure@grid-net.com> <50F57A30.10109@pengutronix.de> In-Reply-To: <50F57A30.10109@pengutronix.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2IXEIIHWAETEAODBOHVRI" Cc: Artem Bityutskiy , penguin-kernel@I-love.SAKURA.ne.jp, Adrian Hunter , linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-mtd@lists.infradead.org List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2IXEIIHWAETEAODBOHVRI Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 01/15/2013 04:48 PM, Marc Kleine-Budde wrote: > On 05/13/2012 05:24 AM, Subodh Nijsure wrote: >> From: Subodh Nijsure >> >> Also fix couple of bugs in UBIFS extended attribute length calculation= =2E >> >> Changes in v4: >> Fix lock issues introduced in v3. >> Tested with CONFIG_SECURITY enabled & disabled. >> >> Changes in v3: >> Remove #ifdef CONFIG_UBIFS_FS_XATTR >> >> Changes in v2: >> Instead of just handling security.selinux extended attribute = handle >> all security.* attributes. >> >> TESTING: Tested on MX28 based platforms using Micron MT29F2G08ABAEAH4= NAND >> With these change we are able to label UBIFS filesystem with >> security.selinux and run system with selinux enabled. >> This change also allows one to set other security.* extended >> attributes, such as security.smack security.evm, security.ima= >> Ran integck test on UBI filesystem. >> This patch set has been tested with CONFIG_LOCKDEP=3Dy and ot= her options >> suggested in Submitchecklist >> >> Signed-off-by: Subodh Nijsure >=20 > What's the status of this patch? Was there a v5? I've ported v4 to v3.7.2 and get this deadlock: > [ 18.870000] UBIFS: background thread "ubifs_bgt0_0" started, PID 101= > [ 20.650000] > [ 20.650000] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > [ 20.650000] [ INFO: possible circular locking dependency detected ] > [ 20.650000] 3.7.2-00001-g8cdd29c #2 Not tainted > [ 20.650000] ------------------------------------------------------- > [ 20.650000] systemd-rc-once/79 is trying to acquire lock: > [ 20.650000] (&sb->s_type->i_mutex_key#9){+.+.+.}, at: [] = ubifs_init_security+0x28/0x74 > [ 20.650000] > [ 20.650000] but task is already holding lock: > [ 20.650000] (&ui->ui_mutex){+.+...}, at: [] ubifs_create+= 0x9c/0x1f8 > [ 20.650000] > [ 20.650000] which lock already depends on the new lock. > [ 20.650000] > [ 20.650000] > [ 20.650000] the existing dependency chain (in reverse order) is: > [ 20.650000] > -> #1 (&ui->ui_mutex){+.+...}: > [ 20.650000] [] lock_acquire+0x64/0x78 > [ 20.650000] [] mutex_lock_nested+0x68/0x2f8 > [ 20.650000] [] ubifs_setattr+0xe4/0x3ec > [ 20.650000] [] notify_change+0x1dc/0x324 > [ 20.650000] [] do_truncate+0x78/0x94 > [ 20.650000] [] do_last.isra.24+0x530/0xc30 > [ 20.650000] [] path_openat+0xa8/0x4b8 > [ 20.650000] [] do_filp_open+0x2c/0x80 > [ 20.650000] [] do_sys_open+0xe4/0x170 > [ 20.650000] [] ret_fast_syscall+0x0/0x38 > [ 20.650000] > -> #0 (&sb->s_type->i_mutex_key#9){+.+.+.}: > [ 20.650000] [] __lock_acquire+0x1354/0x19b0 > [ 20.650000] [] lock_acquire+0x64/0x78 > [ 20.650000] [] mutex_lock_nested+0x68/0x2f8 > [ 20.650000] [] ubifs_init_security+0x28/0x74 > [ 20.650000] [] ubifs_create+0x120/0x1f8 > [ 20.650000] [] vfs_create+0xac/0xd8 > [ 20.650000] [] do_last.isra.24+0xab0/0xc30 > [ 20.650000] [] path_openat+0xa8/0x4b8 > [ 20.650000] [] do_filp_open+0x2c/0x80 > [ 20.650000] [] do_sys_open+0xe4/0x170 > [ 20.650000] [] ret_fast_syscall+0x0/0x38 > [ 20.650000] > [ 20.650000] other info that might help us debug this: > [ 20.650000] > [ 20.650000] Possible unsafe locking scenario: > [ 20.650000] > [ 20.650000] CPU0 CPU1 > [ 20.650000] ---- ---- > [ 20.650000] lock(&ui->ui_mutex); > [ 20.650000] lock(&sb->s_type->i_mutex= _key#9); > [ 20.650000] lock(&ui->ui_mutex); > [ 20.650000] lock(&sb->s_type->i_mutex_key#9); > [ 20.650000] > [ 20.650000] *** DEADLOCK *** > [ 20.650000] > [ 20.650000] 3 locks held by systemd-rc-once/79: > [ 20.650000] #0: (sb_writers#3){.+.+.+}, at: [] mnt_want_= write+0x18/0x3c > [ 20.650000] #1: (&type->i_mutex_dir_key){+.+.+.}, at: []= do_last.isra.24+0x2a4/0xc30 > [ 20.650000] #2: (&ui->ui_mutex){+.+...}, at: [] ubifs_cr= eate+0x9c/0x1f8 > [ 20.650000] > [ 20.650000] stack backtrace: > [ 20.650000] [] (unwind_backtrace+0x0/0xf0) from [] (print_circular_bug+0x254/0x2a0) > [ 20.650000] [] (print_circular_bug+0x254/0x2a0) from [] (__lock_acquire+0x1354/0x19b0) > [ 20.650000] [] (__lock_acquire+0x1354/0x19b0) from [] (lock_acquire+0x64/0x78) > [ 20.650000] [] (lock_acquire+0x64/0x78) from [] = (mutex_lock_nested+0x68/0x2f8) > [ 20.650000] [] (mutex_lock_nested+0x68/0x2f8) from [] (ubifs_init_security+0x28/0x74) > [ 20.650000] [] (ubifs_init_security+0x28/0x74) from [] (ubifs_create+0x120/0x1f8) > [ 20.650000] [] (ubifs_create+0x120/0x1f8) from [= ] (vfs_create+0xac/0xd8) > [ 20.650000] [] (vfs_create+0xac/0xd8) from [] (d= o_last.isra.24+0xab0/0xc30) > [ 20.650000] [] (do_last.isra.24+0xab0/0xc30) from [] (path_openat+0xa8/0x4b8) > [ 20.650000] [] (path_openat+0xa8/0x4b8) from [] = (do_filp_open+0x2c/0x80) > [ 20.650000] [] (do_filp_open+0x2c/0x80) from [] = (do_sys_open+0xe4/0x170) > [ 20.650000] [] (do_sys_open+0xe4/0x170) from [] = (ret_fast_syscall+0x0/0x38) > [ 49.430000] UBIFS: background thread "ubifs_bgt0_0" stops Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | ------enig2IXEIIHWAETEAODBOHVRI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlD3IE4ACgkQjTAFq1RaXHN2bgCdH8WLSpoHMzviW7+Sv0mhPNiS FE0An0PH0tj3VdAPDmPaDB4UP4sjU/cw =apn+ -----END PGP SIGNATURE----- ------enig2IXEIIHWAETEAODBOHVRI--