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, 12 Jun 2012 13:26:22 -0400 (EDT)
From:	Nicolas Pitre <nicolas.pitre@...aro.org>
To:	Lasse Collin <lasse.collin@...aani.org>
cc:	T Makphaibulchoke <tmac@...com>,
	Russell King - ARM Linux <linux@....linux.org.uk>,
	schwidefsky@...ibm.com, heiko.carstens@...ibm.com,
	linux390@...ibm.com, lethal@...ux-sh.org, hpa@...or.com,
	tglx@...utronix.de, mingo@...hat.com, x86@...nel.org,
	kaloz@...nwrt.org, jj@...osbits.net, matt.fleming@...el.com,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	linux-s390@...r.kernel.org, linux-sh@...r.kernel.org
Subject: Re: [PATCH v2] lib/decompress_unxz.c: removing all memory helper
 functions

On Tue, 12 Jun 2012, Lasse Collin wrote:

> On 2012-06-11 T Makphaibulchoke wrote:
> > +#ifndef __HAVE_PREBOOT_ARCH_MEMMOVE
> > +void *memmove(void *__dest, __const void *__src, size_t count)
> > +{
> > +	unsigned char *d = __dest;
> > +	const unsigned char *s = __src;
> > +
> > +	if (__dest == __src)
> > +		return __dest;
> > +
> > +	if (__dest < __src)
> > +		return memcpy(__dest, __src, count);
> > +
> > +	while (count--)
> > +		d[count] = s[count];
> > +	return __dest;
> > +}
> > +#endif
> 
> The use of memcpy when __dest < __src is OK with some memcpy
> implementations, but in a generic case it isn't guaranteed to work.

Of course, if the memcpy implementation is also provided along with this 
memmove code, as it was the case on ARM before this patch, then you can 
guarantee it.  And if that memcpy() happens to be slightly more 
optimized then this is a win.

> I think it would be better to just copy memmove from lib/string.c.

Instead of copying, maybe this would be much better to make the content 
of lib/string.c usable in a pre-boot environment.


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