mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-09 15:10:24 +00:00
libselinux: initialize last_policyload in selinux_status_open()
If not initialized to the current policyload count, an enforcing change will trigger policyload-callbacks in selinux_status_updated(). Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
This commit is contained in:
parent
ef902db9c8
commit
a63f93d83b
@ -278,9 +278,10 @@ static int fallback_cb_policyload(int policyload)
|
||||
*/
|
||||
int selinux_status_open(int fallback)
|
||||
{
|
||||
int fd;
|
||||
char path[PATH_MAX];
|
||||
long pagesize;
|
||||
int fd;
|
||||
char path[PATH_MAX];
|
||||
long pagesize;
|
||||
uint32_t seqno;
|
||||
|
||||
if (!selinux_mnt) {
|
||||
errno = ENOENT;
|
||||
@ -304,6 +305,14 @@ int selinux_status_open(int fallback)
|
||||
selinux_status_fd = fd;
|
||||
last_seqno = (uint32_t)(-1);
|
||||
|
||||
/* sequence must not be changed during references */
|
||||
do {
|
||||
seqno = read_sequence(selinux_status);
|
||||
|
||||
last_policyload = selinux_status->policyload;
|
||||
|
||||
} while (seqno != read_sequence(selinux_status));
|
||||
|
||||
/* No need to use avc threads if the kernel status page is available */
|
||||
avc_using_threads = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user