Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 9 Jan 2016 00:59:55 +0300
From: Alexander Cherepanov <>
Subject: Re: string word-at-a-time and atomic.h FAQ on twitter

On 2016-01-05 20:50, Rich Felker wrote:
> So we could just consider trying to drop the OOB
> accesses. Do we have a list of affected functions? That might be nice
> to include.

I think it would be nice to have a full list of intentional UB. For 
example, this:

   if (n > (char *)0+SIZE_MAX-s-1) n = (char *)0+SIZE_MAX-s-1;

If I understand the code correctly, fixing it will require changes to 
the FILE structure. Are there such plans?

>> this takes care of oob access, but the bytes outside the passed
>> object might change concurrently i.e. strlen might introduce a
>> data race: again this is a problem on the abstract c language
>> level that may be solved e.g. by making all accesses to those
>> bytes relaxed atomic, but user code is not under libc control.
>> in practice the code works if HASZERO reads the word once so it
>> does arithmetics with a consistent value (because the memory
>> model of the underlying machine does not treat such race
>> undefined and it does not propagate unspecified value bits nor
>> has trap representations).
> Indeed, this seems like less of a practical concern.

HASZERO reads the word twice so this should be a problem for unoptimized 
code on big-endian platforms.

Alexander Cherepanov

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.