lkml.org 
[lkml]   [2005]   [Jan]   [27]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 27 Jan 2005 10:21:23 +0000
FromChristoph Hellwig <>
SubjectRe: Patch 4/6 randomize the stack pointer
> -#ifdef CONFIG_X86_HT
> +#ifdef __HAVE_ARCH_ALIGN_STACK
>  		/*
>  		 * In some cases (e.g. Hyper-Threading), we want to avoid L1
>  		 * evictions by the processes running on the same package. One
>  		 * thing we can do is to shuffle the initial stack for them.
> -		 *
> -		 * The conditionals here are unneeded, but kept in to make the
> -		 * code behaviour the same as pre change unless we have
> -		 * hyperthreaded processors. This should be cleaned up
> -		 * before 2.6
>  		 */
> 
> -		if (smp_num_siblings > 1)
> -			STACK_ALLOC(p, ((current->pid % 64) << 7));
> +		p = arch_align_stack((unsigned long)p);
>  #endif
>  		u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
>  		if (__copy_to_user(u_platform, k_platform, len))
> diff -purN linux-step-2/fs/exec.c linux-step-4/fs/exec.c
> --- linux-step-2/fs/exec.c	2005-01-26 21:15:33.860310848 +0100
> +++ linux-step-4/fs/exec.c	2005-01-26 21:25:22.678796832 +0100
> @@ -400,7 +400,12 @@ int setup_arg_pages(struct linux_binprm 
>  	while (i < MAX_ARG_PAGES)
>  		bprm->page[i++] = NULL;
>  #else
> -	stack_base = stack_top - MAX_ARG_PAGES * PAGE_SIZE;
> +#ifdef __HAVE_ARCH_ALIGN_STACK
> +	stack_base = arch_align_stack(STACK_TOP - MAX_ARG_PAGES*PAGE_SIZE);
> +	stack_base = PAGE_ALIGN(stack_base);
> +#else
> +	stack_base = STACK_TOP - MAX_ARG_PAGES * PAGE_SIZE;
> +#endif

Please kill the ifdefs and provide a dummy arch_align_stack() for
every architecture.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:09    [from the cache]
©2003-2008