From: Dominick Grift <dominick.grift@defensec.nl>
To: Matthew Sheets <masheets@linux.microsoft.com>
Cc: SELinux <selinux@vger.kernel.org>
Subject: Re: secilc genfscon parsing error
Date: Wed, 23 Nov 2022 19:10:10 +0100 [thread overview]
Message-ID: <87ilj5h799.fsf@defensec.nl> (raw)
In-Reply-To: <d11c25c5-727e-342a-162a-e3851ff03d27@linux.microsoft.com> (Matthew Sheets's message of "Wed, 23 Nov 2022 08:53:42 -0700")
Matthew Sheets <masheets@linux.microsoft.com> writes:
> Hi,
>
> I am seeing a parsing error from secilc when trying to compile the
> following line:
> (genfscon sysfs "/zap" file (system_u object_r foo ((s0) (s0))))
Works fine here (unless i am overlooking something:
root@brutus:~# cat > mytest.cil <<EOF
> (blockinherit .sysfile.base_template)
> EOF
root@brutus:~# cat > mytest.cil <<EOF
> (block foo (blockinherit .sysfile.base_template) (genfscon "/foo" file sysfile_context))
> EOF
root@brutus:~# semodule -i mytest.cil
root@brutus:~# echo $?
0
root@brutus:~# seinfo --genfscon | grep foo
genfscon /foo file sys.id:sys.role:foo.sysfile:s0
root@brutus:~#
>
> But according to the documentation here:
> https://github.com/SELinuxProject/selinux/blob/master/secilc/docs/cil_file_labeling_statements.md#genfscon
> I believe this should be a valid line.
>
> The compiler error given is:
> Invalid syntax
> Bad genfscon declaration at out.cil:129
> Failed to build AST
> Failed to compile cildb: -1
>
> If I remove the file keyword everything compiles correctly.
>
> Other interesting points of data:
>
> In ref policy there is the following line in selinux.te
> genfscon selinuxfs /booleans/ -- gen_context(system_u:object_r:boolean_t,s0)
>
> When compiling this to cil with checkpolicy the following line is produced:
> (genfscon selinuxfs "/booleans/" (system_u object_r boolean_t
> (systemlow systemlow)))
> Which has no reference to the optional file_type field.
>
--
gpg --locate-keys dominick.grift@defensec.nl
Key fingerprint = FCD2 3660 5D6B 9D27 7FC6 E0FF DA7E 521F 10F6 4098
Dominick Grift
next prev parent reply other threads:[~2022-11-23 18:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 15:53 secilc genfscon parsing error Matthew Sheets
2022-11-23 16:15 ` James Carter
2022-11-23 17:06 ` Matthew Sheets
2022-11-23 18:10 ` Dominick Grift [this message]
2022-11-23 18:13 ` Dominick Grift
2022-11-23 18:29 ` Matthew Sheets
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=87ilj5h799.fsf@defensec.nl \
--to=dominick.grift@defensec.nl \
--cc=masheets@linux.microsoft.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.