Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 88093

Summary: setcontext() is not signal safe
Product: [Retired] Red Hat Linux Reporter: John Reiser <jreiser>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: fweimer
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-04-09 19:21:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Reiser 2003-04-05 15:41:26 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529

Description of problem:
setcontext() temporarily stores the new register values on the stack at
addresses less than the stack pointer (before 'popa' to set the new values).  If
a signal is delivered between the store and the popa, then the locations that
are read by popa get overwritten, so eventually the wrong values will be set
into the registers.

Version-Release number of selected component (if applicable):
glibc-2.3.2-11.9

How reproducible:
Always

Steps to Reproduce:
1.Run testcase stdlib/tst-setcontext under gdb.
2.Set a breakpoint at setcontext+67: mov %ebx,(%ecx)
3.Print $ecx and $esp at the breakpoint.

    

Actual Results:
$esp = 0xffffcb1c
$ecx = 0xffffcafc   # 0x20 less than $esp


Expected Results:
$esp = 0xffffcafc
$ecx = 0xffffcafc  # == $esp

Additional info:

Fix: move the  "movl %ecx, %esp" at line 85 of
sysdeps/unix/sysv/linux/i386/setcontext.S to just after the "subl $36, %ecx" at
line 60.

Comment 1 John Reiser 2003-04-06 04:52:51 UTC
A similar problem exists in sysdeps/unix/sysv/linux/i386/swapcontext.S at lines
89 and 114.


Comment 2 Jakub Jelinek 2003-04-09 19:21:38 UTC
An errata 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 the 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/RHBA-2003-136.html