[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] exec: redzone page zero before loading anything
From: |
Samuel Thibault |
Subject: |
Re: [PATCH] exec: redzone page zero before loading anything |
Date: |
Sun, 28 Sep 2014 22:52:43 +0200 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Justus Winter, le Mon 22 Sep 2014 18:30:24 +0200, a écrit :
> This prevents load_section from mapping any sections to page zero.
Ack.
> * exec/exec.c (do_exec): Redzone page zero before loading anything.
> ---
> exec/exec.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/exec/exec.c b/exec/exec.c
> index 2fc1e44..0ecf2d3 100644
> --- a/exec/exec.c
> +++ b/exec/exec.c
> @@ -1116,6 +1116,16 @@ do_exec (file_t file,
> mach_port_destroy (oldtask, destroynames[i]);
> }
>
> + /* Map page zero redzoned. */
> + {
> + vm_address_t addr = 0;
> + e.error = vm_map (newtask,
> + &addr, vm_page_size, 0, 0, MACH_PORT_NULL, 0, 1,
> + VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_COPY);
> + if (e.error)
> + goto out;
> + }
> +
> /* XXX this should be below
> it is here to work around a vm_map kernel bug. */
> if (interp.file != MACH_PORT_NULL)
> --
> 2.1.0
>
--
Samuel
Fatal Error: Found [MS-Windows] System -> Repartitioning Disk for Linux...
(By cbbrown@io.org, Christopher Browne)
Re: GDB testsuite: »Memory at address 0 is possibly executable«, Richard Braun, 2014/09/13