lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 08 Sep 2009 17:31:51 -0700
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Ben Hutchings <ben@...adent.org.uk>
CC:	x86@...nel.org, linux-kernel@...r.kernel.org,
	Richard Kettlewell <rjk@...raraq.org.uk>
Subject: Re: [PATCH] x86: Fix code patching for paravirt-alternatives on 486

On 09/08/2009 04:23 PM, Ben Hutchings wrote:
> 
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index c776826..74ddfce 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -708,6 +708,12 @@ static inline void sync_core(void)
>  {
>  	int tmp;
>  
> +#if defined(CONFIG_M386) || defined(CONFIG_M486)
> +	/* This is unnecessary on 386- and 486-class processors, most of
> +	   which don't even implement CPUID. */
> +	if (boot_cpu_data.x86 < 5)
> +		return;
> +#endif
>  	asm volatile("cpuid" : "=a" (tmp) : "0" (1)
>  		     : "ebx", "ecx", "edx", "memory");
>  }
> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 4869351..330ab89 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -498,6 +498,9 @@ static void *__init_or_module text_poke_early(void *addr, const void *opcode,
>  	unsigned long flags;
>  	local_irq_save(flags);
>  	memcpy(addr, opcode, len);
> +	/* Force 486-class processors to flush prefetched instructions,
> +	   since we may have just patched local_irq_restore(). */
> +	asm volatile("jmp 1f\n1:\n" ::: "memory");
>  	local_irq_restore(flags);
>  	sync_core();
>  	/* Could also do a CLFLUSH here to speed up CPU recovery; but

I'm wondering if it wouldn't be cleaner to fold the jump into
sync_core() and moving the sync_core() up before local_irq_restore().

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ