linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Balazs Scheidler <bazsi@balabit.hu>
To: "David S. Miller" <davem@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] unix domain sockets bugfix
Date: Tue, 5 Nov 2002 18:54:33 +0100	[thread overview]
Message-ID: <20021105175433.GB16347@balabit.hu> (raw)

2.4.20-rc1, still not working well for recvfrom() of unix-dgram sockets. It
doesn't return 0 as the length of the sockaddr, checking out the code again
makes me think that this is the problem:

--- socket.c.old	Tue Nov  5 18:48:22 2002
+++ socket.c	Tue Nov  5 18:49:34 2002
@@ -1262,7 +1262,7 @@
 		flags |= MSG_DONTWAIT;
 	err=sock_recvmsg(sock, &msg, size, flags);
 
-	if(err >= 0 && addr != NULL && msg.msg_namelen)
+	if(err >= 0 && addr != NULL)
 	{
 		err2=move_addr_to_user(address, msg.msg_namelen, addr, addr_len);
 		if(err2<0)
---------

strace for the behaviour of the kernel:

> recvfrom(3, "<38>Nov  5 17:53:01 PAM_unix[952"..., 2048, 0, {sin_family=0xf80c /* AF_??? */, {sa_family=63500, sa_data="\377\27
> 7\6\351\4\10\10\270\5\10\360@\5\10"}, [256]) = 82

you can see that 256 is returned as the length of the sockaddr, and there's garbage in the sa_family field.

-- 
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1

             reply	other threads:[~2002-11-05 17:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-05 17:54 Balazs Scheidler [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-10-07  7:35 [PATCH] unix domain sockets bugfix Balazs Scheidler
2002-10-07  7:48 ` David S. Miller
2002-10-07  8:01   ` Balazs Scheidler
2002-10-07  7:56     ` David S. Miller
2002-10-07  9:15 ` James Morris

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=20021105175433.GB16347@balabit.hu \
    --to=bazsi@balabit.hu \
    --cc=davem@redhat.com \
    --cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).