selinux: declare data arrays const

The arrays for the policy capability names, the initial sid identifiers
and the class and permission names are not changed at runtime.  Declare
them const to avoid accidental modification.

Do not override the classmap and the initial sid list in the build time
script genheaders.

Check flose(3) is successful in genheaders.c, otherwise the written data
might be corrupted or incomplete.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
[PM: manual merge due to fuzz, minor style tweaks]
Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
Christian Göttsche
2022-05-02 16:43:38 +02:00
committed by Paul Moore
parent a9029d9704
commit ded34574d4
11 changed files with 71 additions and 58 deletions

View File

@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
static const char *initial_sid_to_string[] = {
static const char *const initial_sid_to_string[] = {
NULL,
"kernel",
"security",