Commit graph

3987 commits

Author SHA1 Message Date
Thiébaud Weksteen
2ffdadc440 Merge "Remove setools prebuilts" 2021-08-24 14:26:00 +00:00
Thiébaud Weksteen
4f63ec6320 Remove setools prebuilts
It is recommended to use the host tools (package 'setools' under
Debian, Ubuntu or Fedora) instead.

Bug: 178191966
Test: lunch aosp_bramble-userdebug; m selinux_policy
Change-Id: I0de06fbf672d1324107caa8e2756aee7f4dd44c1
2021-08-24 10:17:26 +02:00
Kelvin Zhang
408093ee0a Improve error message for label file validation
This is cherry-picked from upstream
8c21eeeace

Signed-off-by: Kelvin Zhang <zhangxp1998@gmail.com>
Change-Id: I3745d2b45eb42e62f29823edc1b20629bf8ab9d7
2021-08-23 07:59:42 -07:00
Ivan Lozano
ec15ebd030 Remove bindgen test boilerplate code
The boilerplate is no longer necessary for defining rust_test modules
testing generated source.

Bug: 196076408
Test: m libselinux_bindgen_test
Change-Id: Iae623f4146e7580bc58090cebd78a21413ac844d
2021-08-11 13:42:52 -04:00
Joel Galenson
2b5ecc21d3 Add libselinux bindgen bindings test
Test: atest
Change-Id: I91d82f714c0ed0d671dc9b9678e241b679863df7
2021-08-10 12:01:04 -07:00
Colin Cross
0d9fa043f0 Move system_shared_libs into target.android clause
Use target.android.system_shared_libs when it is used to limit the
default shared libraries (as opposed to remove them completely).
This avoids attempting to add a host dependency on libc when
system_shared_libs is modified to apply to all variants.

Bug: 193559105
Test: m checkbuild
Change-Id: I0aac243d441273d2e5c3b2519c99e5d676d6500a
2021-07-22 17:39:47 +00:00
Bram Bonné
52f1cfc2fa Merge "libsepol: trigger new RTM_GETNEIGH{TBL} behavior" 2021-07-08 11:01:41 +00:00
Treehugger Robot
cbc3cca35f Merge "libselinux: android: remove avc_netlink_close" 2021-07-05 12:53:05 +00:00
Jeff Vander Stoep
25bfa08ed0 libselinux: android: remove avc_netlink_close
It's unclear why selinux_android_setcontext() ever called
avc_netlink_close(). It does not appear to be used, and I have
confirmed that no selinux netlink socket is left open when it is
removed.

Test: lsof -p <pidof zygote> | grep netlink
Change-Id: Ie4c424bfe9c2454dc2634888f355182020a4d953
2021-07-05 11:51:23 +02:00
Treehugger Robot
fafcdea284 Merge "seapp_contexts: Remove unused selectors" 2021-07-01 10:44:49 +00:00
Jeff Vander Stoep
2204670e6c seapp_contexts: Remove unused selectors
These have never been used in AOSP. Looking at ~10,000 Android
build images confirms that these are not used elsewhere within
the Android ecosystem.

Bug: 192532348
Test: build (failures here would be at build-time)
Change-Id: I0ff47cb433fe5ffc58282c2d66ccfae1ba473680
2021-07-01 10:56:08 +02:00
Bram Bonné
bc91e46ad0 libsepol: trigger new RTM_GETNEIGH{TBL} behavior
Use one of the policy config bits to tell the kernel to start using
the nlmsg_readneigh on RTM_GETNEIGH and RTM_GETNEIGHTBL messages instead
of the previous behavior of using nlmsg_read.

Bug: 171572148
Test: atest NetworkInterfaceTest
Test: atest bionic-unit-tests-static
Test: atest CtsSelinuxTargetSdkCurrentTestCases
Test: atest CtsSelinuxTargetSdk30TestCases
Test: atest CtsSelinuxTargetSdk29TestCases
Test: atest CtsSelinuxTargetSdk28TestCases
Test: atest CtsSelinuxTargetSdk27TestCases
Test: atest CompatChangesSelinuxTest
Test: atest NetlinkSocketTest
Test: On Cuttlefish, run combinations of:
    - Policy bit set or omitted
    - App having nlmsg_readneigh permission or not
  Verify that only the combination of the policy bit being set + the app
  not having the nlmsg_readneigh permission prevents the app from
  sending RTM_GETNEIGH messages.
Change-Id: I1b0e2398f12e9dd9872c9b916efa76d22f85d56b
2021-06-30 12:17:48 +02:00
Paul Hobbs
a1bd6373d5 Merge "Revert "libsepol: trigger new RTM_GETNEIGH{TBL} behavior"" 2021-06-30 07:44:15 +00:00
Paul Hobbs
f96dedf199 Revert "libsepol: trigger new RTM_GETNEIGH{TBL} behavior"
Revert "untrusted_app_30: add new targetSdk domain"

Revert "Ignore SELinux denials for all untrusted_app domains"

Revert "Update tests to check RTM_GETNEIGH{TBL} restrictions"

Revert submission 1748045-getneigh-enable-restrictions

Reason for revert: Breaks android.net.netlink.NetlinkSocketTest#testBasicWorkingGetNeighborsQuery with permissions error.

Bug: 192406650

Reverted Changes:
Iea29a1b36:Ignore SELinux denials for all untrusted_app domai...
I14b755020:Update tests to check RTM_GETNEIGH{TBL} restrictio...
I32ebb407b:untrusted_app_30: add new targetSdk domain
I8598662b7:libsepol: trigger new RTM_GETNEIGH{TBL} behavior

Change-Id: Idfa638949a7ea47a2c33cb19514b44bfe7c267a2
2021-06-30 07:41:39 +00:00
Bram Bonné
aa1ac1baef Merge "libsepol: trigger new RTM_GETNEIGH{TBL} behavior" 2021-06-29 18:14:33 +00:00
Jeff Vander Stoep
7f5e541096 Fix memory leak in libselinux_selabel_lookup_fuzzer
Fixes: 191375351
Test: TH
Change-Id: Ife8561e83cdc88ab9a84ec6e28a6145208acce36
2021-06-22 10:04:00 +00:00
Bram Bonné
d3f2ab97e2 libsepol: trigger new RTM_GETNEIGH{TBL} behavior
Use one of the policy config bits to tell the kernel to start using
the nlmsg_readneigh on RTM_GETNEIGH and RTM_GETNEIGHTBL messages instead
of the previous behavior of using nlmsg_read.

Bug: 171572148
Test: atest NetworkInterfaceTest
Test: atest bionic-unit-tests-static
Test: atest CtsSelinuxTargetSdkCurrentTestCases
Test: On Cuttlefish, run combinations of:
    - Policy bit set or omitted
    - App having nlmsg_readneigh permission or not
  Verify that only the combination of the policy bit being set + the app
  not having the nlmsg_readneigh permission prevents the app from
  sending RTM_GETNEIGH messages.
Change-Id: I8598662b795feaeaeb8b0a7e676b684022861c37
2021-05-17 15:49:06 +02:00
Treehugger Robot
37501c1cb9 Merge "selinux: remove last slash in CE dirs macro" am: 130aa3e3a5
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1695287

Change-Id: I89beb3535a2a62f21d42f52857b8cc6fe699e45e
2021-05-14 12:03:11 +00:00
Treehugger Robot
130aa3e3a5 Merge "selinux: remove last slash in CE dirs macro" 2021-05-14 11:48:38 +00:00
Jeff Vander Stoep
2b20a67476 OWNERS: add alanstokes, remove nnk am: 3aea2bd6ac
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1704948

Change-Id: Icdeff55ca83ded8cef19610b7df4169c945832ed
2021-05-12 09:55:12 +00:00
Jeff Vander Stoep
3aea2bd6ac OWNERS: add alanstokes, remove nnk
Test: n/a
Change-Id: Ieada3c21d70cb0b8146977f4f8ff4c8d5fd472eb
2021-05-12 08:54:12 +02:00
Yi-Yo Chiang
25bb162886 secilc.c: Don't fail if input file is empty am: ff3c99978a
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1701846

Change-Id: Ia9666ba8ef8ab08dbe19e989be3b45cab0b1de1e
2021-05-11 10:45:40 +00: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
lijiazi
e99ee4904d selinux: remove last slash in CE dirs macro
With this slash, in selinux_android_restorecon_common while loop,
fts_read need to traverse to "/data/system_ce/0" to satisfy the
conditions of skip CE.
If this dir's hash changed in this OTA, new hash will update to
xattr of dir's inode without restorecon for this dir.
When vold installed CE key, and want to restorecon for this dir,
hash match check return true, and dir will be skipped again.
This results in this dir cannot get correct context.

Remove last slash will make skip CE condition satisfy when traverse
"data/system_ce", without update "data/system_ce/0" hash.
Vold can check not match and correct restorecon "data/system_ce/0".

Test: OTA with CE dir contexts changed.

Change-Id: If6aacbe782636acac6cde1517619d8da85143436
Signed-off-by: lijiazi <lijiazi@xiaomi.com>
2021-05-04 08:37:24 +00:00
Colin Cross
16bf7f22b2 Replace llndk_library with llndk clause in cc_library am: 0c40b2bbcf
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1684010

Change-Id: Ic61063d1111e235afc07e8f79c9f582a411c4239
2021-04-27 01:02:37 +00:00
Colin Cross
0c40b2bbcf Replace llndk_library with llndk clause in cc_library
Remove the vestigial llndk_library modules and replace them with
properties in the llndk clause of the implementation cc_library.

Bug: 170784825
Test: m checkbuild
Test: compare out/soong/build.ninja
Change-Id: I1353f630e5a3f4649a13ce8c21bf6be65067716c
2021-04-21 18:55:08 -07:00
Joel Galenson
d1997c58ce Use the new more inclusive command-line options. am: f30e6ff376
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1679289

Change-Id: Ide01d4924cc2c46a66f63137a06489087f5458d9
2021-04-19 19:24:28 +00:00
Joel Galenson
f30e6ff376 Use the new more inclusive command-line options.
Test: Compile
Change-Id: Ie54fb0dafda0a6167e95b32d0a6b4f762162ae1d
2021-04-19 09:46:07 -07:00
Xin Li
d24eb86be4 Mark ab/7061308 as merged in stage.
Bug: 180401296
Merged-In: I31616da0f11876fa29e42bb130587202cd985ad3
Change-Id: I9d0f8c656329912c7b4606cbdb7528bae4895068
2021-02-20 00:24:25 -08:00
Treehugger Robot
855120544e Merge "Symbol files describing APIs across updatable components are reviewed" am: 6275ba5a60
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1574784

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I366817b01fe551b4c55f94f0f9705602fbf6ce5a
2021-02-09 14:39:45 +00:00
Treehugger Robot
6275ba5a60 Merge "Symbol files describing APIs across updatable components are reviewed" 2021-02-09 14:16:26 +00:00
Bob Badour
449efc2880 [LSC] Add LOCAL_LICENSE_KINDS to external/selinux am: 57866d006b
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1576008

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic7e06bd4550b6625b0864617090e278625a9c76b
2021-02-05 21:37:20 +00:00
Bob Badour
57866d006b [LSC] Add LOCAL_LICENSE_KINDS to external/selinux
Added SPDX-license-identifier-Apache-2.0 to:
  libselinux/fuzzers/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0
    SPDX-license-identifier-LGPL SPDX-license-identifier-LGPL-2.1
    SPDX-license-identifier-LGPL-3.0 SPDX-license-identifier-Zlib
    legacy_unencumbered
to:
  Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-GPL-2.0
    legacy_unencumbered
to:
  libselinux/Android.bp

Added SPDX-license-identifier-BSD
to:
  secilc/Android.bp

Added SPDX-license-identifier-BSD SPDX-license-identifier-GPL
    SPDX-license-identifier-LGPL SPDX-license-identifier-LGPL-2.1
    SPDX-license-identifier-LGPL-3.0 SPDX-license-identifier-Zlib
    legacy_unencumbered
to:
  libsepol/Android.bp

Added SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0
    SPDX-license-identifier-LGPL
to:
  checkpolicy/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I3859438c836077d59ed424d04659213c3018f5fe
2021-02-05 01:27:52 -08:00
Jiyong Park
b755a86d07 Symbol files describing APIs across updatable components are reviewed
The build system will soon require that symbol files describing APIs
across updatable components (e.g. across APEXes or across sytem/vendor)
have the ".map.txt" suffix. This will trigger the NDK API review in the
gerrit so that backwards incompatible changes are prevented.

Bug: N/A
Test: m nothing
Change-Id: I1aacf8eea317ac1e7cf0dea3689ff8ef3e315dc0
2021-02-04 21:05:36 +09:00
Alan Stokes
534a91877f Don't restorecon profile root. am: ec6a9c94b2 am: 7bc3b21f51
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1521558

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I31616da0f11876fa29e42bb130587202cd985ad3
2020-12-15 16:16:14 +00:00
Alan Stokes
7bc3b21f51 Don't restorecon profile root. am: ec6a9c94b2
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1521558

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic9c905a23c4956febe8301612101df1798e4684c
2020-12-15 15:56:38 +00:00
Alan Stokes
ec6a9c94b2 Don't restorecon profile root.
Since commit be3db7b7aeb10adf51b34a681d73d5c5bbd59623 vold has been
responsible for labeling the user profile data root directories. So we
should skip those in a recursive restorecon, as we do for
e.g. /data/data, to avoid having the correct label overridden by an
incorrect one. Unlike /data/data the subdirectories should still be
restored.

Bug: 141677108
Bug: 175311045
Test: Manual. Root dir is not re-labeled, subdir is.
Change-Id: I7ffec8ed95d49e8d08fdb90e8f7e164f1d76f422
2020-12-15 09:40:48 +00:00
TreeHugger Robot
60d0b11676 Merge "Mark ab/6881855 as merged" into stage-aosp-master am: 8407444715
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/selinux/+/13112909

Change-Id: I61e856cc82e0c0963f2ef13b1d1852124f611446
2020-11-25 03:20:06 +00:00
TreeHugger Robot
8407444715 Merge "Mark ab/6881855 as merged" into stage-aosp-master 2020-11-25 01:52:49 +00:00
Bram Bonné
2613110ed7 Null-terminate libselinux seinfo in fuzzer. am: f68a36b119 am: 0281142093
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1509588

Change-Id: I14ee61d57ad5a0c8a7e882d3152286bb6f41bf00
2020-11-24 13:25:23 +00:00
Bram Bonné
0281142093 Null-terminate libselinux seinfo in fuzzer. am: f68a36b119
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1509588

Change-Id: Ia0f2a8eb38659558c711bb28acba3c9da1aa753c
2020-11-24 12:29:31 +00:00
Bram Bonné
f68a36b119 Null-terminate libselinux seinfo in fuzzer.
Bug: 172338832
Test: make and run libselinux_android_setcontext_fuzzer on device
Test: Run testcase 5652118323200000
Change-Id: Ib619679e89f10a5f58cb8ac17ba2b67d35b1b606
2020-11-24 10:29:18 +01:00
Xin Li
71750c7f5a Mark ab/6881855 as merged
Bug: 172690556
Change-Id: Ie758ffab3bc6bfea52b8a1a1d06ebbbd28ff136b
2020-11-23 11:30:38 -08:00
Bram Bonné
27a10d501b Merge "Null-terminate libselinux context name in fuzzer." am: 0e8eccd069 am: d157a3e180 am: c1272f7cd2
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1492196

Change-Id: I12958b984364a248df33681c526fd78a8008cd2a
2020-11-16 15:08:38 +00:00
Bram Bonné
c1272f7cd2 Merge "Null-terminate libselinux context name in fuzzer." am: 0e8eccd069 am: d157a3e180
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1492196

Change-Id: I39edf13b5db6b85f58c5d7f34d534b7710c68073
2020-11-16 14:52:56 +00:00
Bram Bonné
d157a3e180 Merge "Null-terminate libselinux context name in fuzzer." am: 0e8eccd069
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1492196

Change-Id: I82565ed4ee46f06b39f9eb66798fdd8c2f820cf2
2020-11-16 14:40:09 +00:00
Bram Bonné
0e8eccd069 Merge "Null-terminate libselinux context name in fuzzer." 2020-11-16 14:21:50 +00:00
Bram Bonné
c7c88d9701 Null-terminate libselinux context name in fuzzer.
Test: make and run libselinux_context_fuzzer on host
Fix: 171997120
Fix: 172338832
Change-Id: I23ed5b8c695a8dc2dd18f1a08d18590f4d8dd1e3
2020-11-13 10:08:57 +01:00
Treehugger Robot
2dfdb05b70 Merge "Add more fuzzers" am: 14de5345d4 am: 2fc3aa4ecf am: 6e05073c56
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1493596

Change-Id: Id6cdda3b30c448604d064cd2a65b23b06c5901f5
2020-11-10 16:08:50 +00:00
Treehugger Robot
6e05073c56 Merge "Add more fuzzers" am: 14de5345d4 am: 2fc3aa4ecf
Original change: https://android-review.googlesource.com/c/platform/external/selinux/+/1493596

Change-Id: I5225967351b046c8499784e67c2b8e384f644072
2020-11-10 15:42:11 +00:00