Christian Göttsche <cgzones@xxxxxxxxxxxxxx> writes: > 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@xxxxxxxxxxxxxx> Acked-by: Petr Lautrbach <plautrba@xxxxxxxxxx> > --- > libselinux/src/sestatus.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/libselinux/src/sestatus.c b/libselinux/src/sestatus.c > index 12b015e0..531a522c 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.31.1