Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20261111142258.GD5716@brightrain.aerifal.cx>
Date: Wed, 11 Nov 2026 09:22:58 -0500
From: Rich Felker <dalias@...c.org>
To: Trevor Gross <tg@...vorgross.com>
Cc: musl@...ts.openwall.com
Subject: Re: Possible out of bounds read in memchr

On Wed, Nov 11, 2026 at 02:08:32PM +0000, Trevor Gross wrote:
> On Wed Nov 11, 2026 at 7:41 AM CST, Rich Felker wrote:
> > [...]
> > This is known and intentional. It would be nice if we had a way to
> > express the intent, like a variant of the may_alias attribute, but i
> > think we'd have to write a load in inline asm to make this formally
> > correct. I'm open to changing it, because I don't like having the
> > kinds of hacks this is now, but I'm not sure what's best.
> 
> I believe assembly or a byte-by-byte search are indeed the only ways.

There's a long-term goal to make a framework for archs to provide
minimal aligned-block store/copy primitives to do good memcpy,
memmove, and memset with all of the high level logic in C, and we
could probably add to that providing a 32-bit and/or word-sized load
primitives that strlen, memchr, etc. could use. Then just do a plain
byte-based loop if the arch doesn't define one.

Rich

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.