mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Bligh - linux-kernel <linux-kernel@alex.org.uk>
To: Dawson Engler <engler@csl.Stanford.EDU>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Evan Parker <nave@stanford.edu>,
	linux-kernel@vger.kernel.org, mc@CS.Stanford.EDU,
	Alex Bligh - linux-kernel <linux-kernel@alex.org.uk>
Subject: Re: [CHECKER] repetitive/contradictory comparison bugs for 2.4.7
Date: Thu, 26 Jul 2001 20:54:48 +0100	[thread overview]
Message-ID: <602725597.996180886@[169.254.62.211]> (raw)
In-Reply-To: <200107260113.SAA11847@csl.Stanford.EDU>
In-Reply-To: <200107260113.SAA11847@csl.Stanford.EDU>



>> > other 10 are questionable.  Those 10 are all simple variations on the
>> > following code:
>> >
>> > Start --->
>> > 	if (!tmp_buf) {
>> > 		page = get_free_page(GFP_KERNEL);
>> >
>> > Error --->
>> > 		if (tmp_buf)
>> > 			free_page(page);
>> > 		else
>> > 			tmp_buf = (unsigned char *) page;
>> > 	}
>>
>> That one is not a bug. The serial drivers do this to handle a race.
>> Really it should be

May be I'm being dumb here, and without wishing to open the 'volatile'
can of worms elsewhere, but:

   static char * tmp_buf;

How will this be guaranteed to help handle a race, when gcc is
likely either to have tmp_buf in a register (not declared
volatile), or perhaps even optimize out the second reference.
Seems to me (and I may well be wrong), either there is a
race thread (tmp_buf being assigned between the first
test and grabbing the page), in which case as tmp_buf may
be in a register, it doesn't avoid the race (and potentially
stomps on the existing buffer), or there is not a race, in
which case the second check is unnecessary. IE the checker
found a real bug.

--
Alex Bligh

  reply	other threads:[~2001-07-26 19:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-25  0:08 Evan Parker
2001-07-25  0:51 ` Neil Brown
2001-07-25  8:27 ` Russell King
2001-07-25 13:34 ` Alan Cox
2001-07-26  1:13   ` Dawson Engler
2001-07-26 19:54     ` Alex Bligh - linux-kernel [this message]
2001-07-26 20:15       ` Russell King
2001-07-26 22:07         ` Alan Cox
2001-07-26 22:06       ` Alan Cox
2001-07-26 22:24         ` Alex Bligh - linux-kernel

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='602725597.996180886@[169.254.62.211]' \
    --to=linux-kernel@alex.org.uk \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=engler@csl.Stanford.EDU \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mc@CS.Stanford.EDU \
    --cc=nave@stanford.edu \
    /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

all inboxes | Powered by JetHome®