From patchwork Fri Feb 2 14:16:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Enderborg X-Patchwork-Id: 10196883 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 1525860362 for ; Fri, 2 Feb 2018 14:17:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04E8B28E70 for ; Fri, 2 Feb 2018 14:17:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECFEE28E72; Fri, 2 Feb 2018 14:17:10 +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 9C51E28E70 for ; Fri, 2 Feb 2018 14:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752003AbeBBOQ7 (ORCPT ); Fri, 2 Feb 2018 09:16:59 -0500 Received: from seldsegrel01.sonyericsson.com ([37.139.156.29]:6963 "EHLO SELDSEGREL01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751959AbeBBOQ5 (ORCPT ); Fri, 2 Feb 2018 09:16:57 -0500 X-Authentication-Warning: seldlx23035.corpusers.net: 23059638 set sender to peter.enderborg@sony.com using -f From: Peter Enderborg To: Paul Moore , Stephen Smalley , , CC: Peter Enderborg Subject: [PATCH-selinuxns] selinux: Annotate lockdep for services locks Date: Fri, 2 Feb 2018 15:16:40 +0100 Message-ID: <20180202141640.4589-1-peter.enderborg@sony.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The locks are moved to dynamic allocation, we need to help the lockdep system to classify the locks. This adds to lockdep annotation for the page mutex and for the ss lock. Signed-off-by: Peter Enderborg --- security/selinux/ss/services.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index abc5383..ba463c0 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -70,6 +70,9 @@ #include "ebitmap.h" #include "audit.h" +static struct lock_class_key selinux_ss_class_key; +static struct lock_class_key selinux_status_class_key; + /* Policy capability names */ char *selinux_policycap_names[__POLICYDB_CAPABILITY_MAX] = { "network_peer_controls", @@ -88,7 +91,9 @@ int selinux_ss_create(struct selinux_ss **ss) if (!newss) return -ENOMEM; rwlock_init(&newss->policy_rwlock); + lockdep_set_class(&newss->policy_rwlock, &selinux_ss_class_key); mutex_init(&newss->status_lock); + lockdep_set_class(&newss->status_lock, &selinux_status_class_key); *ss = newss; return 0; }