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]
Message-ID: <1368823708.cY7J5lAl7C@sifl>
Date:	Fri, 17 May 2013 15:37:51 -0400
From:	Paul Moore <pmoore@...hat.com>
To:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Cc:	netdev@...r.kernel.org, linux-security-module@...r.kernel.org,
	vlad.halilov@...il.com, selinux@...ho.nsa.gov
Subject: Re: [PATCH] netlabel: improve domain mapping validation

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@...il.com>
> > Signed-off-by: Paul Moore <pmoore@...hat.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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ