From patchwork Fri Feb 2 08:05:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Enderborg X-Patchwork-Id: 10196349 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 119A0603D7 for ; Fri, 2 Feb 2018 08:06:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0350528E16 for ; Fri, 2 Feb 2018 08:06:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC55C28E1A; Fri, 2 Feb 2018 08:06:36 +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 8B52828E16 for ; Fri, 2 Feb 2018 08:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751165AbeBBIGf (ORCPT ); Fri, 2 Feb 2018 03:06:35 -0500 Received: from seldsegrel01.sonyericsson.com ([37.139.156.29]:11477 "EHLO SELDSEGREL01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751129AbeBBIGe (ORCPT ); Fri, 2 Feb 2018 03:06:34 -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 09:05:54 +0100 Message-ID: <20180202080554.9689-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. --- 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; }