-
Bug
-
Resolution: Done-Errata
-
Normal
-
rhel-10.0
-
None
-
libsemanage-3.8-0.rc3.1.el10
-
No
-
Important
-
1
-
rhel-security-selinux
-
ssg_security
-
22
-
2
-
QE ack
-
False
-
False
-
-
Yes
-
SELINUX 241127 - 241218
-
-
Pass
-
Needed
-
Automated
-
Release Note Not Required
-
-
All
-
None
What were you trying to do that didn't work?
semanage commands with a / located on NFSv4
What is the impact of this issue to you?
semanage commands unusable
Please provide the package NVR for which the bug is seen:
policycoreutils-3.7-3.el10.noarch
How reproducible is this bug?:
always
Steps to reproduce
- Use a NVSv4 mount as root or just /var/lib/selinux/targeted/
- 192.168.122.155:/rear/targeted on /var/lib/selinux/targeted type nfs4 (rw,relatime,seclabel,vers=4.2,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.65,loc
al_lock=none,addr=192.168.122.155)
- # semanage fcontext -a -e /home /tmp/testdir
libsemanage.semanage_get_lock: Error obtaining direct transaction lock at /var/lib/selinux/targeted/semanage.trans.LOCK. (Bad file descriptor).
OSError: Bad file descriptor
Expected results
semanage command is usable without errors
Actual results
semanage command fails with a lock error
This is due to this part:
libsemanage/src/semanage_store.c int semanage_install_sandbox(semanage_handle_t * sh) ... if ((fd = open(lock_file, O_RDONLY)) == -1) { if ((fd = open(lock_file, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) == -1) { ERR(sh, "Could not open direct %s at %s.", lock_name, lock_file); return -1; } }
Then flock fails:
if (flock(fd, LOCK_EX | LOCK_NB) == 0) {
The open must be done with 0_RDWR on a NFSv4 filesystem.
- clones
-
RHEL-60503 semanage fails to get lock if / is on NFS (or /var/lib/selinux/)
-
- Closed
-
- links to
-
RHBA-2024:141151 libsemanage bug fix and enhancement update