From: Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>
To: <john.johansen@canonical.com>, <paul@paul-moore.com>,
<jmorris@namei.org>, <serge@hallyn.com>
Cc: <linux-security-module@vger.kernel.org>,
<apparmor@lists.ubuntu.com>, <linux-kernel@vger.kernel.org>,
<gautham.shenoy@amd.com>, <Santosh.Shukla@amd.com>,
<Ananth.Narayan@amd.com>, <raghavendra.kodsarathimmappa@amd.com>,
<paulmck@kernel.org>, <boqun.feng@gmail.com>,
<vinicius.gomes@intel.com>, <mjguzik@gmail.com>,
Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>
Subject: [RFC 9/9] apparmor: Switch unconfined and in tree labels to managed ref mode
Date: Wed, 10 Jan 2024 16:48:56 +0530 [thread overview]
Message-ID: <20240110111856.87370-9-Neeraj.Upadhyay@amd.com> (raw)
In-Reply-To: <f184a2d6-7892-4e43-a0cd-cab638c3d5c2@amd.com>
Switch unconfined and in-tree labels to percpu managed
mode of percpu rcuref. This helps avoid memory contention
in ref get and put operations.
Signed-off-by: Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>
---
security/apparmor/label.c | 1 +
security/apparmor/policy_ns.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/security/apparmor/label.c b/security/apparmor/label.c
index f28dec1c3e70..57fcd5b3e48a 100644
--- a/security/apparmor/label.c
+++ b/security/apparmor/label.c
@@ -710,6 +710,7 @@ static struct aa_label *__label_insert(struct aa_labelset *ls,
rb_link_node(&label->node, parent, new);
rb_insert_color(&label->node, &ls->root);
label->flags |= FLAG_IN_TREE;
+ percpu_rcuref_manage(&label->count);
return aa_get_label(label);
}
diff --git a/security/apparmor/policy_ns.c b/security/apparmor/policy_ns.c
index 1f02cfe1d974..ff261b119c53 100644
--- a/security/apparmor/policy_ns.c
+++ b/security/apparmor/policy_ns.c
@@ -124,6 +124,7 @@ static struct aa_ns *alloc_ns(const char *prefix, const char *name)
goto fail_unconfined;
/* ns and ns->unconfined share ns->unconfined refcount */
ns->unconfined->ns = ns;
+ percpu_rcuref_manage(&ns->unconfined->label.count);
atomic_set(&ns->uniq_null, 0);
@@ -377,6 +378,7 @@ int __init aa_alloc_root_ns(void)
}
kernel_t = &kernel_p->label;
root_ns->unconfined->ns = aa_get_ns(root_ns);
+ percpu_rcuref_manage(&root_ns->unconfined->label.count);
return 0;
}
--
2.34.1
next prev parent reply other threads:[~2024-01-10 11:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 11:11 [RFC 0/9] Nginx refcount scalability issue with Apparmor enabled and potential solutions Neeraj Upadhyay
2024-01-10 11:18 ` [RFC 1/9] doc: Add document for apparmor refcount management Neeraj Upadhyay
2024-01-10 11:18 ` [RFC 2/9] apparmor: Switch labels to percpu refcount in atomic mode Neeraj Upadhyay
2024-01-10 11:18 ` [RFC 3/9] apparmor: Switch unconfined namespaces refcount to percpu mode Neeraj Upadhyay
2024-01-10 11:18 ` [RFC 4/9] apparmor: Add infrastructure to reclaim percpu labels Neeraj Upadhyay
2024-01-10 11:18 ` [RFC 5/9] apparmor: Switch intree labels to percpu mode Neeraj Upadhyay
2024-01-10 11:18 ` [RFC 6/9] apparmor: Initial prototype for optimizing ref switch Neeraj Upadhyay
2024-01-10 11:18 ` [RFC 7/9] percpu-rcuref: Add basic infrastructure Neeraj Upadhyay
2024-01-10 11:18 ` [RFC 8/9] apparmor: Switch labels to percpu rcurefcount in unmanaged mode Neeraj Upadhyay
2024-01-10 11:18 ` Neeraj Upadhyay [this message]
2024-02-07 4:40 ` [RFC 0/9] Nginx refcount scalability issue with Apparmor enabled and potential solutions Neeraj Upadhyay
2024-02-09 17:33 ` John Johansen
2024-03-02 10:23 ` Mateusz Guzik
2024-03-08 20:09 ` John Johansen
2024-05-24 21:10 ` Mateusz Guzik
2024-05-24 21:51 ` John Johansen
2024-05-28 13:29 ` Mateusz Guzik
2024-05-29 0:37 ` John Johansen
2024-05-29 9:38 ` Mateusz Guzik
2024-05-30 4:19 ` Neeraj Upadhyay
2024-05-30 5:59 ` John Johansen
2024-05-30 9:47 ` Mateusz Guzik
2024-05-31 0:17 ` John Johansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240110111856.87370-9-Neeraj.Upadhyay@amd.com \
--to=neeraj.upadhyay@amd.com \
--cc=Ananth.Narayan@amd.com \
--cc=Santosh.Shukla@amd.com \
--cc=apparmor@lists.ubuntu.com \
--cc=boqun.feng@gmail.com \
--cc=gautham.shenoy@amd.com \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mjguzik@gmail.com \
--cc=paul@paul-moore.com \
--cc=paulmck@kernel.org \
--cc=raghavendra.kodsarathimmappa@amd.com \
--cc=serge@hallyn.com \
--cc=vinicius.gomes@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®