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:	04 Oct 2007 13:52:13 +0200
From:	Urs Thuermann <urs@...ogud.escape.de>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc:	netdev@...r.kernel.org, David Miller <davem@...emloft.net>,
	Patrick McHardy <kaber@...sh.net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Oliver Hartkopp <oliver@...tkopp.net>,
	Oliver Hartkopp <oliver.hartkopp@...kswagen.de>
Subject: Re: [PATCH 3/7] CAN: Add raw protocol

Arnaldo Carvalho de Melo <acme@...stprotocols.net> writes:

> > +static inline struct raw_sock *raw_sk(const struct sock *sk)
> > +{
> > +	return (struct raw_sock *)sk;
> > +}
> 
> 
> What if I want to do some kernel module that uses INET raw sockets
> (include/net/icmp.h) and CAN raw sockets? Namespace collision, could you
> please use can_raw_ for this namespace?

raw_sk is static so you can't use in another file where you include
include/net/icmp.h.  There is no collision.  Also, since it's inline
you won't even see it in a symbol table.

Hm, it's more than 10 years that I've tested ctags(1) and etags(1)
with several identical static names in different files and I don't
remember my results.  Do these tools have a problem with multiple
defs?  I think they shouldn't since C is explicitly designed for that.

> > +static unsigned int raw_poll(struct file *file, struct socket *sock,
> > +			     poll_table *wait)
> > +{
> > +	unsigned int mask = 0;
> > +
> > +	DBG("socket %p\n", sock);
> > +
> > +	mask = datagram_poll(file, sock, wait);
> > +	return mask;
> 
> What is the value of 'mask' here? Leftover from debugging?

Ah, yes.  We should remove it.

> > +static int raw_setsockopt(struct socket *sock, int level, int optname,
> > +			  char __user *optval, int optlen)
> > +{

> > +		lock_sock(sk);
> > +
> > +		if (ro->bound && ro->ifindex)
> > +			dev = dev_get_by_index(&init_net, ro->ifindex);
> 
> dev_get_by_index can fail, are you sure that raw_enable_filters can cope
> with this possibility?

When ro->ifindex != 0, the call to dev_get_by_index() shouldn't fail.
We also use lock_sock() here and in NETDEV_UNREGISTER, so there should
be no problem.


urs
-
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