From: William Roberts <bill.c.roberts@gmail.com>
To: Mike Palmiotto <mike.palmiotto@crunchydata.com>
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH] libsepol/cil: fix mlsconstrain segfault
Date: Mon, 17 Jun 2019 11:01:06 -0700 [thread overview]
Message-ID: <CAFftDdodVXDdgMyTSV5188W5HcSrJu4pvpsufQPcf5U1Bw3WJQ@mail.gmail.com> (raw)
In-Reply-To: <20190617151512.2209-1-mike.palmiotto@crunchydata.com>
ack and staged: https://github.com/SELinuxProject/selinux/pull/164
On Mon, Jun 17, 2019 at 8:16 AM <mike.palmiotto@crunchydata.com> wrote:
>
> From: Mike Palmiotto <mike.palmiotto@crunchydata.com>
>
> Installing a cil module with invalid mlsconstrain syntax currently
> results in a segfault. In the following module, the right-hand side of
> the second operand of the OR is a list (mlstrustedobject):
>
> $ cat test.cil
> (class test (foo) )
> (classorder (unordered test))
>
> (mlsconstrain (test (foo))
> (or
> (dom h1 h2)
> (eq t2 (mlstrustedobject))
> )
> )
>
> $ sudo semodule -i test.cil
> zsh: segmentation fault sudo semodule -i test.cil
>
> This syntax is invalid and should error accordingly, rather than
> segfaulting. This patch provides this syntax error for the same module:
>
> $ sudo semodule -i test.cil
> t1, t2, r1, r2, u1, u2 cannot be used on the left side with a list on the right side
> Bad expression tree for constraint
> Bad constrain declaration at /var/lib/selinux/mls/tmp/modules/400/test/cil:4
> semodule: Failed!
>
> Signed-off-by: Mike Palmiotto <mike.palmiotto@crunchydata.com>
> ---
> libsepol/cil/src/cil_verify.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/libsepol/cil/src/cil_verify.c b/libsepol/cil/src/cil_verify.c
> index 1036d73c..346fbac9 100644
> --- a/libsepol/cil/src/cil_verify.c
> +++ b/libsepol/cil/src/cil_verify.c
> @@ -225,6 +225,9 @@ int cil_verify_constraint_leaf_expr_syntax(enum cil_flavor l_flavor, enum cil_fl
> cil_log(CIL_ERR, "u3, r3, and t3 can only be used with mlsvalidatetrans rules\n");
> goto exit;
> }
> + } else if (r_flavor == CIL_LIST) {
> + cil_log(CIL_ERR, "t1, t2, r1, r2, u1, u2 cannot be used on the left side with a list on the right side\n");
> + goto exit;
> }
> } else {
> if (r_flavor == CIL_CONS_U2) {
> --
> 2.21.0
>
next prev parent reply other threads:[~2019-06-17 18:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 15:15 [PATCH] libsepol/cil: fix mlsconstrain segfault mike.palmiotto
2019-06-17 18:01 ` William Roberts [this message]
2019-06-19 16:04 ` William Roberts
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=CAFftDdodVXDdgMyTSV5188W5HcSrJu4pvpsufQPcf5U1Bw3WJQ@mail.gmail.com \
--to=bill.c.roberts@gmail.com \
--cc=mike.palmiotto@crunchydata.com \
--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;
as well as URLs for NNTP newsgroup(s).