[Devel] Re: [PATCH] Remove READ_IMPLIES_EXEC during restart

Serge E. Hallyn serue at us.ibm.com
Mon Apr 6 11:17:48 PDT 2009


Quoting Dan Smith (danms at us.ibm.com):
> On s390, all tasks have READ_IMPLIES_EXEC set in current->personality,
> which causes the restart process to map things like the stack and heap as
> executable.  During the restart process, remove this bit and restore the
> original personality afterwards.
> 
> This seems a little ugly, but I don't know that there's a better place for
> it.

Well imo the only other thing to do would be to do the same thing but
just around the main restart_memory function.

> Cc: orenl at cs.columbia.edu
> Signed-off-by: Dan Smith <danms at us.ibm.com>

Acked-by: Serge Hallyn <serue at us.ibm.com>

> ---
>  checkpoint/restart.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/checkpoint/restart.c b/checkpoint/restart.c
> index adebc1c..8958ec7 100644
> --- a/checkpoint/restart.c
> +++ b/checkpoint/restart.c
> @@ -13,6 +13,7 @@
>  #include <linux/wait.h>
>  #include <linux/file.h>
>  #include <linux/magic.h>
> +#include <linux/personality.h>
>  #include <linux/checkpoint.h>
>  #include <linux/checkpoint_hdr.h>
> 
> @@ -535,12 +536,18 @@ static int do_restart_root(struct cr_ctx *ctx, pid_t pid)
>  int do_restart(struct cr_ctx *ctx, pid_t pid)
>  {
>  	int ret;
> +	unsigned int original_personality;
> +	
> +	original_personality = current->personality;
> +	current->personality &= ~READ_IMPLIES_EXEC;
> 
>  	if (ctx)
>  		ret = do_restart_root(ctx, pid);
>  	else
>  		ret = do_restart_task(pid);
> 
> +	current->personality = original_personality;
> +
>  	/* on success, adjust the return value if needed [TODO] */
>  	return ret;
>  }
> -- 
> 1.6.1
> 
> _______________________________________________
> Containers mailing list
> Containers at lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list