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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sun, 17 Oct 2021 10:42:58 +0200 From: Heiko Carstens <hca@...ux.ibm.com> To: Linus Torvalds <torvalds@...ux-foundation.org> Cc: Vasily Gorbik <gor@...ux.ibm.com>, Christian Borntraeger <borntraeger@...ibm.com>, Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, linux-s390 <linux-s390@...r.kernel.org> Subject: Re: [GIT PULL] s390 updates for 5.15-rc6 On Sat, Oct 16, 2021 at 09:22:12AM -0700, Linus Torvalds wrote: > On Sat, Oct 16, 2021 at 2:26 AM Vasily Gorbik <gor@...ux.ibm.com> wrote: > > > > - Fix broken strrchr implementation. > > I pulled this, but had to look at this commit just because it struck me as odd. > > Is the generic strrchr() implementation so bad for s390 that it shows > up? It looks like the s390 implementation wants to avoid checking > separately against the final NUL character and basically uses the > optimized strlen function to do so, but when strrchr has to walk the > string _anyway_ this all looks a bit odd. The difference is that it walks the string from the end to the start, taking into account that searching for the end of the string can be considered fast. > Not a big deal. I just get the feeling that s390 (and probably other > architectures) might be a bit too eager to make their own helper > string functions for reasons that may be historical ("we didn't have > generic string functions at all long ago") or misguided ("we'll do an > architecture-optimized version even for things that don't matter"). This function exists for historical reasons, and in this case it is probably more the "optimized version for things that don't matter". The only caller which sort of gets called more frequently seems to be kbasename(). Some numbers, running 1.000.000 strrchr on an 80 byte string: s390 generic search for 57us 55us first character in string 15us 55us last character in string 44us 55us character in middle of string So yes, we could probably just drop our own implementation, given that it hardly matters in real life.
Powered by blists - more mailing lists