mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: dhowells@redhat.com
Cc: netdev@vger.kernel.org, linux-afs@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH net] net: Work around lockdep limitation in sockets that use sockets
Date: Wed, 08 Mar 2017 23:06:25 -0800 (PST)	[thread overview]
Message-ID: <20170308.230625.719131946756053988.davem@davemloft.net> (raw)
In-Reply-To: <148881267372.2618.822975702493802450.stgit@warthog.procyon.org.uk>

From: David Howells <dhowells@redhat.com>
Date: Mon, 06 Mar 2017 15:04:44 +0000

> Fix the general case by:
> 
>  (1) Double up all the locking keys used in sockets so that one set are
>      used if the socket is created by userspace and the other set is used
>      if the socket is created by the kernel.
> 
>  (2) Store the kern parameter passed to sk_alloc() in a variable in the
>      sock struct (sk_kern_sock).  This informs sock_lock_init(),
>      sock_init_data() and sk_clone_lock() as to the lock keys to be used.
> 
>      Note that the child created by sk_clone_lock() inherits the parent's
>      kern setting.
> 
>  (3) Add a 'kern' parameter to ->accept() that is analogous to the one
>      passed in to ->create() that distinguishes whether kernel_accept() or
>      sys_accept4() was the caller and can be passed to sk_alloc().
> 
>      Note that a lot of accept functions merely dequeue an already
>      allocated socket.  I haven't touched these as the new socket already
>      exists before we get the parameter.
> 
>      Note also that there are a couple of places where I've made the accepted
>      socket unconditionally kernel-based:
> 
> 	irda_accept()
> 	rds_rcp_accept_one()
> 	tcp_accept_from_sock()
> 
>      because they follow a sock_create_kern() and accept off of that.

I guess this is fine, but I think you can use one of the two "sk_padding"
bits in struct sock instead of making the structure larger.

  reply	other threads:[~2017-03-09  7:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 15:04 David Howells
2017-03-09  7:06 ` David Miller [this message]
2017-03-09  7:51 ` David Howells
2017-03-09 17:38   ` 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=20170308.230625.719131946756053988.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®