Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 08 Apr 2021 19:04:09 +0200
From: Florian Weimer <>
To: "Andrey Bugaevskiy" <>
Cc: <>
Subject: Re: errno and swapcontext in a multithreaded setup

* Andrey Bugaevskiy:

> I'm using makecontext/swapcontext to migrate contexts between threads
> and this sometimes leads to getting incorrect errno values.
> Investigating further I've noticed that __errno_location
> is marked __attribute__((const)).
> This causes optimizers to assume that errno address never changes
> in the scope of the function which is not the case in my scenario.

The optimizers make the same assumption for actual thread-local
variables, not just __errno_location.  Migrating contexts between
threads results in undefined behavior.


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.