From patchwork Tue Jul 18 18:49:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 13317624 X-Patchwork-Delegate: paul@paul-moore.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F8ADEB64DC for ; Tue, 18 Jul 2023 18:49:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230423AbjGRStb (ORCPT ); Tue, 18 Jul 2023 14:49:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbjGRSt3 (ORCPT ); Tue, 18 Jul 2023 14:49:29 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7341710A for ; Tue, 18 Jul 2023 11:49:28 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4fbc0314a7bso9935331e87.2 for ; Tue, 18 Jul 2023 11:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1689706167; x=1692298167; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+u7giXfaMwciqklgaEuK1kZB1bo2xsdZNzX5RIc2iC0=; b=rSh9Wn5+2lpQUjKxRb/GjsXrhA6M2tlBFUDSJ7bRpu0XdpLvFC7HiZHW9H87NQq0G6 ECjjtUlfS+LufYkfgj5mk3+WRM4TPKdSaOFs0Z6c6F3o2ZxK6Jtcs1Zlu7GxCUnbhNK/ mvcrQcWFRD4w4Yug2e9irYKGtsDyCJT3gRxwN56YSrsSPegDsHadsdkd8FydSTFKAIf0 DxW43sPy1Qp60WgoZJuhe7wcJDzx7E7iHuVLjlMxWfE7IRC0476aQ4WQx3/xB1+zdgPF zlXzfY7shmqo0J/HroPo3qxmzgpmW90B3HK+aPsX9o2YO/BobxP8eIDVebNFYXcAfBe4 cpWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689706167; x=1692298167; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+u7giXfaMwciqklgaEuK1kZB1bo2xsdZNzX5RIc2iC0=; b=eHBsVYuH8NW2ymyY1iCOE3doDsISK2qFwA7/BJllAMamIeuHwqimRZBkby51jBdEnn QVVR2qCRsNuRIamlmr87TjOmsu7HVzpaQYaxIkj8EeQ8p8OxITVSIif3/2PPu/8L/CZr VJXtF3zqb+MkOxZ1a0TomHmHJG3aQPWDJRXWttY70NdG3XolONKHdwMwfBBmc64IQUbv M4Lzjj33n57z/SuairyKeausmJmS7uUhjVBBbGzmoine9EMoWpA0viI7w/CAV4vSA4Ae 1AJDv1vT5LatXRFPJw9hQv7EPg7P6USQcZICNbOAXYufLQo4G91xG/Yls/jMhQDxmYnI 1ptg== X-Gm-Message-State: ABy/qLb4RTtX4CFRaaC93xRPWo4f4zuQZejuIQQcAgzwuZJ25tayE45+ 0P8xcTZmuZH350xMfukGkUdqbTJq0vHAGA== X-Google-Smtp-Source: APBJJlHUqpWFqj/8imJ+cxDeCrV4+wiZC0Qls9fMFKNWtcqAh1v0eghVFwfIhQtuU9ke5kHjkHc8AA== X-Received: by 2002:a05:6512:3b1f:b0:4f7:6775:2a66 with SMTP id f31-20020a0565123b1f00b004f767752a66mr12903546lfv.53.1689706166330; Tue, 18 Jul 2023 11:49:26 -0700 (PDT) Received: from debian_development.DebianHome (dynamic-095-119-136-221.95.119.pool.telefonica.de. [95.119.136.221]) by smtp.gmail.com with ESMTPSA id c17-20020a056402121100b0051e1660a34esm1603758edw.51.2023.07.18.11.49.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 11:49:25 -0700 (PDT) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Cc: Paul Moore Subject: [PATCH 1/3] selinux: introduce SECURITY_SELINUX_DEBUG configuration Date: Tue, 18 Jul 2023 20:49:19 +0200 Message-Id: <20230718184921.112786-1-cgzones@googlemail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org The policy database code contains several debug output statements related to hashtable utilization. Those are guarded by the macro DEBUG_HASHES, which is neither documented nor set anywhere. Introduce a new Kconfig configuration guarding this and potential other future debugging related code. Disable the setting by default. Suggested-by: Paul Moore Signed-off-by: Christian Göttsche --- This already uses the de-branded naming scheme, as proposed by Stephen. --- security/selinux/Kconfig | 9 +++++++++ security/selinux/ss/policydb.c | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/security/selinux/Kconfig b/security/selinux/Kconfig index 95a186ec0fcb..9e5be5cc6215 100644 --- a/security/selinux/Kconfig +++ b/security/selinux/Kconfig @@ -68,3 +68,12 @@ config SECURITY_SELINUX_SID2STR_CACHE_SIZE conversion. Setting this option to 0 disables the cache completely. If unsure, keep the default value. + +config SECURITY_SELINUX_DEBUG + bool "SELinux kernel debugging support" + depends on SECURITY_SELINUX + default n + help + This enables debugging code designed to help SELinux kernel developers, + unless you know what this does in the kernel code you should leave this + disabled. diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index cfe77ef24ee2..cc478f3f4778 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -41,7 +41,7 @@ #include "mls.h" #include "services.h" -#ifdef DEBUG_HASHES +#ifdef CONFIG_SECURITY_SELINUX_DEBUG static const char *const symtab_name[SYM_NUM] = { "common prefixes", "classes", @@ -678,7 +678,7 @@ static int (*const index_f[SYM_NUM]) (void *key, void *datum, void *datap) = { cat_index, }; -#ifdef DEBUG_HASHES +#ifdef CONFIG_SECURITY_SELINUX_DEBUG static void hash_eval(struct hashtab *h, const char *hash_name) { struct hashtab_info info; @@ -701,7 +701,7 @@ static void symtab_hash_eval(struct symtab *s) static inline void hash_eval(struct hashtab *h, const char *hash_name) { } -#endif +#endif /* CONFIG_SECURITY_SELINUX_DEBUG */ /* * Define the other val_to_name and val_to_struct arrays @@ -725,7 +725,7 @@ static int policydb_index(struct policydb *p) pr_debug("SELinux: %d classes, %d rules\n", p->p_classes.nprim, p->te_avtab.nel); -#ifdef DEBUG_HASHES +#ifdef CONFIG_SECURITY_SELINUX_DEBUG avtab_hash_eval(&p->te_avtab, "rules"); symtab_hash_eval(p->symtab); #endif From patchwork Tue Jul 18 18:49:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 13317625 X-Patchwork-Delegate: paul@paul-moore.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 862E9C001DC for ; Tue, 18 Jul 2023 18:49:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229763AbjGRStb (ORCPT ); Tue, 18 Jul 2023 14:49:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjGRSt3 (ORCPT ); Tue, 18 Jul 2023 14:49:29 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F511F4 for ; Tue, 18 Jul 2023 11:49:28 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-51f7fb9a944so8517690a12.3 for ; Tue, 18 Jul 2023 11:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1689706167; x=1692298167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=dw8NjoOxJVN2ydB0JGcjkp++KVa2ZJ3WwcRXMfk8Efw=; b=H1R8TuuZzaXtrRZO5DNPPFM3YloMQmRmmKsVkWFuwPjqEoY5UAJ/iCOOr0FrCHegRR uPM+MoZEidA/01j7yN2u845PAz96FuBCzSgBfA98MxBjH7xMACNiFoV3/1jIPAQWi8Ft an+oP99xVHqSUsoT4ga+h2duO3aiHyMn0M9HQbKVrTdogVYAZVOhZHTMuxTDEKUClA/3 hqiILBi0PhfLBqQj5hX0LIksRMCpjJNZxHAzPLEU5dgcFXgOLhFoK5Xvp9aWtX83dsYD 5eXn6LKJJqcEXh5Sg5E3z42F3Mt4DnUGbJxzh11RT8O4GunnMMvwnFAaCODswSHp+MY9 fXUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689706167; x=1692298167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dw8NjoOxJVN2ydB0JGcjkp++KVa2ZJ3WwcRXMfk8Efw=; b=l8RMH4z5aqtJVkXnZqk9wc6wE4JZQZgaYnATpBiSzo/0+fxsLZ4c3i8kj2EgyoIL0w LqsfVbYzbPaPXxJkkbKP3ZYoYyW6Dl8BP/kyu8UcBl6NjXEXHZQHLZhFf3ZzedP19W24 bgI+BWQ+J31yLs3VXUP2athyp3hbWLNMfXLzm2eF44ivFdBGIsi8/IJKdVCJALJCwDvG zlQnfKlRx7V2ZAbFcNXq3rRZOQ8oFx4sh2Wj6jmELuucMA4H9eRz5MhfMe//KT9v6bHq eajmZJEaegyrM6g46/JM4mPLecxmgcIT5o/2YKaqhvaTenT3kkiC6msbTFp1be21yI1H rESA== X-Gm-Message-State: ABy/qLZ5SAsOShD9qdszKCuYu4NSgz9iwgq2ahx/MOESETzbftQJX7Qo 5pXpYy4i1vjsDmAUsUL2pKAflerXkcLR9A== X-Google-Smtp-Source: APBJJlEvtQ5vE5NnKCDXD3A5qjRdjLiu3lKGrMX0pmHbL0vOY+OJT39OEkQm361Z+XCodVf76OZjHg== X-Received: by 2002:aa7:c1d1:0:b0:51e:cc7:534d with SMTP id d17-20020aa7c1d1000000b0051e0cc7534dmr531619edp.24.1689706166836; Tue, 18 Jul 2023 11:49:26 -0700 (PDT) Received: from debian_development.DebianHome (dynamic-095-119-136-221.95.119.pool.telefonica.de. [95.119.136.221]) by smtp.gmail.com with ESMTPSA id c17-20020a056402121100b0051e1660a34esm1603758edw.51.2023.07.18.11.49.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 11:49:26 -0700 (PDT) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 2/3] selinux: move debug functions into debug configuration Date: Tue, 18 Jul 2023 20:49:20 +0200 Message-Id: <20230718184921.112786-2-cgzones@googlemail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230718184921.112786-1-cgzones@googlemail.com> References: <20230718184921.112786-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org avtab_hash_eval() and hashtab_stat() are only used in policydb.c when the configuration SECURITY_SELINUX_DEBUG is enabled. Move the function declarations and definitions under that configuration as well. Signed-off-by: Christian Göttsche --- security/selinux/ss/avtab.c | 2 ++ security/selinux/ss/avtab.h | 3 +++ security/selinux/ss/hashtab.c | 3 ++- security/selinux/ss/hashtab.h | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c index 6766edc0fe68..1f44d277ff61 100644 --- a/security/selinux/ss/avtab.c +++ b/security/selinux/ss/avtab.c @@ -354,6 +354,7 @@ int avtab_alloc_dup(struct avtab *new, const struct avtab *orig) return avtab_alloc_common(new, orig->nslot); } +#ifdef CONFIG_SECURITY_SELINUX_DEBUG void avtab_hash_eval(struct avtab *h, const char *tag) { int i, chain_len, slots_used, max_chain_len; @@ -384,6 +385,7 @@ void avtab_hash_eval(struct avtab *h, const char *tag) tag, h->nel, slots_used, h->nslot, max_chain_len, chain2_len_sum); } +#endif /* CONFIG_SECURITY_SELINUX_DEBUG */ static const uint16_t spec_order[] = { AVTAB_ALLOWED, diff --git a/security/selinux/ss/avtab.h b/security/selinux/ss/avtab.h index d6742fd9c560..0ea1ee9d4dae 100644 --- a/security/selinux/ss/avtab.h +++ b/security/selinux/ss/avtab.h @@ -92,7 +92,10 @@ int avtab_alloc(struct avtab *, u32); int avtab_alloc_dup(struct avtab *new, const struct avtab *orig); struct avtab_datum *avtab_search(struct avtab *h, const struct avtab_key *k); void avtab_destroy(struct avtab *h); + +#ifdef CONFIG_SECURITY_SELINUX_DEBUG void avtab_hash_eval(struct avtab *h, const char *tag); +#endif struct policydb; int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol, diff --git a/security/selinux/ss/hashtab.c b/security/selinux/ss/hashtab.c index 3fb8f9026e9b..b44e62f2b1e4 100644 --- a/security/selinux/ss/hashtab.c +++ b/security/selinux/ss/hashtab.c @@ -103,7 +103,7 @@ int hashtab_map(struct hashtab *h, return 0; } - +#ifdef CONFIG_SECURITY_SELINUX_DEBUG void hashtab_stat(struct hashtab *h, struct hashtab_info *info) { u32 i, chain_len, slots_used, max_chain_len; @@ -129,6 +129,7 @@ void hashtab_stat(struct hashtab *h, struct hashtab_info *info) info->slots_used = slots_used; info->max_chain_len = max_chain_len; } +#endif /* CONFIG_SECURITY_SELINUX_DEBUG */ int hashtab_duplicate(struct hashtab *new, struct hashtab *orig, int (*copy)(struct hashtab_node *new, diff --git a/security/selinux/ss/hashtab.h b/security/selinux/ss/hashtab.h index 043a773bf0b7..7836c0995871 100644 --- a/security/selinux/ss/hashtab.h +++ b/security/selinux/ss/hashtab.h @@ -142,7 +142,9 @@ int hashtab_duplicate(struct hashtab *new, struct hashtab *orig, int (*destroy)(void *k, void *d, void *args), void *args); +#ifdef CONFIG_SECURITY_SELINUX_DEBUG /* Fill info with some hash table statistics */ void hashtab_stat(struct hashtab *h, struct hashtab_info *info); +#endif #endif /* _SS_HASHTAB_H */ From patchwork Tue Jul 18 18:49:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 13317626 X-Patchwork-Delegate: paul@paul-moore.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0180DEB64DD for ; Tue, 18 Jul 2023 18:49:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229452AbjGRStc (ORCPT ); Tue, 18 Jul 2023 14:49:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230281AbjGRSta (ORCPT ); Tue, 18 Jul 2023 14:49:30 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C49B610B for ; Tue, 18 Jul 2023 11:49:28 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-52165886aa3so6878693a12.3 for ; Tue, 18 Jul 2023 11:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1689706167; x=1692298167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ZodW3TXnM31uibPuRNqYlwXl8LeWTene5W4t1FOYt7g=; b=afoT3Knbj+Px88LwcTVKJy9/bns/hdvSpRbgkMiNwddTXZ99Sg3q7ybNxWpBWwUt6T Yj7q/+Pcv5cDwPZvUFyVvu5Kl5bgowhFtjFyyDW6PH2XFpv1PDkOwh2b1NpHhosho+qY dPHotU+Eh1yB0z6V4p4WuyUCiLeFDF55NCeqXXX4kl8tGOCDvpKKeeW9rRZYxBWSCI7e TRJ7PWTrPFs9xnEbepSetdDldUvyND4FKUN9gebKHsRuLse57JQpv69YfhHF11DMuVhK lq49CHJ0ipJorgCEKln04bEJmxBwRs1iPa4g9kG7QLVPAjwsWxBiorECR7gIdQ7PCsnP YWYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689706167; x=1692298167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZodW3TXnM31uibPuRNqYlwXl8LeWTene5W4t1FOYt7g=; b=ktmB8Lb1Zt0fazJJnjVcjhCHI0XYaBmLzRWJRxLT7szjbvqdeYr7qdzmK5NLM6piAA H+dmUjU94q8RZ+/M7z73PpFSrnx81qSlSjRJOj8Ud/ZGiL6osFd1RU8ObieI5roIPfUX /iDnPHdGv7IZ/RgMtLaxcVF8OgJVZC6ycdOzCpy++62/yJaS59ht2l9VKho0GPeJnuQh WTqMyy9QqBxveg9GqmnU30f87OqtNHbLetjZ5oYKtyxk/PCRKKQM+ZqGsCQ9hG/bmizk nnPpRxc6O516YSjgadOpYJcOF8VFLB+W/pWsk+U0V5EUer8t0G/Z16CSgxge6qJRR8cn 6GcA== X-Gm-Message-State: ABy/qLZ8kSHSXYm23VzUYZI6UCFx9ai0KPBlZPWJgbPs4FDShh4Pbgme Ziz73oJuNw9BTXfCT/ePuBA1ac3jE6uY6g== X-Google-Smtp-Source: APBJJlFwAP33W4RI9oX28xa/uUWNp/F9Zk+zlmZ4wM4SZ+5germr0kJj99vMw4Pt2iGo2daxs4RZaw== X-Received: by 2002:aa7:cc8c:0:b0:51d:d30d:a037 with SMTP id p12-20020aa7cc8c000000b0051dd30da037mr747596edt.10.1689706167284; Tue, 18 Jul 2023 11:49:27 -0700 (PDT) Received: from debian_development.DebianHome (dynamic-095-119-136-221.95.119.pool.telefonica.de. [95.119.136.221]) by smtp.gmail.com with ESMTPSA id c17-20020a056402121100b0051e1660a34esm1603758edw.51.2023.07.18.11.49.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 11:49:27 -0700 (PDT) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Subject: [PATCH 3/3] selinux: log missing anonclass in debug configuration Date: Tue, 18 Jul 2023 20:49:21 +0200 Message-Id: <20230718184921.112786-3-cgzones@googlemail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230718184921.112786-1-cgzones@googlemail.com> References: <20230718184921.112786-1-cgzones@googlemail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org Log under the SELinux debug configuration when a caller to the LSM hook inode_init_security_anon does not pass a anonymous inode class name. The class name allows policy writers to transition the anonymous inode into a private type via a name based type transition. Signed-off-by: Christian Göttsche --- security/selinux/hooks.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index b8a8a4f0f2ad..f6ffab9958b6 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -2918,6 +2918,17 @@ static int selinux_inode_init_security_anon(struct inode *inode, if (unlikely(!selinux_initialized())) return 0; +#ifdef CONFIG_SECURITY_SELINUX_DEBUG + /* + * Allow policy writers to transition the anonymous inode into + * a private type via a name based type transition. + */ + if (!name) { + pr_debug("SELinux: no class given for anonymous inode\n"); + dump_stack(); + } +#endif + isec = selinux_inode(inode); /*