Bug 466167 - RHEL5.3: posix-timers race condition causes timer to seize up
RHEL5.3: posix-timers race condition causes timer to seize up
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
5.3
All Linux
medium Severity medium
: rc
: ---
Assigned To: Mark McLoughlin
Martin Jenner
:
Depends On:
Blocks: 469724
  Show dependency treegraph
 
Reported: 2008-10-08 16:14 EDT by Mark McLoughlin
Modified: 2009-01-20 15:15 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-01-20 15:15:59 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test-posix-timer-sigwait.c (57 bytes, text/plain)
2008-10-08 16:14 EDT, Mark McLoughlin
no flags Details
posix-timers-race-condition.patch (3.19 KB, patch)
2008-10-08 16:27 EDT, Mark McLoughlin
no flags Details | Diff

  None (edit)
Description Mark McLoughlin 2008-10-08 16:14:20 EDT
Created attachment 319794 [details]
test-posix-timer-sigwait.c

RHEL5.3 posix-timers has a race condition which can cause the timer to effectively seize up if the SIGALRM is being collected at the same time as the timer fires.

This can cause KVM networking to stop working.

The fix went upstream here:
  http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ba661292a2bc6ddd305a212b0526e5dc22195fe7

Also went into 2.6.26.2 and 2.6.25.16.

Bug originally reported here:

  http://lkml.org/lkml/2008/7/16/217

  When a timer fires, posix_timer_event() zeroes out its
  pre-allocated siginfo structure, initialises it and then
  queues up the signal with send_sigqueue().

  However, we may have previously queued up this signal, in
  which case we only want to increment si_overrun and
  re-initialising the siginfo structure is incorrect.

  Also, since we are modifying an already queued signal
  without the protection of the sighand spinlock, we may also
  race with e.g. collect_signal() causing it to fail to find
  a signal on the pending list because it happens to look at
  the siginfo struct after it was zeroed and before it was
  re-initialised.

  The race was observed with a modified kvm-userspace when
  running a guest under heavy network load. When it occurs,
  KVM never sees another SIGALRM signal because although
  the signal is queued up the appropriate bit is never set
  in the pending mask. Manually sending the process a SIGALRM
  kicks it out of this state.

  The fix is simple - only modify the pre-allocated sigqueue
  once we're sure that it hasn't already been queued.

Also attaching a small test case program that can be used to try and reproduce the issue on RHEL5 kernels.
Comment 1 Mark McLoughlin 2008-10-08 16:27:01 EDT
Created attachment 319797 [details]
posix-timers-race-condition.patch
Comment 4 RHEL Product and Program Management 2008-10-09 07:57:08 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 6 Don Zickus 2008-10-20 11:13:46 EDT
in kernel-2.6.18-120.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5
Comment 10 errata-xmlrpc 2009-01-20 15:15:59 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2009-0225.html

Note You need to log in before you can comment on or make changes to this bug.