2003-01-07 12:00:42

by Michael Meeks

[permalink] [raw]
Subject: unix_getname buglet - > 2.5.4(?)

Hi there,

Evolution is non-functioning on recent 2.5.X kernels, due to
mal-performance in getpeername => net/unix/af_unix.c (unix_getname),
where it seems we switch 'sk' on 'peer', but not the (previously)
typecast pointer to it; this fixes it.

--- af_unix.c.old Tue Jan 7 11:59:09 2003
+++ af_unix.c Tue Jan 7 12:00:45 2003
@@ -1097,7 +1097,7 @@
static int unix_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer)
{
struct sock *sk = sock->sk;
- struct unix_sock *u = unix_sk(sk);
+ struct unix_sock *u;
struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
int err = 0;

@@ -1112,6 +1112,7 @@
sock_hold(sk);
}

+ u = unix_sk(sk);
unix_state_rlock(sk);
if (!u->addr) {
sunaddr->sun_family = AF_UNIX;

Thanks Joaquim Fellmann (AFAIR) who chased this down to bitkeeper
changeset 1.262.2.2. Sadly I didn't have time to read the rest of that
changeset to see if the mistake pops up elsewhere as well. Please CC me
with replies, not on linux-kernel.

HTH,

Michael Meeks.

--
[email protected] <><, Pseudo Engineer, itinerant idiot


2003-01-07 18:02:38

by Ray Lee

[permalink] [raw]
Subject: [PATCH] Re: unix_getname buglet - > 2.5.4(?)

On Tue, 2003-01-07 at 04:06, Michael Meeks wrote:
> Evolution is non-functioning on recent 2.5.X kernels, due to
> mal-performance in getpeername => net/unix/af_unix.c (unix_getname),
> where it seems we switch 'sk' on 'peer', but not the (previously)
> typecast pointer to it; this fixes it.

<snip> Your patch was MailerMangled(tm). Below is what I'm running on
2.5.54, using Evolution. The patch is obviously correct (once you look
at the full code, anyway).

Linus, please apply.

Ray

diff -Nurx /home/ray/work/dontdiff linux-2.5.54/net/unix/af_unix.c linux-2.5.54-af_unix.c-fix/net/unix/af_unix.c
--- linux-2.5.54/net/unix/af_unix.c 2003-01-07 09:22:29.000000000 -0800
+++ linux-2.5.54-af_unix.c-fix/net/unix/af_unix.c 2003-01-07 09:55:19.000000000 -0800
@@ -1109,7 +1109,7 @@
static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer)
{
struct sock *sk = sock->sk;
- struct unix_sock *u = unix_sk(sk);
+ struct unix_sock *u;
struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
int err = 0;

@@ -1124,6 +1124,7 @@
sock_hold(sk);
}

+ u = unix_sk(sk);
unix_state_rlock(sk);
if (!u->addr) {
sunaddr->sun_family = AF_UNIX;


2003-01-09 00:09:41

by Andy Pfiffer

[permalink] [raw]
Subject: Re: unix_getname buglet - > 2.5.4(?)

On Tue, 2003-01-07 at 04:06, Michael Meeks wrote:
> Hi there,
>
> Evolution is non-functioning on recent 2.5.X kernels, due to
> mal-performance in getpeername => net/unix/af_unix.c (unix_getname),
> where it seems we switch 'sk' on 'peer', but not the (previously)
> typecast pointer to it; this fixes it.
>
<snip>
> Thanks Joaquim Fellmann (AFAIR) who chased this down to bitkeeper
> changeset 1.262.2.2. Sadly I didn't have time to read the rest of that
> changeset to see if the mistake pops up elsewhere as well. Please CC me
> with replies, not on linux-kernel.
>
> HTH,
>
> Michael Meeks.


http://marc.theaimsgroup.com/?l=linux-kernel&m=103462833225515&w=2

Thanks for the fix!

Keep up the great work, Ximian dudes and dudettes.