[PATCH v4 1/2] powerpc/32: add stack protector support

Segher Boessenkool segher at kernel.crashing.org
Thu Sep 27 05:16:16 AEST 2018


On Wed, Sep 26, 2018 at 11:40:38AM +0000, Christophe Leroy wrote:
> +static __always_inline void boot_init_stack_canary(void)
> +{
> +	unsigned long canary;
> +
> +	/* Try to get a semi random initial value. */
> +	get_random_bytes(&canary, sizeof(canary));
> +	canary ^= mftb();
> +	canary ^= LINUX_VERSION_CODE;
> +
> +	current->stack_canary = canary;
> +}

I still think you should wait until there is entropy available.  You
haven't answered my questions about that (or I didn't see them): what
does the kernel do in other similar cases?

Looks great otherwise!


Segher


More information about the Linuxppc-dev mailing list