|
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.
|