public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Chuck Lever III <chuck.lever@oracle.com>
Cc: Chuck Lever <cel@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"kernel-tls-handshake@lists.linux.dev" 
	<kernel-tls-handshake@lists.linux.dev>
Subject: Re: [PATCH v10 2/4] net/handshake: Create a NETLINK service for handling handshake requests
Date: Thu, 20 Apr 2023 11:00:07 -0700	[thread overview]
Message-ID: <20230420180007.GA2836977@dev-arch.thelio-3990X> (raw)
In-Reply-To: <7AF72C2D-32CC-4A5E-89BD-07704A6A19D3@oracle.com>

On Thu, Apr 20, 2023 at 05:57:44PM +0000, Chuck Lever III wrote:
> 
> 
> > On Apr 20, 2023, at 1:56 PM, Nathan Chancellor <nathan@kernel.org> wrote:
> > 
> > Hi Chuck,
> > 
> > On Mon, Apr 17, 2023 at 10:32:26AM -0400, Chuck Lever wrote:
> >> From: Chuck Lever <chuck.lever@oracle.com>
> >> 
> >> When a kernel consumer needs a transport layer security session, it
> >> first needs a handshake to negotiate and establish a session. This
> >> negotiation can be done in user space via one of the several
> >> existing library implementations, or it can be done in the kernel.
> >> 
> >> No in-kernel handshake implementations yet exist. In their absence,
> >> we add a netlink service that can:
> >> 
> >> a. Notify a user space daemon that a handshake is needed.
> >> 
> >> b. Once notified, the daemon calls the kernel back via this
> >>   netlink service to get the handshake parameters, including an
> >>   open socket on which to establish the session.
> >> 
> >> c. Once the handshake is complete, the daemon reports the
> >>   session status and other information via a second netlink
> >>   operation. This operation marks that it is safe for the
> >>   kernel to use the open socket and the security session
> >>   established there.
> >> 
> >> The notification service uses a multicast group. Each handshake
> >> mechanism (eg, tlshd) adopts its own group number so that the
> >> handshake services are completely independent of one another. The
> >> kernel can then tell via netlink_has_listeners() whether a handshake
> >> service is active and prepared to handle a handshake request.
> >> 
> >> A new netlink operation, ACCEPT, acts like accept(2) in that it
> >> instantiates a file descriptor in the user space daemon's fd table.
> >> If this operation is successful, the reply carries the fd number,
> >> which can be treated as an open and ready file descriptor.
> >> 
> >> While user space is performing the handshake, the kernel keeps its
> >> muddy paws off the open socket. A second new netlink operation,
> >> DONE, indicates that the user space daemon is finished with the
> >> socket and it is safe for the kernel to use again. The operation
> >> also indicates whether a session was established successfully.
> >> 
> >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> > ...
> >> net/handshake/netlink.c                    |  312 ++++++++++++++++++++++++++
> > ...
> >> +static struct pernet_operations __net_initdata handshake_genl_net_ops = {
> >> + .init = handshake_net_init,
> >> + .exit = handshake_net_exit,
> >> + .id = &handshake_net_id,
> >> + .size = sizeof(struct handshake_net),
> >> +};
> > ...
> >> +static void __exit handshake_exit(void)
> >> +{
> >> + unregister_pernet_subsys(&handshake_genl_net_ops);
> >> + handshake_net_id = 0;
> >> +
> >> + handshake_req_hash_destroy();
> >> + genl_unregister_family(&handshake_nl_family);
> >> +}
> >> +
> >> +module_init(handshake_init);
> >> +module_exit(handshake_exit);
> > 
> > I am not sure if this has been reported yet but it appears this
> > introduces a section mismatch warning in several configurations
> > according to KernelCI:
> > 
> > https://lore.kernel.org/6441748e.170a0220.531bd.8013@mx.google.com/
> > 
> >  $ make -skj"$(nproc)" ARCH=mips CROSS_COMPILE=mips-linux- O=build jazz_defconfig all
> >  ...
> >  WARNING: modpost: vmlinux.o: section mismatch in reference: handshake_exit (section: .exit.text) -> handshake_genl_net_ops (section: .init.data)
> > 
> > I guess '__net_initdata' should be dropped from handshake_genl_net_ops?
> 
> Thanks, Geert just sent a patch to fix that.

Ha, I did check lore for an existing report or patch before I wrote the
mail but not before I sent it... Sorry for the noise!

Cheers,
Nathan

  reply	other threads:[~2023-04-20 18:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17 14:32 [PATCH v10 0/4] Another crack at a handshake upcall mechanism Chuck Lever
2023-04-17 14:32 ` [PATCH v10 1/4] .gitignore: Do not ignore .kunitconfig files Chuck Lever
2023-04-17 14:32 ` [PATCH v10 2/4] net/handshake: Create a NETLINK service for handling handshake requests Chuck Lever
2023-04-20 17:56   ` Nathan Chancellor
2023-04-20 17:57     ` Chuck Lever III
2023-04-20 18:00       ` Nathan Chancellor [this message]
2023-04-17 14:32 ` [PATCH v10 3/4] net/handshake: Add a kernel API for requesting a TLSv1.3 handshake Chuck Lever
2023-04-17 14:32 ` [PATCH v10 4/4] net/handshake: Add Kunit tests for the handshake consumer API Chuck Lever
2023-04-20  2:00 ` [PATCH v10 0/4] Another crack at a handshake upcall mechanism patchwork-bot+netdevbpf

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=20230420180007.GA2836977@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=edumazet@google.com \
    --cc=kernel-tls-handshake@lists.linux.dev \
    --cc=kuba@kernel.org \
    --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