From patchwork Mon Feb 19 15:18:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Enderborg X-Patchwork-Id: 10228001 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 85EAB602B1 for ; Mon, 19 Feb 2018 15:18:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 777C9288EB for ; Mon, 19 Feb 2018 15:18:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C0A228A6D; Mon, 19 Feb 2018 15:18:27 +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 D439D288EB for ; Mon, 19 Feb 2018 15:18:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753023AbeBSPSY (ORCPT ); Mon, 19 Feb 2018 10:18:24 -0500 Received: from seldsegrel01.sonyericsson.com ([37.139.156.29]:1983 "EHLO SELDSEGREL01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752994AbeBSPSX (ORCPT ); Mon, 19 Feb 2018 10:18:23 -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 Subject: [PATCH selinux-next] selinux: Annotate lockdep for services locks Date: Mon, 19 Feb 2018 16:18:00 +0100 Message-ID: <20180219151800.14442-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 From: Peter 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 --- This is the rebase of suggested patches from selinuxns tree and are intended to be applyed on top of: selinux: wrap global selinux state from Stephen Smalley security/selinux/ss/services.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 3698352213d7..a741552e22b5 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -81,11 +81,15 @@ char *selinux_policycap_names[__POLICYDB_CAPABILITY_MAX] = { }; static struct selinux_ss selinux_ss; +static struct lock_class_key selinux_ss_class_key; +static struct lock_class_key selinux_status_class_key; void selinux_ss_init(struct selinux_ss **ss) { rwlock_init(&selinux_ss.policy_rwlock); + lockdep_set_class(&selinux_ss.policy_rwlock, &selinux_ss_class_key); mutex_init(&selinux_ss.status_lock); + lockdep_set_class(&selinux_ss.status_lock, &selinux_status_class_key); *ss = &selinux_ss; }