Rebase on upstream commit 32611aea6543 See $ cd SELinuxProject/selinux $ git log --pretty=oneline libsepol-3.2..32611aea6543 -- libsepol
59 lines
2.0 KiB
Diff
59 lines
2.0 KiB
Diff
From 644c5bbbc4c71f6636c939cb7748dd2dfa50e638 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
|
|
Date: Tue, 8 Jun 2021 21:39:02 +0200
|
|
Subject: [PATCH] libsepol: quote paths in CIL conversion
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
When generating CIL policy from kernel or module policy quote paths,
|
|
which are allowed to contain spaces, in the statements `genfscon` and
|
|
`devicetreecon`.
|
|
|
|
Reported by LuK1337 while building policy for Android via IRC.
|
|
|
|
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
|
|
---
|
|
libsepol/src/kernel_to_cil.c | 4 ++--
|
|
libsepol/src/module_to_cil.c | 2 +-
|
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/libsepol/src/kernel_to_cil.c b/libsepol/src/kernel_to_cil.c
|
|
index 989aacde8a12..30a27bf527d5 100644
|
|
--- a/libsepol/src/kernel_to_cil.c
|
|
+++ b/libsepol/src/kernel_to_cil.c
|
|
@@ -2654,7 +2654,7 @@ static int write_genfscon_rules_to_cil(FILE *out, struct policydb *pdb)
|
|
goto exit;
|
|
}
|
|
|
|
- rc = strs_create_and_add(strs, "(genfscon %s %s %s)", 3,
|
|
+ rc = strs_create_and_add(strs, "(genfscon %s \"%s\" %s)", 3,
|
|
fstype, name, ctx);
|
|
free(ctx);
|
|
if (rc != 0) {
|
|
@@ -3115,7 +3115,7 @@ static int write_xen_devicetree_rules_to_cil(FILE *out, struct policydb *pdb)
|
|
goto exit;
|
|
}
|
|
|
|
- sepol_printf(out, "(devicetreecon %s %s)\n", name, ctx);
|
|
+ sepol_printf(out, "(devicetreecon \"%s\" %s)\n", name, ctx);
|
|
|
|
free(ctx);
|
|
}
|
|
diff --git a/libsepol/src/module_to_cil.c b/libsepol/src/module_to_cil.c
|
|
index 496693f4616e..19c7c65c6382 100644
|
|
--- a/libsepol/src/module_to_cil.c
|
|
+++ b/libsepol/src/module_to_cil.c
|
|
@@ -2963,7 +2963,7 @@ static int genfscon_to_cil(struct policydb *pdb)
|
|
|
|
for (genfs = pdb->genfs; genfs != NULL; genfs = genfs->next) {
|
|
for (ocon = genfs->head; ocon != NULL; ocon = ocon->next) {
|
|
- cil_printf("(genfscon %s %s ", genfs->fstype, ocon->u.name);
|
|
+ cil_printf("(genfscon %s \"%s\" ", genfs->fstype, ocon->u.name);
|
|
context_to_cil(pdb, &ocon->context[0]);
|
|
cil_printf(")\n");
|
|
}
|
|
--
|
|
2.32.0
|
|
|