netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Hannes Reinecke <hare@suse.de>
Cc: Chuck Lever III <chuck.lever@oracle.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	Boris Pismenny <borisp@nvidia.com>,
	"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
	"kernel-tls-handshake@lists.linux.dev" 
	<kernel-tls-handshake@lists.linux.dev>,
	John Haxby <john.haxby@oracle.com>
Subject: Re: [PATCH v8 1/4] net/handshake: Create a NETLINK service for handling handshake requests
Date: Tue, 4 Apr 2023 17:00:35 -0700	[thread overview]
Message-ID: <20230404170035.6650027d@kernel.org> (raw)
In-Reply-To: <4dde688e-21db-6cc6-080e-c451eac2a9ca@suse.de>

On Tue, 4 Apr 2023 17:44:19 +0200 Hannes Reinecke wrote:
> > We're still seeing NULL pointer dereferences here.
> > Typically this happens after the remote closes the
> > connection early.
> > 
> > I guess I cannot rely on sock_hold(sk); from preventing
> > someone from doing a "sock->sk = NULL;"
> > 
> > Would it make more sense for req_submit and req_cancel to
> > operate on "struct sock *" rather than "struct socket *" ?
> >   
> Stumbled across that one, too; that's why my initial submission
> was sprinkled with 'if (!sock->sk)' statements.
> So I think it's a good idea.
> 
> But waiting for Jakub to enlighten us.

Ah, I'm probably the weakest of the netdev maintainers when it comes 
to the socket layer :)

I thought sock->sk is only cleared if the "user" of the socket closes
it. But yes, both sock->sk == NULL and sk->sk_socket == NULL are
entirely possible, and the networking stack usually operates on 
struct sock. Why exactly those two are separate beings is one of 
the mysteries of Linux networking which causes guaranteed confusion 
to all the newcomers. I wish I knew the details so I could at least
document it :S

  reply	other threads:[~2023-04-05  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 18:45 [PATCH v8 0/4] Another crack at a handshake upcall mechanism Chuck Lever
2023-04-03 18:46 ` [PATCH v8 1/4] net/handshake: Create a NETLINK service for handling handshake requests Chuck Lever
2023-04-04 15:36   ` Chuck Lever III
2023-04-04 15:44     ` Hannes Reinecke
2023-04-05  0:00       ` Jakub Kicinski [this message]
2023-04-05  6:32         ` Hannes Reinecke
2023-04-05 14:10           ` Chuck Lever III
2023-04-05  0:23   ` Jakub Kicinski
2023-04-05  0:44     ` Chuck Lever III
     [not found]       ` <20230404183233.78895cf2@kernel.org>
2023-04-05 14:25         ` Chuck Lever III
2023-04-03 18:46 ` [PATCH v8 2/4] net/handshake: Add a kernel API for requesting a TLSv1.3 handshake Chuck Lever
2023-04-03 18:46 ` [PATCH v8 3/4] net/handshake: Add Kunit tests for the handshake consumer API Chuck Lever
2023-04-05  0:24   ` Jakub Kicinski
2023-04-05  0:45     ` Chuck Lever III
2023-04-03 18:46 ` [PATCH v8 4/4] SUNRPC: Recognize control messages in server-side TCP socket code Chuck Lever
2023-04-04 14:41   ` Chuck Lever

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=20230404170035.6650027d@kernel.org \
    --to=kuba@kernel.org \
    --cc=borisp@nvidia.com \
    --cc=chuck.lever@oracle.com \
    --cc=edumazet@google.com \
    --cc=hare@suse.de \
    --cc=john.haxby@oracle.com \
    --cc=kernel-tls-handshake@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).