exec-shield patch take 6
mike at navi.cx
Wed Apr 28 04:35:32 CDT 2004
Go Mike! Good to see this work finally turn into a patch against CVS :)
On Wed, 2004-04-28 at 19:02 +0900, Mike McCormack wrote:
> This patch allows platforms using exec-shield patch against the Linux
> kernel (eg. Fedora Core) to run Wine without disabling exec-shield.
It also fixes the prelink case, right? :)
> + vars.pe_size = 0x01000000;
0x1000000? Are you sure you didn't drop a zero somewhere? That's only
16mb.... we probably want something like 0x40000000 which reserves a gig
of address space. Some very large game installers can in fact get close
to this level, and as it's just non-backed address space we're reserving
(for a shor time) there's no real reason to be stingy.
> + * The _start function is the entry and exit point of this program
> + *
> + * It calls wld_start, passing a pointer to the args it receives
> + * then jumps to the address wld_start returns after removing the
> + * first argv value, and decrementing argc
> + */
> +void _start(void);
> +__asm (
> + ".align 4\n"
> + "\t.global _start\n"
> + "\t.type _start, at function\n"
> + "\tcall wld_start\n"
> + "\tpush %eax\n"
> + "\txor %eax,%eax\n"
> + "\txor %ebx,%ebx\n"
> + "\txor %ecx,%ecx\n"
> + "\txor %edx,%edx\n"
> + "\tret\n"
You know, I wonder if we couldn't make this simpler ... well, shorter,
by assuming the stack is already set up and the main binary is mapped
correctly, then being careful not to disturb the linker entry stack just
reserve the areas we need with a few mmap syscalls, map in the real
dynamic linker and do a jump. In effect, rather than repeat the work the
kernel already did for everything but the real dynamic linker, insert a
small shim between them.
More information about the wine-patches