OpenSolaris

Printable Version Enter a New Search
Bug ID 6562537
Synopsis brandz elfexec support code assumes 32-bit elf binaries
State 10-Fix Delivered (Fix available in build)
Category:Subcategory kernel:brandz
Keywords
Responsible Engineer Edward Pilatowicz
Reported Against
Duplicate Of
Introduced In solaris_nevada
Commit to Fix snv_67
Fixed In snv_67
Release Fixed solaris_nevada(snv_67) , solaris_10u5(s10u5_01) (Bug ID:2151501)
Related Bugs 6409860 , 6562555 , 6610046
Submit Date 27-May-2007
Last Update Date 20-June-2007
Description
mapexec_brand() in the elfexec module has the following calling signature:

mapexec_brand(vnode_t *vp, uarg_t *args, Ehdr *ehdr, Elf32_Addr *uphdr_vaddr,
    intptr_t *voffset, caddr_t exec_file, int *interp, caddr_t *bssbase,
    caddr_t *brkbase, size_t *brksize)

On a 64-bit kernel, this function is compiled twice.  once for 32-bit elf
binaries and again for 64-bit elf binaries.  the problem is that the fourth
parameter is explictly declared to be a Elf32_Addr, which won't work when
trying to load 64-bit elf binaries.

additionally, the uarg_t structure has the following member:
       auxv32_t *brand_auxp;   /* starting user addr of brand auxvs on stack */

but we're trying to execute a 64-bit elf binary then this should actually
be an "auxv_t *".
the final solution involves:

- replacing the "auxv32_t *" pointer with a "char *" pointer.  this is ok since
  it's actually a pointer into a different address space and should be interpreted
  based of the type of address space (32-bit or 64-bit) that is being pointed to.
  (this determination can be made by looking at the to_model member of the
  same data structure.)

- replacing the Elf32_Addr reference in mapexec_brand() with an Addr refernce.

- updating the lx_brand and the elf code to work with the new definitions.

- removing the local external defines for elfexec() and mapexec_brand() in
  the lx brand and moving them into a common header file that the lx brand
  (and other brands) can more easily include.
Work Around
N/A
Comments
N/A