From: John Dykstra <john.dykstra1@gmail.com>
To: Dan Smith <danms@us.ibm.com>
Cc: containers@lists.osdl.org, netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] [RFC] Add c/r support for connected INET sockets
Date: Thu, 08 Oct 2009 14:47:13 +0000 [thread overview]
Message-ID: <1255013233.8033.14.camel@Maple> (raw)
In-Reply-To: <1254932945-12578-3-git-send-email-danms@us.ibm.com>
On Wed, 2009-10-07 at 09:29 -0700, Dan Smith wrote:
> This patch adds basic support for C/R of open INET sockets. I think
> that
> all the important bits of the TCP and ICSK socket structures is saved,
> but I think there is still some additional IPv6 stuff that needs to be
> handled.
I think this patch breaks code that was already in do_sock_restore():
struct sock *do_sock_restore(struct ckpt_ctx *ctx)
{
struct ckpt_hdr_socket *h;
struct socket *sock;
int ret;
h = ckpt_read_obj_type(ctx, sizeof(*h), CKPT_HDR_SOCKET);
if (IS_ERR(h))
return ERR_PTR(PTR_ERR(h));
/* silently clear flags, e.g. SOCK_NONBLOCK or SOCK_CLOEXEC */
h->sock.type &= SOCK_TYPE_MASK;
ret = sock_create(h->sock_common.family, h->sock.type, 0, &sock);
if (ret < 0)
goto err;
You're passing 0 as the protocol value to sock_create(). This
ultimately gets passed to the address family's create() function.
inet_create() (and its IPv6 companion) use that protocol value as the
key when they search for the proper inet_protosw, which in turn gets
mapped to the struct proto and passed to sk_prot_alloc().
In address families INET and AF_INET6, the struct sock is different
sizes for different protocols. This is implemented by the struct proto
specifying which cache the struct sock comes from.
So by passing in 0 all the time to sock_create(), you're getting a
struct sock that may not be the right size. Memory corruption and
madness follow.
-- John
next prev parent reply other threads:[~2009-10-08 14:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-07 16:29 c/r: Support open INET connections Dan Smith
[not found] ` <1254932945-12578-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-07 16:29 ` [PATCH 1/2] Add socket list helper functions Dan Smith
[not found] ` <1254932945-12578-2-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-12 21:27 ` Oren Laadan
[not found] ` <4AD39F37.2000007-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-10-13 15:14 ` Dan Smith
[not found] ` <87d44re36u.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-10-13 15:34 ` Serge E. Hallyn
2009-10-07 16:29 ` [PATCH 2/2] [RFC] Add c/r support for connected INET sockets Dan Smith
[not found] ` <1254932945-12578-3-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-07 17:19 ` Serge E. Hallyn
[not found] ` <20091007171907.GA20572-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-07 17:22 ` Dan Smith
2009-10-08 14:47 ` John Dykstra [this message]
2009-10-08 15:41 ` Dan Smith
[not found] ` <87ab01gag7.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-10-08 17:31 ` John Dykstra
2009-10-08 17:34 ` Dan Smith
[not found] ` <8763apg57w.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-10-08 18:10 ` John Dykstra
2009-10-08 18:11 ` Dan Smith
2009-10-12 21:52 ` Oren Laadan
2009-10-13 17:05 ` Dan Smith
[not found] ` <87ws2zcjhe.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-10-13 19:00 ` Oren Laadan
[not found] ` <4AD4CE61.30503-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-10-13 19:12 ` Dan Smith
2009-10-13 19:35 ` Oren Laadan
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=1255013233.8033.14.camel@Maple \
--to=john.dykstra1@gmail.com \
--cc=containers@lists.osdl.org \
--cc=danms@us.ibm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.