Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.BSM.4.64L.2402282312460.1531@herc.mirbsd.org>
Date: Wed, 28 Feb 2024 23:14:27 +0000 (UTC)
From: Thorsten Glaser <tg@...bsd.de>
To: musl@...ts.openwall.com
cc: James Tirta Halim <tirtajames45@...il.com>
Subject: Re: [PATCH] add memcmpeq: memcmp that returns length of first
 mismatch

Markus Wichmann dixit:

>> > > +	for (; n >= sizeof(word) && *(word *)p1 == *(word *)p2; p1+=sizeof(word), p2+=sizeof(word), n-=sizeof(word));

Very much UB.

>4. All the other musl C code avoids misaligned word access. I don't know
>which architecture/ABI doesn't allow it, but it is nevertheless the

Almost all of them. i386/amd64 penalise it heavily and it can cause
trouble when crossing page sizes, cacheline sizes, etc. as well. On
alpha, many ARM, SPARC, and others, it’s an instant SIGBUS/SIGSEGV.

bye,
//mirabilos
-- 
I believe no one can invent an algorithm. One just happens to hit upon it
when God enlightens him. Or only God invents algorithms, we merely copy them.
If you don't believe in God, just consider God as Nature if you won't deny
existence.		-- Coywolf Qi Hunt

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.