* getpolicyload returns 0, 2, 3, 4, ...
@ 2023-11-21 20:27 Petr Lautrbach
2023-11-22 18:32 ` William Roberts
0 siblings, 1 reply; 3+ messages in thread
From: Petr Lautrbach @ 2023-11-21 20:27 UTC (permalink / raw)
To: selinux
Hi,
Milos Malik noticed [0] that getpolicyload "skippes" 1 after first
`semodule -R`:
[root@fedora ~]# getpolicyload
0
[root@fedora ~]# semodule -R
[root@fedora ~]# getpolicyload
2
[root@fedora ~]# semodule -R
[root@fedora ~]# getpolicyload
3
[root@fedora ~]# semodule -R
[root@fedora ~]# getpolicyload
4
why it's like that?
It looks like increased sequence is not propagated after first
policyload and it's propagated to the status after the second
policyload.
[0] https://src.fedoraproject.org/tests/selinux/pull-request/451#comment-168398
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: getpolicyload returns 0, 2, 3, 4, ...
2023-11-21 20:27 getpolicyload returns 0, 2, 3, 4, Petr Lautrbach
@ 2023-11-22 18:32 ` William Roberts
2023-11-22 18:53 ` Christian Göttsche
0 siblings, 1 reply; 3+ messages in thread
From: William Roberts @ 2023-11-22 18:32 UTC (permalink / raw)
To: Petr Lautrbach; +Cc: selinux
On Tue, Nov 21, 2023 at 2:27 PM Petr Lautrbach <lautrbach@redhat.com> wrote:
>
> Hi,
>
> Milos Malik noticed [0] that getpolicyload "skippes" 1 after first
> `semodule -R`:
>
>
> [root@fedora ~]# getpolicyload
> 0
> [root@fedora ~]# semodule -R
> [root@fedora ~]# getpolicyload
> 2
> [root@fedora ~]# semodule -R
> [root@fedora ~]# getpolicyload
> 3
> [root@fedora ~]# semodule -R
> [root@fedora ~]# getpolicyload
> 4
>
> why it's like that?
>
> It looks like increased sequence is not propagated after first
> policyload and it's propagated to the status after the second
> policyload.
>
>
> [0] https://src.fedoraproject.org/tests/selinux/pull-request/451#comment-168398
>
it may not be one, but never zero, so its ok to skip 1 per this comment:
- https://elixir.bootlin.com/linux/latest/source/security/selinux/status.c#L57
On the creation of the page, the policyload is set to 0, on updates,
the seqno is used:
- https://elixir.bootlin.com/linux/latest/source/security/selinux/status.c#L104
Definitely odd behavior, but seems expected. I just don't know why
seqno isn't used on page creation.
Bill
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: getpolicyload returns 0, 2, 3, 4, ...
2023-11-22 18:32 ` William Roberts
@ 2023-11-22 18:53 ` Christian Göttsche
0 siblings, 0 replies; 3+ messages in thread
From: Christian Göttsche @ 2023-11-22 18:53 UTC (permalink / raw)
To: William Roberts; +Cc: Petr Lautrbach, selinux
On Wed, 22 Nov 2023 at 19:33, William Roberts <bill.c.roberts@gmail.com> wrote:
>
> On Tue, Nov 21, 2023 at 2:27 PM Petr Lautrbach <lautrbach@redhat.com> wrote:
> >
> > Hi,
> >
> > Milos Malik noticed [0] that getpolicyload "skippes" 1 after first
> > `semodule -R`:
> >
> >
> > [root@fedora ~]# getpolicyload
> > 0
> > [root@fedora ~]# semodule -R
> > [root@fedora ~]# getpolicyload
> > 2
> > [root@fedora ~]# semodule -R
> > [root@fedora ~]# getpolicyload
> > 3
> > [root@fedora ~]# semodule -R
> > [root@fedora ~]# getpolicyload
> > 4
> >
> > why it's like that?
> >
> > It looks like increased sequence is not propagated after first
> > policyload and it's propagated to the status after the second
> > policyload.
> >
> >
> > [0] https://src.fedoraproject.org/tests/selinux/pull-request/451#comment-168398
> >
>
> it may not be one, but never zero, so its ok to skip 1 per this comment:
> - https://elixir.bootlin.com/linux/latest/source/security/selinux/status.c#L57
>
> On the creation of the page, the policyload is set to 0, on updates,
> the seqno is used:
> - https://elixir.bootlin.com/linux/latest/source/security/selinux/status.c#L104
>
> Definitely odd behavior, but seems expected. I just don't know why
> seqno isn't used on page creation.
>
> Bill
The initial policy load will call selinux_status_update_policyload(1),
trying to set the sequence number to 1, but probably the status page
is not yet allocated.
It is only allocated on first access of /selinux/status (see
selinuxfs.c:sel_open_handle_status()).
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-22 18:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-21 20:27 getpolicyload returns 0, 2, 3, 4, Petr Lautrbach
2023-11-22 18:32 ` William Roberts
2023-11-22 18:53 ` Christian Göttsche
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.