Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sat, 5 Mar 2016 20:24:15 +0300 (MSK)
From: Alexander Monakov <>
Subject: Re: [PATCH] slim down and avoid undefined behavior in

On Sat, 5 Mar 2016, Rich Felker wrote:
> I don't see much value to it; return __set_errno(e) is functionally
> equivalent to return __syscall_ret(-e) and just saves one "neg"
> instruction before the tailcall. It might be a nicer abstraction in
> places where we don't use syscalls directly, but for the most part
> musl avoids internal APIs in those situations anyway, as explained
> above.

Yeah, I was thinking about using it at call sites that currently do 'errno =
Exyz; return -1' for code size improvements; I wasn't aware of why it would be
undesired. Thanks for the explanations.

> > Here the usage of memcmp requires that it scans buffers left-to-right and
> > stops on first mismatch. As I understand the standards do not guarantee that,
> > but musl's current implementation does, and is not interposable. Still, a
> > gotcha.
> I think you're right. Would it be better to switch such usage to
> strncmp then?

Given your point about reusability, I think so; were it a place where
resulting speed penalty is unwelcome, one could introduce __memcmp_fwd
to make the requirement explicitely visible, at zero runtime cost.


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.