Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Android/M and official v30 sepolicy format
Some Android M devices use a slightly different format for the sepolicy file. Compatibility for this is not present in SELinuxProject/selinux master. Google does provide a patch for the kernel itself to be able to handle both formats - https://android-review.googlesource.com/#/c/179568/ - but not for libsepol. This patch is a port of the kernel patch to libsepol. Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
- Loading branch information
1 parent
7179fd8
commit dc80339
Showing
4 changed files
with
69 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <stdio.h> | ||
|
||
#include "android_m_compat.h" | ||
|
||
unsigned int avtab_android_m_compat; | ||
|
||
void avtab_android_m_compat_set(void) | ||
{ | ||
if (!avtab_android_m_compat) { | ||
fprintf(stderr, "(Android M policy compatibility mode)\n"); | ||
avtab_android_m_compat = 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* extended permissions compatibility. Make ToT Android kernels compatible | ||
* with Android M releases | ||
*/ | ||
#define AVTAB_OPTYPE_ALLOWED 0x1000 | ||
#define AVTAB_OPTYPE_AUDITALLOW 0x2000 | ||
#define AVTAB_OPTYPE_DONTAUDIT 0x4000 | ||
#define AVTAB_OPTYPE (AVTAB_OPTYPE_ALLOWED | \ | ||
AVTAB_OPTYPE_AUDITALLOW | \ | ||
AVTAB_OPTYPE_DONTAUDIT) | ||
#define AVTAB_XPERMS_OPTYPE 4 | ||
|
||
#define avtab_xperms_to_optype(x) (x << AVTAB_XPERMS_OPTYPE) | ||
#define avtab_optype_to_xperms(x) (x >> AVTAB_XPERMS_OPTYPE) | ||
|
||
extern unsigned int avtab_android_m_compat; | ||
|
||
void avtab_android_m_compat_set(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters