Commit graph

153 commits

Author SHA1 Message Date
Thiébaud Weksteen
a9f20263fd Merge tag '3.5' into master
We were previously on 3.5-rc2, there has been only little changes since
then.

Followed the steps:
  repo start update_3.5 .
  git merge 3.5 --no-ff # No merge conflicts were found.
  lunch && m
  repo upload .
  # Update METADATA in a separate change.

Test: TH
Change-Id: If88fe90d2cbdb1ba6a279cba8b397cd2c808c6ab
2023-03-21 15:27:40 +11:00
Jason Zaman
d6e96c5929
Update VERSIONs to 3.5 for release.
Signed-off-by: Jason Zaman <jason@perfinion.com>
2023-02-23 05:16:11 -08:00
Jason Zaman
83e56c8a8b
Update VERSIONs to 3.5-rc3 for release.
Signed-off-by: Jason Zaman <jason@perfinion.com>
2023-02-10 22:32:13 -08:00
Inseob Kim
ad990cb28b Merge remote-tracking branch 'aosp/upstream-master' into HEAD
Bug: 262469329
Test: build and boot cuttlefish
Change-Id: Ic97540265491a501cd89f40f46bf1f97d6a753e2
2023-01-16 13:45:35 +09:00
Jason Zaman
3ccea01c69
Update VERSIONs to 3.5-rc2 for release.
Signed-off-by: Jason Zaman <jason@perfinion.com>
2023-01-15 15:40:55 -08:00
Jason Zaman
013ecfd7fa Update VERSIONs to 3.5-rc1 for release.
Signed-off-by: Jason Zaman <jason@perfinion.com>
2022-12-22 13:10:26 -08:00
Thiébaud Weksteen
4d132a10b0 Fix build after upstream merge
- Reference renamed file: COPYING -> LICENSE in Android.bp
- Fix constext_str calls now returning const char *
- Comment out cil_write_src_info_node which is not used on Android
- Include new selinux_internal.c source file

Bug: 253327909
Test: build and boot on bramble
Test: sediff between current and new policy; no change
Change-Id: I506479befb3c0b99136cd842b2a77a6a8bea18ed
2022-11-25 14:10:15 +11:00
Thiébaud Weksteen
a5d093d150 Merge remote-tracking branch 'aosp/upstream-master' into rebase_20221110
Fix conflict in libselinux/src/label.c

Bug: 253327909
Test: n/a; follow up commit for fixing build
Change-Id: Ibdd5e384dda9e995dc52574dbcc7ad8d89698dc3
2022-11-14 14:29:35 +11:00
Paul Moore
a0a216ff7d docs: provide a top level LICENSE file
Provide a top level LICENSE file explaining how multiple the SELinux
userspace is released under multiple different licenses.  Also ensure
that all the different license files share a consistent file name,
LICENSE, to make it easier for people to identify the license files.

This is to help meet the OpenSSF Best Practices requirements.

Signed-off-by: Paul Moore <paul@paul-moore.com>
2022-10-05 08:20:38 -04:00
Dominick Grift
a21e8bee06 secilc/doc: classmap is also allowed in permissionx
Signed-off-by: Dominick Grift <dominick.grift@defensec.nl>
2022-10-05 08:14:11 -04:00
bauen1
02bdee369c secilc/docs: disable pandoc default css for html docs
Some time ago pandoc started shipping a default css file for html, while
that is nice, it limits the max-width of the body element to 36em. We
have a lot of tables, code examples, etc... in the manual that are too
big for that, requiring constant scrolling.

See https://github.com/jgm/pandoc/blob/master/data/templates/styles.html
for the default used.

While some styling, perhaps even dark/light mode support in the CSS
would be nice, I didn't manage to find a simple way to achieve this, so
for now just disable the CSS.

Expand the arguments for pandoc in the Makefile for better readability.

Signed-off-by: Jonathan Hettwer (bauen1) <j2468h@gmail.com>
2022-09-01 09:27:17 -04:00
bauen1
198ca56a3a secilc/docs: fix syntax highlighting
It appears that a recent version of pandoc (or the library it uses)
changed where the lists are found in the XML or became more strict.

Move the lists to the right location in the document.

Signed-off-by: Jonathan Hettwer (bauen1) <j2468h@gmail.com>
2022-09-01 09:27:11 -04:00
Petr Lautrbach
0a8c177dac
Update VERSIONs to 3.4 for release.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2022-05-18 16:51:03 +02:00
Ondrej Mosnacek
539b066036 libsepol/cil: add support for self keyword in type transitions
With the addition of the anon_inode class in the kernel, 'self'
transition rules became useful, but haven't been implemented.

The typetransition, typemember, and typechange statements share the
relevant code, so this patch implements the self keyword in all of them
at the CIL level. It also adds basic coverage for the such 'self' rules
to the secilc test policy.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Acked-by: James Carter <jwcart2@gmail.com>
2022-05-16 10:37:05 -04:00
Petr Lautrbach
9df28c241a
Update VERSIONs to 3.4-rc3 for release.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2022-05-04 19:20:37 +02:00
Petr Lautrbach
2a167d1156
Update VERSIONs to 3.4-rc2 for release.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2022-04-20 21:48:57 +02:00
Petr Lautrbach
73562de8fc
Update VERSIONs to 3.4-rc1 for release.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2022-04-06 19:53:39 +02:00
Topi Miettinen
8243b3e825 secilc: kernel policy language is infix
Prefix / Polish (CIL): and a b
Infix (KPL): a and b
Postfix / Reverse Polish: a b and

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2022-03-30 13:31:04 -04:00
Thiébaud Weksteen
5ab1edf09d Merge remote-tracking branch 'aosp/upstream-master' into update_head
Change-Id: I294af47a0cc73b753d23d8449575015d21219ddf
2022-03-15 12:24:38 +11:00
Thiébaud Weksteen
671624ef61 Merge upstream '3.3' into update_3_3
Followed the following steps:
    # aosp mirror does not have the upstream tags. Manually mark the
    # 3.3 release. See
    # https://github.com/SELinuxProject/selinux/releases/tag/3.3
    git tag 3.3 7f600c40bc
    repo start update_3_3 .
    git merge 3.3 --no-ff # No merge conflicts were found.
    lunch && m
    repo upload .

Bug: 37755687
Test: Build aosp_bramble-userdebug and manually compare the generated
    /{system,vendor,product}/etc/selinux* files with their previous
    versions. All are identical.
Change-Id: I6a514d7db9a752c44cc61d343f7c1a60f750f317
2021-12-22 09:15:13 +11:00
James Carter
03b1dcac2d secilc/docs: Document the optional file type for genfscon rules
Update the CIL documentation to include the optional file type for
genfscon rules.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-12-09 10:46:26 -05:00
Thiébaud Weksteen
454466e2e4 Revert "Revert "Merge remote-tracking branch 'aosp/upstream-mast..."
Revert^2 "Use cil_write_build_ast"

bde09de39feec91cf8220f0f798a6e52154d69e9

Change-Id: I3ab19bda9c1968409ad5a4f4d0866649036c683c
2021-10-27 04:50:56 +00:00
Petr Lautrbach
7f600c40bc
Update VERSIONs to 3.3 for release.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2021-10-21 16:31:23 +02:00
Petr Lautrbach
5319c49d8a
Update VERSIONs to 3.3-rc3 for release.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2021-10-06 13:28:15 +02:00
Christian Göttsche
b1a3c2030c Correct some typos
Found by codespell

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: Petr Lautrbach <plautrba@redhat.com>
2021-09-30 15:42:11 -04:00
Petr Lautrbach
0b833973bf
Update VERSIONs to 3.3-rc2 for release.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2021-09-22 17:14:25 +02:00
Thiébaud Weksteen
c65aca49bb Revert "Merge remote-tracking branch 'aosp/upstream-master' into..."
Revert "Use cil_write_build_ast"

Revert submission 1827311-update_libselinux

Reason for revert: b/200771997 
Reverted Changes:
I088d1e94c:Fix build and use new cil_write_build_ast
I14dc4dc58:Merge remote-tracking branch 'aosp/upstream-master...
I7b77f4469:Use cil_write_build_ast

Change-Id: Iec17732997ab203787f021f437f31e51ef886425
2021-09-22 09:15:53 +00:00
Thiébaud Weksteen
9e8922418a Merge remote-tracking branch 'aosp/upstream-master' into update_3_3
Change-Id: I14dc4dc589a5f72af6ba6d2cc1800d145f0234aa
2021-09-09 15:05:30 +02:00
Petr Lautrbach
38cb18e931 Update VERSIONs and Python bindings version to 3.3-rc1 for release
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2021-09-08 09:49:46 +02:00
James Carter
4878981229 libsepol/secilc/docs: Update the CIL documentation
Update the CIL documentation for the in-statement processing and
duplicate macro and block declarations with block inheritance.

Duplicate macro and block declarations are allowed if they occur as
the result of block inheritance. Document the fact that inherited
macros are overridden by any macros already declared in a
namespace and that declaring a block in a namespace that will
inherit a block with the same name can be used to allow in-statements
to be used on the block.

The new in-statement syntax still supports the old syntax but adds
the ability to specify whether the in-statement should be resolved
before or after block inheritance is resolved.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-09-07 10:28:46 -04:00
Christian Göttsche
6d93701f39 secilc: fix memory leaks in secilc2conf
When specifying -o more than once, the previous allocation leaks.

Found by scan-build.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
2021-07-19 10:42:45 -04:00
Christian Göttsche
edb948fb0b secilc: fix memory leaks in secilc
When specifying -o or -f more than once, the previous allocations leak.

Found by scan-build.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
2021-07-19 10:42:45 -04:00
James Carter
532a4cc336
libsepol/cil: Add support for using qualified names to secil2conf
Provide the option "-Q" or "--qualified-names" to indicate that the
policy is using qualified names.

Using qualified names means that declaration names can have "dots"
in them, but blocks, blockinherits, blockabstracts, and in-statements
are not allowed in the policy.

The libsepol function cil_set_qualified_names() is called with the
desired value for the CIL db's "qualified_names" field.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-07-03 16:00:30 +02:00
James Carter
74c06d763f
libsepol/cil: Add support for using qualified names to secil2tree
Provide the option "-Q" or "--qualified-names" to indicate that the
policy is using qualified names.

Using qualified names means that declaration names can have "dots"
in them, but blocks, blockinherits, blockabstracts, and in-statements
are not allowed in the policy.

The libsepol function cil_set_qualified_names() is called with the
desired value for the CIL db's "qualified_names" field.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-07-03 16:00:30 +02:00
James Carter
f7b8b5055f
secilc: Add support for using qualified names to secilc
Provide the option "-Q" or "--qualified-names" to indicate that the
policy is using qualified names.

Using qualified names means that declaration names can have "dots"
in them, but blocks, blockinherits, blockabstracts, and in-statements
are not allowed in the policy.

The libsepol function cil_set_qualified_names() is called with the
desired value for the CIL db's "qualified_names" field.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-07-03 16:00:30 +02:00
James Carter
4a60fd78d2 secilc/test: Add test for anonymous args
CIL has rules that allow names to be assigned to certain objects
like MLS category sets, MLS levels, MLS ranges, IP addresses, and
class permission sets. These objects can also be named as parameters
for a macro. A call may pass in a name for one of these objects, but
it also may pass in one of the actual objects. These objects are
referred as anonymous arguments.

Add CIL policy that can be used to test whether or not anonymous
arguments are being handled properly in macros. Also test the
equivalent named arguments to help determine if the problem is with
that argument type or just with an anonymous argument of that type.

The anonymouse arguments that are tested are categoryset, level,
levelrange, ipaddr, and classpermission.

Signed-off-by: James Carter <jwcart2@gmail.com>
Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2021-06-22 09:33:28 -04:00
James Carter
fe9f10e0ee secilc/docs: Relocate and reword macro call name resolution order
The listing of the order was in the macro section, but it belongs
in the call section.

Move the listing of the order to the call section and provide a
better explanation.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-06-04 10:23:23 -04:00
James Carter
7fec5e93d9 secilc/docs: Document the order that inherited rules are resolved in
In the blockinherit section of the CIL documentation clearly state
the order in which inherited rules are resolved.

That order is:

1) The parent namespaces (if any) where the blockinherit rule is
   located with the exception of the global namespace.

2) The parent namespaces of the block being inherited (but not that
   block's namespace) with the exception of the global namespace.

3) The global namespace.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-05-31 12:38:23 +02:00
Yi-Yo Chiang
ff3c99978a secilc.c: Don't fail if input file is empty
fread(3) returns zero if |size| is zero. This confuses secilc, and
causes it to fail with a "Failure reading file" error, even though there
is no error.

Add a shortcut that closes and skips an input file if file size is zero.

Signed-off-by: Yi-Yo Chiang <yochiang@google.com>
Change-Id: I9832c62ebf6f716235e871b5e29b0fd70c94b453
2021-05-11 10:09:48 +02:00
James Carter
d0a07a7f13
secilc: Create the new program called secil2tree to write out CIL AST
secil2tree is the SELinux CIL AST writer. It calls the cil functions
cil_write_parse_ast(), cil_write_build_ast(), or cil_write_resolve_ast()
to write out the parse tree, the CIL AST after the build phase, or the
CIL AST after the resolve phase.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-04-21 21:45:31 +02:00
James Carter
bad0a746e9 secilc/docs: Update the CIL documentation for various blocks
Update the documentation for macros, booleans, booleanifs, tunables,
tunableifs, blocks, blockabstracts, blockinherits, and optionals to
tell where these statements can be used and, for those that have
blocks, what statements are not allowed in them.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-04-19 14:05:23 -04:00
Yi-Yo Chiang
d1a34d3f1d secilc.c: Don't fail if input file is empty
fread(3) returns zero if |size| is zero. This confuses secilc, and
causes it to fail with a "Failure reading file" error, even though there
is no error.

Add a shortcut that closes and skips an input file if file size is zero.

Signed-off-by: Yi-Yo Chiang <yochiang@google.com>
2021-04-14 15:14:59 -04:00
Dominick Grift
1e4e7f6a12 cil_conditional_statements.md: fix expr definition
expr "(expr (tunable_id tunable_id))" does not work but "(expr
tunable_id tunable_id)" does work

for example, this works

(tunable test1)
(tunable test2)
(tunableif (or test1 test2)
	   (true
	    (allow a b (c (d)))))

but this does not work:

(tunable test1)
(tunable test2)
(tunableif (or (test1 test2))
	   (true
	    (allow a b (c (d)))))

Signed-off-by: Dominick Grift <dominick.grift@defensec.nl>
2021-03-29 11:06:11 -04:00
James Carter
45d7a0a563 secilc/docs: Lists are now allowed in constraint expressions
Update the CIL documentation to show that lists are allowed in
constraint expressions.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-03-18 10:09:08 -04:00
Petr Lautrbach
cf853c1a0c
Update VERSIONs to 3.2 for release.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2021-03-04 16:42:59 +01:00
Petr Lautrbach
d4d1f4ba7e
Update VERSIONs to 3.2-rc3 for release.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2021-02-24 15:49:59 +01:00
Dominick Grift
49ff851c98 secilc: fixes cil_role_statements.md example
Signed-off-by: Dominick Grift <dominick.grift@defensec.nl>
Acked-by: James Carter <jwcart2@gmail.com>
2021-02-19 15:19:50 +01:00
bauen1
038817036f secilc/docs: add custom color theme
Since the default pandoc themes either don't highlight everything or
don't fit the black/white color style of the html / pdf I've created my
own.

Signed-off-by: Jonathan Hettwer <j2468h@gmail.com>
2021-02-16 09:32:36 -05:00
bauen1
4c8d609498 secilc/docs: add syntax highlighting for secil
This is done by creating a somewhat rudimentary KDE syntax xml for
pandoc.

The default styles provided by pandoc don't look very good and don't
highlight e.g. the strings marked as builtin.

Signed-off-by: Jonathan Hettwer <j2468h@gmail.com>
2021-02-16 09:32:32 -05:00
bauen1
057d72af2d secilc/docs: use fenced code blocks for cil examples
Also fixes the occasional missing brackets as higlighted by my editor,
however the individual examples where not reviewed much closer.

secilc was chosen as language name because the compiler is named secilc
and outside of SELinux the name cil is less searchable and could lead to
confusion.

Signed-off-by: Jonathan Hettwer <j2468h@gmail.com>
2021-02-16 09:32:29 -05:00