OpenSolaris

Printable Version Enter a New Search
Bug ID 6672544
Synopsis elf_rtbndr must support non-ABI aligned stacks on amd64
State 10-Fix Delivered (Fix available in build)
Category:Subcategory compiler:linker
Keywords
Responsible Engineer Bill Holler
Reported Against snv_85
Duplicate Of
Introduced In solaris_nevada
Commit to Fix snv_86
Fixed In snv_86
Release Fixed solaris_nevada(snv_86) , solaris_10u6(s10u6_01) (Bug ID:2161303)
Related Bugs 6668050 , 6672532
Submit Date 7-March-2008
Last Update Date 29-April-2008
Description
The runtime linker should workaround libraries which have non-ABI compliant
stacks.  See CR 6672535.  Some libraries only guaranty 8-byte stack alignment.
elf_rtbndr() should ensure its stack is properly aligned.  This will protect
functions called by the runtime linker to resolve function calls from
incorrectly aligned stacks.

We are not seeing this failure today because the runtime linker and 
functions called to resolve symbols happen to work with 8-byte aligned
stacks.

A fix in elf_rtbndr() could be:
	pushq   %rbp
	andq    $-16, %rsp	// If %rsp is 8-byte aligned then subtract 8
Function elf_plt_trace also has this issue.
Solaris cannot build itself without this fix.  Some tools required to build
Solaris SEGV due to improper stack alignment.
Test case for elf_rtbndr and elf_plt_trace is attached in 6672544_test.tar.
Functional tests for amd64 ABI INTEGER, SSE, and MEMORY argument types are 
attached in 6672544_arg_test.tar.  INTEGER args 1 through 7, SSE args 1
through 9, and MEMORY args are tested.  These test functions are called
with both amd64 ABI aligned stacks and non-ABI compliant 8-byte aligned stacks.
Tests are run without auditing (the elf_rtbndr PLT path) and with auditing
(the elf_plt_trace PLT path).  All 4 combinations of pltenter and pltexit
auditing are tested to exercise the 4 code paths through elf_plt_trace.
Root Cause was set to "Inadequate External Software" because ON must protect itself from existing
code with 8-byte aligned stack.  C++ programs with a static constructor have illegal 8-byte
aligned stacks due to a bug in the existing C++ library init section.
Work Around
N/A
Comments
N/A