netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FreeSWAN's pfkey_v2.c
@ 2002-10-17  2:48 Michael Richardson
  2002-10-17  2:50 ` Andi Kleen
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Richardson @ 2002-10-17  2:48 UTC (permalink / raw)
  To: design; +Cc: netdev

-----BEGIN PGP SIGNED MESSAGE-----


In our pfkey_v2.c, we had:

struct proto_ops SOCKOPS_WRAPPED(pfkey_ops);
...
pfkey_create() {
sock->ops = &SOCKOPS_WRAPPED(pfkey_ops);
}
...
struct proto_ops SOCKOPS_WRAPPED(pfkey_ops) = {
}

#ifdef NETDEV_23
#include <linux/smp_lock.h>
SOCKOPS_WRAP(pfkey, PF_KEY);
#endif /* NETDEV_23 */

When building with -Werror, we get a fatal error when SMP is defined, because
we get a pfkey_ops which is never used.

I believe that the error is that we should not be initializing the sock->ops
to the WRAPPED version, but rather to "pfkey_ops", so that we actually are
using the wrapped functions which lock stuff.

I.e. we never actually were using the interface which the SOCKOPS_WRAP()
macro so meticulously created for us.

We probably haven't hit a problem before, because we tend to run on
uniprocessors a lot, and we also tend to have only one single threaded
process (pluto) that talks PF_KEY.

I am looking for confirmation from network stack people that my conclusions
from reading of the macros in linux/net.h is correct.

]       ON HUMILITY: to err is human. To moo, bovine.           |  firewalls  [
]   Michael Richardson, Sandelman Software Works, Ottawa, ON    |net architect[
] mcr@sandelman.ottawa.on.ca http://www.sandelman.ottawa.on.ca/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Finger me for keys

iQCVAwUBPa4k44qHRg3pndX9AQHArwQAmePHXduPugmIQemek8PDx7spY82uN25u
MlZu+uuuGK1k0YvOiOLJUyaCmhdXRGtYOKd+GoDHVX5NJsnI7AbJzTmhy2H8DjZI
/gR8sblD3w6Q/Fi/M4jQvLdsNSWZVSoMR1tnsRLorfQva8C737LTJ8Ipa9KrnWNH
qx/0EyQnQ3o=
=6xM7
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FreeSWAN's pfkey_v2.c
  2002-10-17  2:48 FreeSWAN's pfkey_v2.c Michael Richardson
@ 2002-10-17  2:50 ` Andi Kleen
  2002-10-17  2:53   ` Arnaldo Carvalho de Melo
  2002-10-17  3:58   ` Michael Richardson
  0 siblings, 2 replies; 4+ messages in thread
From: Andi Kleen @ 2002-10-17  2:50 UTC (permalink / raw)
  To: Michael Richardson; +Cc: design, netdev

> I am looking for confirmation from network stack people that my conclusions
> from reading of the macros in linux/net.h is correct.

What you should actually do is to add explicit proper SMP locking.
Then you don't need any SOCKOPS_WRAP hacks.

-Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FreeSWAN's pfkey_v2.c
  2002-10-17  2:50 ` Andi Kleen
@ 2002-10-17  2:53   ` Arnaldo Carvalho de Melo
  2002-10-17  3:58   ` Michael Richardson
  1 sibling, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2002-10-17  2:53 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Michael Richardson, design, netdev

Em Thu, Oct 17, 2002 at 04:50:54AM +0200, Andi Kleen escreveu:
> > I am looking for confirmation from network stack people that my conclusions
> > from reading of the macros in linux/net.h is correct.
> 
> What you should actually do is to add explicit proper SMP locking.
> Then you don't need any SOCKOPS_WRAP hacks.

yup, so that eventually we can kill this hackish bandaid.

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FreeSWAN's pfkey_v2.c
  2002-10-17  2:50 ` Andi Kleen
  2002-10-17  2:53   ` Arnaldo Carvalho de Melo
@ 2002-10-17  3:58   ` Michael Richardson
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Richardson @ 2002-10-17  3:58 UTC (permalink / raw)
  To: Andi Kleen; +Cc: design, netdev


>>>>> "Andi" == Andi Kleen <ak@suse.de> writes:
    >> I am looking for confirmation from network stack people that my
    >> conclusions from reading of the macros in linux/net.h is correct.

    Andi> What you should actually do is to add explicit proper SMP locking.
    Andi> Then you don't need any SOCKOPS_WRAP hacks.

  Yes, that's a good idea, but it doesn't help me understand the code.

]       ON HUMILITY: to err is human. To moo, bovine.           |  firewalls  [
]   Michael Richardson, Sandelman Software Works, Ottawa, ON    |net architect[
] mcr@sandelman.ottawa.on.ca http://www.sandelman.ottawa.on.ca/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-17  3:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-17  2:48 FreeSWAN's pfkey_v2.c Michael Richardson
2002-10-17  2:50 ` Andi Kleen
2002-10-17  2:53   ` Arnaldo Carvalho de Melo
2002-10-17  3:58   ` Michael Richardson

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).