Date: Fri, 27 Jun 2014 12:41:11 -0700 From: Andy Lutomirski <luto@...capital.net> To: musl@...ts.openwall.com Subject: Re: getcontext etc was Re: Re: go support (was: Best place to discuss other lightweight libraries?) On 06/23/2014 03:32 PM, Rich Felker wrote: > On Mon, Jun 23, 2014 at 10:09:29PM +0100, Justin Cormack wrote: >> On Wed, Apr 24, 2013 at 2:42 PM, Rich Felker <dalias@...ifal.cx> wrote: >>>> i tried to build gcc 4.7.2 with go support (--enable-languages=c,c++,go) >>>> and that fails due to a lack of set/getcontext(). >>>> (see pkg/gcc472 in sabotage) >>>> >>>> according to rich, adding that to musl requires a non-trivial amount >>>> of arch specific asm. >>> >>> Yes, but it is a wanted feature, so I wouldn't mind it getting done. >>> It was even part of the standard prior to POSIX 2008, and the reason >>> for removing it was stupid. (The reason was that the makecontext >>> function's calling convention is bogus and impossible to support >>> properly, but they could have fixed this by deprecating the use of the >>> variadic arguments in any way except passing a single void* argument, >>> rather than deprecating the whole set of interfaces.) >> >> Just to revive this post 1.0, it would be very nice indeed to have >> set,get,swapcontext. > > One approach to setcontext would be using rt_sigreturn, but I've heard > there are issues using it for setcontext involving the alternate > signal stack. It's the only way to do resuming _async_ (i.e. the > ucontext received by a signal handler for the state it interrupted) > contexts though, so maybe there's some way to make it work. This issue > was discussed recently on libc-alpha (the glibc list). What's the async issue? I think that using rt_sigreturn for this directly (rather than sending yourself a signal, adjusting the context, and returning) is a bad idea: there are patches floating around to mitigate SROP (sigreturn-oriented programming) by adding signal frame canaries, and you'll go boom if that happens. --Andy
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.