All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] Revert "libselinux/utils: drop reachable assert in sefcontext_compile"
@ 2024-12-11 16:13 James Carter
  2024-12-11 16:13 ` [PATCH 2/9] Revert "libselinux/utils: use correct error handling" James Carter
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: James Carter @ 2024-12-11 16:13 UTC (permalink / raw)
  To: selinux; +Cc: cgzones, takayas, James Carter

This reverts commit f50abe2a3aad0716a0711cfcc07f934f4a9d2b02.

Needed to revert commit 92306daf5219e73f6e8bc9fc7699399457999bcd
"libselinux: rework selabel_file(5) database", which broke Android
file_context matching.

Signed-off-by: James Carter <jwcart2@gmail.com>
---
 libselinux/utils/sefcontext_compile.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libselinux/utils/sefcontext_compile.c b/libselinux/utils/sefcontext_compile.c
index b4445a1f..5d7ab301 100644
--- a/libselinux/utils/sefcontext_compile.c
+++ b/libselinux/utils/sefcontext_compile.c
@@ -188,9 +188,6 @@ static int write_sidtab(FILE *bin_file, const struct sidtab *stab)
 	if (len != 1)
 		return -1;
 
-	if (stab->nel == 0)
-		return 0;
-
 	/* sort entries by id */
 	sids = calloc(stab->nel, sizeof(*sids));
 	if (!sids)
@@ -206,6 +203,8 @@ static int write_sidtab(FILE *bin_file, const struct sidtab *stab)
 	}
 	assert(index == stab->nel);
 	qsort(sids, stab->nel, sizeof(struct security_id), security_id_compare);
+	assert(sids[0].id == 1);
+	assert(sids[stab->nel - 1].id == stab->nel);
 
 	/* write raw contexts sorted by id */
 	for (uint32_t i = 0; i < stab->nel; i++) {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-12-11 16:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-11 16:13 [PATCH 1/9] Revert "libselinux/utils: drop reachable assert in sefcontext_compile" James Carter
2024-12-11 16:13 ` [PATCH 2/9] Revert "libselinux/utils: use correct error handling" James Carter
2024-12-11 16:14 ` [PATCH 3/9] Revert "libselinux: simplify string formatting" James Carter
2024-12-11 16:14 ` [PATCH 4/9] Revert "libselinux: use vector instead of linked list for substitutions" James Carter
2024-12-11 16:14 ` [PATCH 5/9] Revert "libselinux: avoid memory allocation in common file label lookup" James Carter
2024-12-11 16:14 ` [PATCH 6/9] Revert "libselinux: move functions out of header file" James Carter
2024-12-11 16:14 ` [PATCH 7/9] Revert "libselinux: support parallel selabel_lookup(3)" James Carter
2024-12-11 16:14 ` [PATCH 8/9] Revert "libselinux: add selabel_file(5) fuzzer" James Carter
2024-12-11 16:14 ` [PATCH 9/9] Revert "libselinux: rework selabel_file(5) database" James Carter
2024-12-11 16:25 ` [PATCH 1/9] Revert "libselinux/utils: drop reachable assert in sefcontext_compile" James Carter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.