041eacc63c
Rebase on upstream commit 32611aea6543 See $ cd SELinuxProject/selinux $ git log --pretty=oneline libselinux-3.2..32611aea6543 -- libselinux Related: rhbz#1938789
40 lines
1.2 KiB
Diff
40 lines
1.2 KiB
Diff
From c5a699046f4a08a554d2da9121924fc80bf27cba Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
|
|
Date: Mon, 10 May 2021 12:56:47 +0200
|
|
Subject: [PATCH] libselinux: make selinux_status_open(3) reentrant
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Do not mmap the status page again if `selinux_status_open(3)` has already
|
|
been called with success.
|
|
|
|
`selinux_status_open(3)` might be called unintentionally multiple times,
|
|
e.g. once to manually be able to call `selinux_status_getenforce(3)` and
|
|
once indirectly through `selinux_check_access(3)`
|
|
(since libselinux 3.2).
|
|
|
|
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
|
|
---
|
|
libselinux/src/sestatus.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/libselinux/src/sestatus.c b/libselinux/src/sestatus.c
|
|
index 12b015e088ea..531a522c0f48 100644
|
|
--- a/libselinux/src/sestatus.c
|
|
+++ b/libselinux/src/sestatus.c
|
|
@@ -282,6 +282,10 @@ int selinux_status_open(int fallback)
|
|
long pagesize;
|
|
uint32_t seqno;
|
|
|
|
+ if (selinux_status != NULL) {
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
if (!selinux_mnt) {
|
|
errno = ENOENT;
|
|
return -1;
|
|
--
|
|
2.32.0
|
|
|