Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.20.1603052002140.31711@monopod.intra.ispras.ru>
Date: Sat, 5 Mar 2016 20:24:15 +0300 (MSK)
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] slim down and avoid undefined behavior in
 unsetenv

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.

Alexander

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.