selinux/checkpolicy
James Carter 750cc1136d
checkpolicy: Do not automatically upgrade when using "-b" flag
When reading a binary policy, do not automatically change the version
to the max policy version supported by libsepol or, if specified, the
value given using the "-c" flag.

If the binary policy version is less than or equal to version 23
(POLICYDB_VERSION_PERMISSIVE) than do not automatically upgrade the
policy and if a policy version is specified by the "-c" flag, only set
the binary policy to the specified version if it is lower than the
current version.

If the binary policy version is greater than version 23 than it should
be set to the maximum version supported by libsepol or, if specified,
the value given by the "-c" flag.

The reason for this change is that policy versions 20
(POLICYDB_VERSION_AVTAB) to 23 have a more primitive support for type
attributes where the datums are not written out, but they exist in the
type_attr_map. This means that when the binary policy is read by
libsepol, there will be gaps in the type_val_to_struct and
p_type_val_to_name arrays and policy rules can refer to those gaps.
Certain libsepol functions like sepol_kernel_policydb_to_conf() and
sepol_kernel_policydb_to_cil() do not support this behavior and need
to be able to identify these policies. Policies before version 20 do not
support attributes at all and can be handled by all libsepol functions.

Signed-off-by: James Carter <jwcart2@gmail.com>
2021-03-15 21:52:03 +01:00
..
ru checkpolicy: Minor tweaks to the names of the contributors to the manpages 2020-06-04 16:06:25 -04:00
test libsepol,checkpolicy: optimize storage of filename transitions 2020-08-03 08:52:12 -04:00
.gitignore Repo: update .gitignore 2011-08-02 13:31:51 -04:00
COPYING
Makefile Allow installing translated man pages 2019-01-28 12:03:57 +01:00
VERSION Update VERSIONs to 3.2 for release. 2021-03-04 16:42:59 +01:00
checkmodule.8 checkpolicy: Minor tweaks to the names of the contributors to the manpages 2020-06-04 16:06:25 -04:00
checkmodule.c libsepol,checkpolicy: remove use of hardcoded security class values 2020-03-12 07:50:55 +01:00
checkpolicy.8 checkpolicy: Minor tweaks to the names of the contributors to the manpages 2020-06-04 16:06:25 -04:00
checkpolicy.c checkpolicy: Do not automatically upgrade when using "-b" flag 2021-03-15 21:52:03 +01:00
checkpolicy.h checkpolicy: remove unused te_assertions 2020-01-27 10:51:21 -05:00
module_compiler.c checkpolicy: destroy the class datum if it fails to initialize 2018-05-30 22:00:13 +02:00
module_compiler.h checkpolicy: Separate tunable from boolean during compile. 2011-09-16 11:54:01 -04:00
parse_util.c Remove redundant if-clause 2019-06-19 09:03:12 -07:00
parse_util.h
policy_define.c libsepol/checkpolicy: Set user roles using role value instead of dominance 2021-03-15 21:50:58 +01:00
policy_define.h checkpolicy: Add support for ibendportcon labels 2017-05-23 16:20:55 -04:00
policy_parse.y libsepol,checkpolicy: remove use of hardcoded security class values 2020-03-12 07:50:55 +01:00
policy_scan.l checkpolicy: add missing forward declaration 2020-03-25 09:54:21 -05:00
queue.c checkpolicy,libselinux,libsepol,policycoreutils: Update my email address 2017-08-17 14:17:12 -04:00
queue.h checkpolicy,libselinux,libsepol,policycoreutils: Update my email address 2017-08-17 14:17:12 -04:00