From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2816 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: Fwd: Alignment check in strlen Date: Wed, 20 Feb 2013 19:22:53 +0100 Message-ID: <20130220182253.GT6181@port70.net> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1361384585 3357 80.91.229.3 (20 Feb 2013 18:23:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Feb 2013 18:23:05 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2817-gllmg-musl=m.gmane.org@lists.openwall.com Wed Feb 20 19:23:27 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1U8EKF-0005MZ-Mh for gllmg-musl@plane.gmane.org; Wed, 20 Feb 2013 19:23:27 +0100 Original-Received: (qmail 18357 invoked by uid 550); 20 Feb 2013 18:23:07 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 18349 invoked from network); 20 Feb 2013 18:23:06 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2816 Archived-At: * Jonas Wagner [2013-02-20 19:05:28 +0100]: > attached is a patch that makes the alignment check in strlen more > consistent with the one in memcpy, and hopefully faster. > there is already a patch set to make string.h functions more consistent that addresses more issues but needs clean up see febr 4 and 5 http://www.openwall.com/lists/musl/2013/02/ so yes at some point these should be fixed.. > In src/string/memcpy.c, I find the following: > > #define ALIGN (sizeof(size_t)-1) > if (((uintptr_t)d & ALIGN) != ((uintptr_t)s & ALIGN)) > goto misaligned; > > In src/string/strlen.c, a different check was used instead: > > #define ALIGN (sizeof(size_t)) > for (; (uintptr_t)s % ALIGN; s++) if (!*s) return s-a; > > I do not think there is any particular reason for this difference. > > Best, > Jonas