From: Paul Moore <pmoore@redhat.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: netdev@vger.kernel.org, linux-security-module@vger.kernel.org,
vlad.halilov@gmail.com, selinux@tycho.nsa.gov
Subject: Re: [PATCH] netlabel: improve domain mapping validation
Date: Fri, 17 May 2013 15:37:51 -0400 [thread overview]
Message-ID: <1368823708.cY7J5lAl7C@sifl> (raw)
In-Reply-To: <51968397.6010808@cogentembedded.com>
On Friday, May 17, 2013 11:23:03 PM Sergei Shtylyov wrote:
> Hello.
>
> On 05/17/2013 11:08 PM, Paul Moore wrote:
> > The net/netlabel/netlabel_domainhash.c:netlbl_domhsh_add() function
> > does not properly validate new domain hash entries resulting in
> > potential problems when an administrator attempts to add an invalid
> > entry. One such problem, as reported by Vlad Halilov, is a kernel
> > BUG (found in netlabel_domainhash.c:netlbl_domhsh_audit_add()) when
> > adding an IPv6 outbound mapping with a CIPSO configuration.
> >
> > This patch corrects this problem by adding the necessary validation
> > code to netlbl_domhsh_add() via the newly created
> > netlbl_domhsh_validate() function.
> >
> > Ideally this patch should also be pushed to the currently active
> > -stable trees.
> >
> > Reported-by: Vlad Halilov <vlad.halilov@gmail.com>
> > Signed-off-by: Paul Moore <pmoore@redhat.com>
...
> > +#if IS_ENABLED(CONFIG_IPV6)
>
> Why not:
>
> if (IS_ENABLED(CONFIG_IPV6))
>
> #if's in the function body are frowned upon.
The dependent functions/types are not defined when !IS_ENABLED(CONFIG_IPV6);
please look at the rest of the NetLabel code (net/netlabel).
Perhaps we can do some work to fixup some of that in the future, but that
shouldn't hold up this fix.
> > + netlbl_af6list_foreach(iter6, &entry->type_def.addrsel->list6) {
> > + map6 = netlbl_domhsh_addr6_entry(iter6);
> > + switch (map6->type) {
> > + case NETLBL_NLTYPE_UNLABELED:
> > + break;
> > + default:
> > + return -EINVAL;
> > + }
> > + }
> > +#endif /* IPv6 */
> > + break;
> > + default:
> > + return -EINVAL;
> > + }
> > +
> > + return 0;
> > +}
--
paul moore
security and virtualization @ redhat
next prev parent reply other threads:[~2013-05-17 19:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-17 19:08 [PATCH] netlabel: improve domain mapping validation Paul Moore
2013-05-17 19:23 ` Sergei Shtylyov
2013-05-17 19:37 ` Paul Moore [this message]
2013-05-17 21:47 ` Sergei Shtylyov
2013-05-19 21:50 ` David Miller
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=1368823708.cY7J5lAl7C@sifl \
--to=pmoore@redhat.com \
--cc=linux-security-module@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=selinux@tycho.nsa.gov \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=vlad.halilov@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).