Commit graph

5257 commits

Author SHA1 Message Date
Thiébaud Weksteen
52aebc0e15 Fix build for android_platform.c am: 4a15e5176d am: e39a9af2db
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254488

Change-Id: Idd1fadc274f851eb736b4daf66b307a6f37bf859
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:47:53 +00:00
Thiébaud Weksteen
64decb8a4d Merge branches 'split_seapp' and 'split_device' into master am: 6cdba9c863 am: 92d45b050b
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254487

Change-Id: Ib1fdc54c32751c7ba257669730ecbe5a71218fed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:47:52 +00:00
Thiébaud Weksteen
89ec8b4c88 Rename android_platform.c to android_device.c am: 9348addf0f am: cddcbde94c
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254485

Change-Id: Ib21269bdfd823025b70941e3ccc3a3def8e564cd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:47:51 +00:00
Thiébaud Weksteen
21c86dabc6 Trim down android_seapp.c am: 92f48ee3db am: 1356e7e200
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254484

Change-Id: I44c70467e1e63912d597cf1e724600cb768d7dbf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:47:50 +00:00
Thiébaud Weksteen
e17ac86477 Move android_platform.c to android_seapp.c am: 25fd00bf4e am: c38adaaacb
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254483

Change-Id: I44067418956c8bbca795dc2656e092a0bbd95f48
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:47:49 +00:00
Thiébaud Weksteen
2433ca5b26 Define and use path_alts_t am: c8b3ae636f am: e958b5dbbb
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2239403

Change-Id: Ie18b0cab538c7b81ba8245c4d7b130464903ccc9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:47:48 +00:00
Thiébaud Weksteen
4a4f804445 Remove android_common.h am: 12b4861e66 am: 66ead1d6db
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2239402

Change-Id: I1e495e0d35c701113658d64b9f02a336847bd10f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:47:46 +00:00
Thiébaud Weksteen
5dd66f50c4 Add unit test for seapp_contexts am: 67fba33f8a
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254490

Change-Id: Id7b070c97dcc8dc5362a7b859b8305196394c6cd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:04:22 +00:00
Thiébaud Weksteen
7d6e2e26b8 Build android_seapp.c for the host am: 65fe8e161f
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254489

Change-Id: I7b1df9296e6e9b77e341ab45c45176723d11d6d3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:04:21 +00:00
Thiébaud Weksteen
e39a9af2db Fix build for android_platform.c am: 4a15e5176d
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254488

Change-Id: I2890e9b8bd4b09bd4169a25eea901686fd3486c4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:04:20 +00:00
Thiébaud Weksteen
92d45b050b Merge branches 'split_seapp' and 'split_device' into master am: 6cdba9c863
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254487

Change-Id: I6002a315de32f33df672e1be3494dcefce7159bf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:04:19 +00:00
Thiébaud Weksteen
cddcbde94c Rename android_platform.c to android_device.c am: 9348addf0f
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254485

Change-Id: Ic35521d2d17dae36d85812909e3ed40e850d30d7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:04:17 +00:00
Thiébaud Weksteen
1356e7e200 Trim down android_seapp.c am: 92f48ee3db
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254484

Change-Id: I81ce7f41c13b3055ee9adf489f9fe5ab504efd57
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:04:16 +00:00
Thiébaud Weksteen
c38adaaacb Move android_platform.c to android_seapp.c am: 25fd00bf4e
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2254483

Change-Id: Ic00aec55d861c75979952061048cd4c4a313576b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:04:15 +00:00
Thiébaud Weksteen
e958b5dbbb Define and use path_alts_t am: c8b3ae636f
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2239403

Change-Id: I091da6e2f0564c9bc9b2cdcc4d04d78312ac635f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:04:14 +00:00
Thiébaud Weksteen
66ead1d6db Remove android_common.h am: 12b4861e66
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2239402

Change-Id: Ie0627e7c7a3ad528a2ca85e952189b7d068deeb2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-19 07:04:12 +00:00
Thiébaud Weksteen
67fba33f8a Add unit test for seapp_contexts
Split selinux_android_seapp_context_reload and seapp_context_lookup to
prevent the loading and use of the default seapp_contexts files (e.g.,
/system/etc/selinux/plat_file_contexts). The exposed API and current
callers of seapp_context_lookup remain the same.

Test: atest --host libselinux_test
Bug: 234313751
Change-Id: If3b525b92fa43e5599075509d4de55ff39ec8a6e
2022-10-19 10:09:02 +11:00
Thiébaud Weksteen
65fe8e161f Build android_seapp.c for the host
android_seapp.c can be build on host. strlcpy is replaced with strncpy
(the string copied is static). An alias seapp_getpwuid is created to
allow faking for the unit test.

Bug: 234313751
Test: build & boot
Change-Id: I0e86d83fddb3ceb20d63963b40ea0ca227a8538a
2022-10-19 10:09:02 +11:00
Thiébaud Weksteen
4a15e5176d Fix build for android_platform.c
With android_platform.c split between android_device.c and
android_seapp.c, update the build configuration. Move to the internal
header the interface expected between the two files.

Test: m
Bug: 234313751
Change-Id: If13a7484bf48a49e36a424c39f6f62ec6140fc22
2022-10-19 10:09:02 +11:00
Thiébaud Weksteen
6cdba9c863 Merge branches 'split_seapp' and 'split_device' into master
Change-Id: Ibc5db2b8ab21c9e35ef60899852765bd56bea4a1
2022-10-19 10:08:48 +11:00
Thiébaud Weksteen
9348addf0f Rename android_platform.c to android_device.c
Change-Id: I68b5452ea285430ddfbe6369e9f9636f0aceb584
2022-10-19 10:08:24 +11:00
Thiébaud Weksteen
92f48ee3db Trim down android_seapp.c
Change-Id: Ie570a8c86a597c147d7a6c49cc1cd8014c46bacb
2022-10-19 10:08:24 +11:00
Thiébaud Weksteen
25fd00bf4e Move android_platform.c to android_seapp.c
Change-Id: If9c4f99a5c24d8698f8030e9ee0af8e74f42e5bd
2022-10-19 10:08:24 +11:00
Thiébaud Weksteen
d2180211b9 Trim down android_device.c
Change-Id: Ida1d455f7e2ea567ee0ff381a9bd5391a665bd2a
2022-10-19 10:08:24 +11:00
Thiébaud Weksteen
c8b3ae636f Define and use path_alts_t
The context file locations are represented using a 2-dimension array of
paths. Use a struct to simplify the syntax.

Bug: 234313751
Test: m
Change-Id: Iaf62955d1c142f4210215cecbee427e91031516e
2022-10-19 10:07:59 +11:00
Christian Göttsche
3f11c7d19c libsepol/cil: restore error on context rule conflicts
Commit bc26ddc59c ("libsepol/cil: Limit the amount of reporting for
context rule conflicts") reworked the processing of context rule
conflicts to limit the number of written conflicting statements to
increase readability of the printed error message.  It forgot to set the
return value, signaling a context conflict, in the case the logging
level is higher than warning (e.g. in semodule(8), which defaults to
error).

Reported-by: Milos Malik <mmalik@redhat.com> [1]
Fixes: bc26ddc59c ("libsepol/cil: Limit the amount of reporting for context rule conflicts")

[1]: https://lore.kernel.org/selinux/87y1u1rkoo.fsf@redhat.com/

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
2022-10-13 11:24:00 -04:00
Christian Göttsche
fa5b0504d8 libselinux: support objname in compute_create
Support passing an optional object name to compute_create for name
based type transitions.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
2022-10-13 11:23:41 -04: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
Paul Moore
4e562fa1ff docs: add Paul Moore's GPG fingerprint
Signed-off-by: Paul Moore <paul@paul-moore.com>
Acked-by: James Carter <jwcart2@gmail.com>
2022-10-05 08:16:51 -04:00
Matt Sheets
01b5ef48dc libsemanage: Allow user to set SYSCONFDIR
This change will allow a user to set the location of their
sysconfdir, defaulted to /etc, if they are installing into
nonstandard locations.

Signed-off-by: Matt Sheets <masheets@linux.microsoft.com>
Reviewed-by: Daniel Burgener <dburgener@linux.microsoft.com>
2022-10-05 08:15:00 -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
Vit Mojzis
5b5056b1b4 Update translations
Source: https://translate.fedoraproject.org/projects/selinux/

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
2022-10-05 08:13:26 -04:00
Thiébaud Weksteen
12b4861e66 Remove android_common.h
This header file was used for all imports of android.c and
android_platform.c. Move the include directives to the source files
instead, to follow the include-what-you-use rule.

Bug: 234313751
Test: m
Change-Id: I362a722b2a3e7cd204772d8e37fa9b893184e1ce
2022-10-03 16:11:42 +11:00
Jiyong Park
7709493129 Merge "Annotate symbols correctly" am: 5f3411ec65 am: 055c4b7296 am: e8741de875 am: ef8f67b417
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2229044

Change-Id: I05caeaa437d7ce99161f4ec6553ecfe7fd24dcfb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-28 04:23:56 +00:00
Jiyong Park
ef8f67b417 Merge "Annotate symbols correctly" am: 5f3411ec65 am: 055c4b7296 am: e8741de875
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2229044

Change-Id: If1a84be22d7646aba20db0ef1911dc4e1b5d4711
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-28 03:42:48 +00:00
Jiyong Park
e8741de875 Merge "Annotate symbols correctly" am: 5f3411ec65 am: 055c4b7296
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2229044

Change-Id: I6e35759a8419c50c6592a375fc0e8063cf71e943
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-28 02:57:41 +00:00
Jiyong Park
055c4b7296 Merge "Annotate symbols correctly" am: 5f3411ec65
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2229044

Change-Id: I3c095c4d64b2137012b15ac9f97e4015b97918de
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-28 01:59:46 +00:00
Jiyong Park
5f3411ec65 Merge "Annotate symbols correctly" 2022-09-28 01:22:45 +00:00
Thiébaud Weksteen
e387e9b9a9 Reland unit tests for service contexts backend am: f53ffd8708 am: b27ca31bcd am: 92240add98 am: 1eb7b353a2
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2229000

Change-Id: I748ab3ede64a3d972631c05cf93e2be473f7925c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-28 00:16:07 +00:00
Thiébaud Weksteen
1eb7b353a2 Reland unit tests for service contexts backend am: f53ffd8708 am: b27ca31bcd am: 92240add98
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2229000

Change-Id: Ib83b57375a655081b73003823c585e195541a457
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-27 23:49:50 +00:00
Thiébaud Weksteen
92240add98 Reland unit tests for service contexts backend am: f53ffd8708 am: b27ca31bcd
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2229000

Change-Id: I16d33c350062a740e3c3710403f6909465f3c2e3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-27 23:19:18 +00:00
Thiébaud Weksteen
b27ca31bcd Reland unit tests for service contexts backend am: f53ffd8708
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2229000

Change-Id: Ice44c1e54b76d44595414cc9771c4a45ea2e3622
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-27 22:48:52 +00:00
Thiébaud Weksteen
f53ffd8708 Reland unit tests for service contexts backend
A compilation option ANDROID_UNIT_TESTING is introduced to skip the
implicit search for /sys/fs/selinux when libselinux is first
initialized. The label functions of libselinux are used as-is (instead
of a mock or fake).

Expose the context_handle function internally so it may be called within
the unit tests.

Bug: 234313751
Test: atest --host libselinux_test
Change-Id: Ifd7f4857c959a6c7d397682ba9913dc1d1cea591
2022-09-27 14:21:35 +10:00
Jiyong Park
6d1bbcddc6 Annotate symbols correctly
Currently, tagging a symbol with #apex (# systemapi or # llndk) is not
required when the symbol is in a non-NDK library. However, this is
considered dangerous because such a symbol will automatically be
promoted to NDK APIs when the library is promoted to an NDK library.
When that happens, the native API council won't be able to notice the
promotion because promoting a non-NDK library into an NDK library
doesn't require an update of the map.txt file, but Android.bp only.

To prevent that, we should mandate those tags for Mainline APIs
regardless of whether the library the API belongs to is an NDK library
or not.

Upcoming changes in build/soong will enforce this. This change is to
prepare for the enforcement.

Note that this is a build-time only change. There's no behavior change
at runtime.

Bug: 184712170
Test: m
Change-Id: I168fbdcf0a2a9b4e987a5410db941c0b4e4d9c35
2022-09-26 22:15:00 +09:00
Thiébaud Weksteen
0fed5250b6 Reland refactoring of sources in Android.bp am: 5cfe912553 am: 906e656994 am: 029261e331 am: 0d5bfb5030
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2222602

Change-Id: Ie52217e0eb9d423334f9be84d142bd89a0f279f7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-26 02:32:17 +00:00
Thiébaud Weksteen
0d5bfb5030 Reland refactoring of sources in Android.bp am: 5cfe912553 am: 906e656994 am: 029261e331
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2222602

Change-Id: I6c0b067edd28d4c652d9b7c0b88398cef72c038d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-26 02:00:33 +00:00
Thiébaud Weksteen
029261e331 Reland refactoring of sources in Android.bp am: 5cfe912553 am: 906e656994
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2222602

Change-Id: I1f8d20c47cc72802f464eb506345ed2b0d87fbba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-26 01:21:23 +00:00
Thiébaud Weksteen
906e656994 Reland refactoring of sources in Android.bp am: 5cfe912553
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/2222602

Change-Id: Ib557a788f66b14548a82967837689514f467b1b8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-26 00:49:25 +00:00
Thiébaud Weksteen
5cfe912553 Reland refactoring of sources in Android.bp
Move sources files to the default libselinux rule so that other binaries
may reuse the same defaults (i.e., unittests). The majority of sources
can be compiled for the host.

Bug: 234313751
Test: local build for aosp_bramble-userdebug
Test: TH
Change-Id: I0b76bf79ceabd6096ab4ef03f0c8648d0636a310
2022-09-20 13:22:24 +10: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