lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 11 Oct 2021 20:20:51 +0200
From:   Ondrej Mosnacek <omosnace@...hat.com>
To:     Paul Moore <paul@...l-moore.com>
Cc:     Florian Westphal <fw@...len.de>,
        SElinux list <selinux@...r.kernel.org>,
        Stephen Smalley <stephen.smalley.work@...il.com>,
        Eric Paris <eparis@...isplace.org>,
        Linux kernel mailing list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 selinux] selinux: remove unneeded ipv6 hook wrappers

On Mon, Oct 11, 2021 at 7:10 PM Paul Moore <paul@...l-moore.com> wrote:
> On Mon, Oct 11, 2021 at 10:25 AM Florian Westphal <fw@...len.de> wrote:
> >
> > Netfilter places the protocol number the hook function is getting called
> > from in state->pf, so we can use that instead of an extra wrapper.
> >
> > Signed-off-by: Florian Westphal <fw@...len.de>
> > ---
> >  v2: add back '#endif /* CONFIG_NETFILTER */' erronously axed in v1.
> >  Applies to 'next' branch of
> >  https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git/
> >
> >  security/selinux/hooks.c | 52 ++++++++++------------------------------
> >  1 file changed, 12 insertions(+), 40 deletions(-)
>
> ...
>
> > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> > index e7ebd45ca345..831b857d5dd7 100644
> > --- a/security/selinux/hooks.c
> > +++ b/security/selinux/hooks.c
> > @@ -7470,38 +7442,38 @@ DEFINE_LSM(selinux) = {
> >
> >  static const struct nf_hook_ops selinux_nf_ops[] = {
> >         {
> > -               .hook =         selinux_ipv4_postroute,
> > +               .hook =         selinux_hook_postroute,
> >                 .pf =           NFPROTO_IPV4,
> >                 .hooknum =      NF_INET_POST_ROUTING,
> >                 .priority =     NF_IP_PRI_SELINUX_LAST,
> >         },
>
> Thanks for the patch Florian, although the name "selinux_hook_*" seems
> a bit ambiguous to me, after all we have a little more than 200
> "hooks" in the SELinux LSM implementation.  Would you be okay with
> calling the netfilter hook functions "selinux_nf_*" or something
> similar?  If you don't have time I can do the rename during the merge
> assuming we can all agree on a name.

Since selinux_ip_forward() and selinux_ip_postroute() are used only in
the hook functions, how about changing their signature and using them
as hooks directly? That would solve the naming and also remove a few
extra lines of boilerplate.

-- 
Ondrej Mosnacek
Software Engineer, Linux Security - SELinux kernel
Red Hat, Inc.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ