From: "Robboy, David G" <david.g.robboy@intel.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] smp_call_function / handle_IPI bug
Date: Tue, 27 Mar 2001 01:31:36 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590693005355@msgid-missing> (raw)
The linux kernel function smp_call_function does this:
Set variable 'smp_call_function_data' to point to data (this is both
a pointer and a lock)
Send IPI interrupts to other processors
Wait a good long time
If other processors haven't responded
clear the lock (which also nulls out the pointer)
return
if (wait)
wait for execution to complete
clear the lock
return
The function handle_IPI() dereferences the pointer 'smp_call_function_data'
in order to get its data.
It can happen that a processor is busy for a long time and finally gets
around to handling an IPI, when the sender of the IPI has already given up
and cleared the lock. In that case, handle_IPI() dereferences a null
pointer and panics the kernel. I can demonstrate that it's possible.
Before dereferencing the pointer, handle_IPI should check for a null pointer
and "break" if it is null. This simple fix does not guarantee that the
value of smp_call_function_data is still what the sender of the IPI
intended, but I propose that it's up to the programmer to synchronize his
threads correctly. The kernel does not have to enforce correct
synchronization, but it should not panic itself.
The fix I recommend is in the IPI_CALL_FUNC case of
smp_call_function_data(), check for a null pointer and break if it is null.
I'll be glad to submit a patch for R2.4.1 if there is no disagreement with
this solution and if someone will tell me where to send the patch.
David Robboy
reply other threads:[~2001-03-27 1:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=marc-linux-ia64-105590693005355@msgid-missing \
--to=david.g.robboy@intel.com \
--cc=linux-ia64@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