From: James Carter <jwcart2@gmail.com>
To: selinux@vger.kernel.org
Cc: nicolas.iooss@m4x.org, James Carter <jwcart2@gmail.com>
Subject: [PATCH 6/6] libsepol/cil: Resolve anonymous levels only once
Date: Thu, 13 May 2021 14:52:54 -0400 [thread overview]
Message-ID: <20210513185254.559588-7-jwcart2@gmail.com> (raw)
In-Reply-To: <20210513185254.559588-1-jwcart2@gmail.com>
Anonymous levels can be passed as call arguments and they can
appear in anonymous levelranges as well.
Anonymous call arguments are resolved when they are used in a rule.
If more than one rule uses the anonymous level, then a memory leak
will occur when a new list for the category datum expression is
created without destroying the old one.
When resolving a level, check if the sensitivity datum has already
been resolved. If it has, then the categories have been as well.
Signed-off-by: James Carter <jwcart2@gmail.com>
---
libsepol/cil/src/cil_resolve_ast.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libsepol/cil/src/cil_resolve_ast.c b/libsepol/cil/src/cil_resolve_ast.c
index 865297fb..9c95f2a0 100644
--- a/libsepol/cil/src/cil_resolve_ast.c
+++ b/libsepol/cil/src/cil_resolve_ast.c
@@ -1700,6 +1700,10 @@ int cil_resolve_level(struct cil_tree_node *current, struct cil_level *level, vo
struct cil_symtab_datum *sens_datum = NULL;
int rc = SEPOL_ERR;
+ if (level->sens) {
+ return SEPOL_OK;
+ }
+
rc = cil_resolve_name(current, (char*)level->sens_str, CIL_SYM_SENS, extra_args, &sens_datum);
if (rc != SEPOL_OK) {
cil_log(CIL_ERR, "Failed to find sensitivity\n");
--
2.26.3
next prev parent reply other threads:[~2021-05-13 18:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-13 18:52 [PATCH 0/6] More secilc-fuzzer problems fixed James Carter
2021-05-13 18:52 ` [PATCH 1/6] libsepol/cil: Handle disabled optional blocks in earlier passes James Carter
2021-05-13 18:52 ` [PATCH 2/6] libsepol/cil: Destroy the permission nodes when exiting with an error James Carter
2021-05-13 18:52 ` [PATCH 3/6] libsepol/cil: Limit the number of open parenthesis allowed James Carter
2021-05-13 18:52 ` [PATCH 4/6] libsepol/cil: Resolve anonymous class permission sets only once James Carter
2021-05-13 18:52 ` [PATCH 5/6] libsepol/cil: Pointers to datums should be set to NULL when resetting James Carter
2021-05-13 18:52 ` James Carter [this message]
2021-06-03 17:05 ` [PATCH 0/6] More secilc-fuzzer problems fixed James Carter
2021-06-04 16:58 ` James Carter
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=20210513185254.559588-7-jwcart2@gmail.com \
--to=jwcart2@gmail.com \
--cc=nicolas.iooss@m4x.org \
--cc=selinux@vger.kernel.org \
/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