All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <stephen.smalley.work@gmail.com>
To: Mike Palmiotto <mike.palmiotto@crunchydata.com>
Cc: SElinux list <selinux@vger.kernel.org>
Subject: Re: [PATCH] libselinux: Use sestatus if open
Date: Thu, 16 Jul 2020 11:12:18 -0400	[thread overview]
Message-ID: <CAEjxPJ56fWB-_k749aXOESJaDEJqQnQOznGZJkYm_=2LFJ6BEQ@mail.gmail.com> (raw)
In-Reply-To: <CAMN686Ep659JPUhvkfSZ2eCxSwz8EkL6sdZ5kTT0td0buYi=Qw@mail.gmail.com>

On Thu, Jul 16, 2020 at 9:36 AM Mike Palmiotto
<mike.palmiotto@crunchydata.com> wrote:
>
> On Thu, Jul 16, 2020 at 8:40 AM Stephen Smalley
> <stephen.smalley.work@gmail.com> wrote:
> >
> > On Wed, Jul 15, 2020 at 6:45 PM Mike Palmiotto
> > <mike.palmiotto@crunchydata.com> wrote:
> > > Interestingly, the test program is working fine:
> > > https://github.com/mpalmi/selinux/tree/sestatus
> > > https://github.com/mpalmi/sestatus-test
> > >
> > > On a test run, I'm seeing both the status page and netlink socket
> > > notifications for load_polcy (twice for each case):
> > >
> > > ```
> > >  ./test
> > > opened avc successfully
> > > got netlink socket: 4
> > >
> > > watching netlink socket for events
> > > avc:  received policyload notice (seqno=3)
> > > policy reload notice received
> > > avc:  received policyload notice (seqno=4)
> > > policy reload notice received
> > > ^C
> > > watching sestatus page for events
> > > avc:  received policyload notice (seqno=5)
> > > policy reload notice received
> > > avc:  received policyload notice (seqno=6)
> > > policy reload notice received
> > > ^Cclosing netlink socket: 4
> > > destroying avc
> > > goodbye
> > > ```
> > >
> > > Still seeing the MAC_POLICY_LOAD audit message, but none of the usual
> > > USER_AVC policyload notices.
> >
> > I only see one notification per load_policy invocation.
>
> I meant I ran load_policy twice for netlink and then twice for
> sestatus. You're correct, there is only one notification per
> invocation.
>
> > What versions of kernel and dbus are you using? Are you using dbus-daemon or
> > dbus-broker?  How are you testing dbus with this change - just doing a
> > make install relabel of libselinux and restarting dbus-daemon or
> > dbus-broker, then running load_policy and checking for USER_AVC
> > messages?  Is this on CentOS 7/8?
>
> Here's my setup:
>
> [vagrant/staff_r/SystemLow@mls:~]$ uname -r
> 4.18.0-193.el8.x86_64
> [vagrant/staff_r/SystemLow@mls:~]$ cat /etc/redhat-release
> Red Hat Enterprise Linux release 8.2 (Ootpa)
> [vagrant/staff_r/SystemLow@mls:~]$ dbus-daemon --version | head -1
> D-Bus Message Bus Daemon 1.12.8
> [vagrant/staff_r/SystemLow@mls:~]$ systemctl status --no-pager dbus --full
> ● dbus.service - D-Bus System Message Bus
>    Loaded: loaded (/usr/lib/systemd/system/dbus.service; static;
> vendor preset: disabled)
>    Active: active (running) since Thu 2020-07-16 01:19:31 UTC; 47min ago
>      Docs: man:dbus-daemon(1)
>  Main PID: 865 (dbus-daemon)
>     Tasks: 1 (limit: 11480)
>    Memory: 3.6M
>    CGroup: /system.slice/dbus.service
>            └─865 /usr/bin/dbus-daemon --system --address=systemd:
> --nofork --nopidfile --systemd-activation --syslog-only
>
> This is my test thread:
>
> 1) `make clean distclean`
> 2) `sudo make DEBUG=1 LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install
> install-pywrap relabel -s`
> 3) `sudo restorecon -RF /` (mcstrans apparently doesn't have the
> relabel target -- I should submit a patch for that)
> 5) reboot
> 6) load_policy/setenforce/setsebool and look for USER_AVC notices in audit.log
>
> Please let me know if there's any other information you need. I'm
> still trying to track this down on my end. I will probably build dbus
> with debugging and take a look at what's going on.

That version of dbus did not call avc_netlink_acquire_fd().  It only
calls avc_init() with a thread callback,
with the expectation that avc_init() will create the thread (as it did
prior to your patch).  So you can't move that part.
Not sure what happens if you leave it there.

If you can't make it work cleanly with legacy object managers, then I
guess we can go with the opt-in route.

  reply	other threads:[~2020-07-16 15:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 20:29 [PATCH] libselinux: Use sestatus if open Mike Palmiotto
2020-07-14 20:29 ` Mike Palmiotto
2020-07-14 21:03 ` Stephen Smalley
2020-07-14 21:20   ` Mike Palmiotto
2020-07-14 21:35     ` Stephen Smalley
2020-07-14 22:42       ` Mike Palmiotto
2020-07-15 16:04         ` Mike Palmiotto
2020-07-15 16:49           ` Stephen Smalley
2020-07-15 17:10             ` Mike Palmiotto
2020-07-15 18:52               ` Mike Palmiotto
2020-07-15 19:49                 ` Stephen Smalley
2020-07-15 22:45                   ` Mike Palmiotto
2020-07-16 12:39                     ` Stephen Smalley
2020-07-16 13:36                       ` Mike Palmiotto
2020-07-16 15:12                         ` Stephen Smalley [this message]
2020-07-16 15:27                           ` Stephen Smalley
2020-07-16 15:44                             ` Mike Palmiotto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEjxPJ56fWB-_k749aXOESJaDEJqQnQOznGZJkYm_=2LFJ6BEQ@mail.gmail.com' \
    --to=stephen.smalley.work@gmail.com \
    --cc=mike.palmiotto@crunchydata.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.