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-next>] [day] [month] [year] [list]
Date:	Thu, 12 Aug 2010 15:48:35 +0900
From:	Namhyung Kim <namhyung@...il.com>
To:	Ma Ling <ling.ma@...el.com>
Cc:	hpa@...or.com, tglx@...utronix.de, linux-kernel@...r.kernel.org,
	mingo@...e.hu
Subject: Re: [PATCH V2] [X86] Fix potential issue on memmove

> --- a/arch/x86/lib/memcpy_32.c
> +++ b/arch/x86/lib/memcpy_32.c
> @@ -25,19 +25,35 @@ void *memmove(void *dest, const void *src, size_t n)
>	int d0, d1, d2;
> 
> 	if (dest < src) {
> -		memcpy(dest, src, n);
> +		if ((dest + n) < src)
> +			 return memcpy(dest, src, n);
> +		else
> +			__asm__ __volatile__(
> +				"rep\n\t"
> +				"movsb\n\t"
> +				: "=&c" (d0), "=&S" (d1), "=&D" (d2)
> +				:"0" (n),
> +				 "1" (src),
> +				 "2" (dest)
> +				:"memory");
> +
> 	} else {
> -		__asm__ __volatile__(
> -			"std\n\t"
> -			"rep\n\t"
> -			"movsb\n\t"
> -			"cld"
> -			: "=&c" (d0), "=&S" (d1), "=&D" (d2)
> -			:"0" (n),
> -			 "1" (n-1+src),
> -			 "2" (n-1+dest)
> -			:"memory");
> +		if((src + count) < dest)
> +			return memcpy(dest, src, count);

'count' should be 'n'.

-- 
Regards,
Namhyung Kim


--
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