Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752953AbaFTXhY (ORCPT ); Fri, 20 Jun 2014 19:37:24 -0400 Received: from g2t2354.austin.hp.com ([15.217.128.53]:29014 "EHLO g2t2354.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751386AbaFTXhW (ORCPT ); Fri, 20 Jun 2014 19:37:22 -0400 Message-ID: <53A4C5AE.9020209@hp.com> Date: Fri, 20 Jun 2014 19:37:18 -0400 From: Waiman Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 MIME-Version: 1.0 To: Stephen Smalley CC: Paul Moore , Eric Paris , James Morris , linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Scott J Norton Subject: Re: [PATCH] selinux: no recursive read_lock of policy_rwlock in security_genfs_sid() References: <1403286324-34421-1-git-send-email-Waiman.Long@hp.com> <53A4742E.1090909@tycho.nsa.gov> In-Reply-To: <53A4742E.1090909@tycho.nsa.gov> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/20/2014 01:49 PM, Stephen Smalley wrote: > On 06/20/2014 01:45 PM, Waiman Long wrote: >> With introduction of fair queued rwlock, recursive read_lock() may hang >> the offending process if there is a write_lock() somewhere in between. >> >> With recursive read_lock checking enabled, the following error was >> reported: >> >> ============================================= >> [ INFO: possible recursive locking detected ] >> 3.16.0-rc1 #2 Tainted: G E >> --------------------------------------------- >> load_policy/708 is trying to acquire lock: >> (policy_rwlock){.+.+..}, at: [] security_genfs_sid+0x3a/0x170 >> >> but task is already holding lock: >> (policy_rwlock){.+.+..}, at: [] security_fs_use+0x2c/0x110 >> >> other info that might help us debug this: >> Possible unsafe locking scenario: >> >> CPU0 >> ---- >> lock(policy_rwlock); >> lock(policy_rwlock); >> >> This patch fixes the occurrence of recursive read_lock() of >> policy_rwlock in security_genfs_sid() by adding a 5th argument to >> indicate if the rwlock has been taken. >> >> Signed-off-by: Waiman Long > Thanks, but I'd prefer to instead create a static helper function in > services.c that does not take the lock at all, use that function from > security_fs_use, and leave the extern function unmodified. On second thought, this is exactly what I want to change the patch. I will send out a new one later today. -Longman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/