Skip to contentSkip to conversation

Regression in 92306daf5219 ("libselinux: rework selabel_file(5) database")

DISCUSSION Petr Lautrbach 1 participant 2 messages Dec 3, 2024 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

with the current 3.8-rc1 release:

[root@default-0 selinux]# semanage fcontext -a -t user_home_dir_t /tmp/test_dir [root@default-0 selinux]# semanage fcontext -l -C
SELinux fcontext type Context

/tmp/test_dir all files system_u:object_r:user_home_dir_t:s0
[root@default-0 selinux]# semanage fcontext -D
sefcontext_compile: sefcontext_compile.c:206: write_sidtab: Assertion `sids[0].id == 1' failed. libsemanage.semanage_exec_prog: Child process /usr/sbin/sefcontext_compile did not exit cleanly. libsemanage.sefcontext_compile: sefcontext_compile returned error code -1. Compiling /var/lib/selinux/final/targeted/contexts/files/file_contexts.local
OSError: Error

According to git bisect the first bad commit is:

commit 92306daf5219e73f6e8bc9fc7699399457999bcd (HEAD)

Author: Christian Göttsche <[email protected]>
Date:   Tue Nov 5 19:33:16 2024 +0100

libselinux: rework selabel_file(5) database

[root@default-0 selinux]# git checkout 92306daf5219e73f6e8bc9fc7699399457999bcd~ Previous HEAD position was 92306daf libselinux: rework selabel_file(5) database HEAD is now at 90b1c237 libselinux: sidtab updates

[root@default-0 selinux]# make clean; make distclean; make LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel [root@default-0 selinux]# semanage fcontext -a -t user_home_dir_t /tmp/test_dir
[root@default-0 selinux]# semanage fcontext -l -C
SELinux fcontext type Context

/tmp/test_dir all files system_u:object_r:user_home_dir_t:s0
[root@default-0 selinux]# semanage fcontext -D
[root@default-0 selinux]#

PTAL

Petr

#1 lore raw
Quoted 8 lines · Petr Lautrbach

Hi,

with the current 3.8-rc1 release:

[root@default-0 selinux]# semanage fcontext -a -t user_home_dir_t /tmp/test_dir [root@default-0 selinux]# semanage fcontext -l -C
SELinux fcontext type Context

Quoted 6 lines

/tmp/test_dir all files system_u:object_r:user_home_dir_t:s0
[root@default-0 selinux]# semanage fcontext -D
sefcontext_compile: sefcontext_compile.c:206: write_sidtab: Assertion `sids[0].id == 1' failed. libsemanage.semanage_exec_prog: Child process /usr/sbin/sefcontext_compile did not exit cleanly. libsemanage.sefcontext_compile: sefcontext_compile returned error code -1. Compiling /var/lib/selinux/final/targeted/contexts/files/file_contexts.local
OSError: Error

[root@default-0 ~]# touch file_contexts

[root@default-0 ~]# sefcontext_compile -r file_contexts
sefcontext_compile: sefcontext_compile.c:206: write_sidtab: Assertion `sids[0].id == 1' failed. Aborted (core dumped)

[root@default-0 ~]# cat > file_contexts <<EOF
# This file is auto-generated by libsemanage
# Do not edit directly.

/tmp/test_dir system_u:object_r:user_home_dir_t:s0
EOF

[root@default-0 ~]# sefcontext_compile -r file_contexts [root@default-0 ~]#

Quoted 27 lines

According to git bisect the first bad commit is:

commit 92306daf5219e73f6e8bc9fc7699399457999bcd (HEAD)

Author: Christian Göttsche <[email protected]>
Date:   Tue Nov 5 19:33:16 2024 +0100

libselinux: rework selabel_file(5) database

[root@default-0 selinux]# git checkout 92306daf5219e73f6e8bc9fc7699399457999bcd~ Previous HEAD position was 92306daf libselinux: rework selabel_file(5) database HEAD is now at 90b1c237 libselinux: sidtab updates

[root@default-0 selinux]# make clean; make distclean; make LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel [root@default-0 selinux]# semanage fcontext -a -t user_home_dir_t /tmp/test_dir
[root@default-0 selinux]# semanage fcontext -l -C
SELinux fcontext type Context

/tmp/test_dir all files system_u:object_r:user_home_dir_t:s0
[root@default-0 selinux]# semanage fcontext -D
[root@default-0 selinux]#

PTAL

Petr