All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frans Pop <elendil@planet.nl>
To: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Cc: Matthias Andree <matthias.andree@gmx.de>,
	David Miller <davem@davemloft.net>,
	Netdev <netdev@vger.kernel.org>
Subject: Re: Strange Application bug, race in MSG_PEEK complaints (was: Bug#513695: fetchmail: race in MSG_PEEK)
Date: Thu, 7 May 2009 19:16:56 +0200	[thread overview]
Message-ID: <200905071916.57903.elendil@planet.nl> (raw)
In-Reply-To: <Pine.LNX.4.64.0905070931590.12068@wrl-59.cs.helsinki.fi>

On Thursday 07 May 2009, Ilpo Järvinen wrote:
> On Thu, 7 May 2009, Matthias Andree wrote:
> > I've applied the following patch to net/ipv4/tcp.c for the kernel
> > running on my server (2.6.29-rc8):
> > @@ -1499,8 +1499,9 @@ do_prequeue:
> >    		}
> >    		if ((flags & MSG_PEEK) && peek_seq != tp->copied_seq) {
> >    			if (net_ratelimit())
> > -				printk(KERN_DEBUG "TCP(%s:%d): Application bug, race in MSG_PEEK.\n",
> > -				       current->comm, task_pid_nr(current));
> > +				printk(KERN_DEBUG "TCP(%s:%d): Application bug, race in MSG_PEEK: %x, %x.\n",
> > +				       current->comm, task_pid_nr(current)),
> > +				       peek_seq, tp->copied_seq;
>
> I cannot resist myself from noting that this certainly wasn't the patch
> one got those printks below... It might happily compile though :-).

Can you please elaborate why you think that? It may be horribly broken
(I've never claimed to be a C coder, and probably never will), but it
also really is the patch that generates the printks...

> >    			peek_seq = tp->copied_seq;
> >    		}
> >    		continue;
> >
> > So, the values you see at the end of the warning are peek_seq and
> > tp->copied_seq. This gives messages like:
> > kernel: TCP(fetchmail:9311): Application bug, race in MSG_PEEK: 156233, 16a.
> > kernel: TCP(fetchmail:9311): Application bug, race in MSG_PEEK: 71259ac8, 5b4.
> > kernel: TCP(fetchmail:31216): Application bug, race in MSG_PEEK: 833fe5, c0.

[...]

> What would you think about the following, untested patch... I suppose
> it is enough to capture the racy situations except with that crazy urg
> hole, grr (I suppose that will need just another variable to do the
> offset of one).

I'll give your patch a try and report back.

Thanks,
FJP

  reply	other threads:[~2009-05-07 17:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200902262310.12791.elendil@planet.nl>
     [not found] ` <200903091749.50818.elendil@planet.nl>
     [not found]   ` <op.uqjiqsol1e62zd@merlin.emma.line.org>
     [not found]     ` <200903141900.14498.elendil@planet.nl>
2009-05-06 16:15       ` Strange Application bug, race in MSG_PEEK complaints (was: Bug#513695: fetchmail: race in MSG_PEEK) Matthias Andree
2009-05-06 23:02       ` Matthias Andree
2009-05-07  6:48         ` Ilpo Järvinen
2009-05-07 17:16           ` Frans Pop [this message]
2009-05-07 18:48             ` Ilpo Järvinen
2009-05-07 20:43               ` Frans Pop
2009-05-09 18:14           ` Frans Pop
2009-05-11  6:32             ` [PATCH v2] tcp: fix MSG_PEEK race check Ilpo Järvinen
2009-05-11 12:50               ` Frans Pop
2009-05-11 13:32                 ` Ilpo Järvinen
2009-05-11 13:54                   ` Frans Pop
2009-05-11 14:57                     ` Ilpo Järvinen
2009-05-17 22:31                       ` David Miller
2009-05-18  8:02                         ` Matthias Andree
2009-05-17 22:41               ` David Miller
2009-05-18  7:24                 ` Ilpo Järvinen
2009-05-18 15:34                   ` Matthias Andree
2009-05-18 22:04                   ` David Miller
2009-05-19  4:33                     ` Ilpo Järvinen
2009-05-19  4:40                       ` David Miller
2009-05-19  9:05                     ` Matthias Andree

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=200905071916.57903.elendil@planet.nl \
    --to=elendil@planet.nl \
    --cc=davem@davemloft.net \
    --cc=ilpo.jarvinen@helsinki.fi \
    --cc=matthias.andree@gmx.de \
    --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.