Re: [musl] Re: [RFC PATCH] x86/vdso/32: Add AT_SYSINFO cancellation helpers

From: Linus Torvalds
Date: Fri Mar 11 2016 - 14:39:34 EST


On Fri, Mar 11, 2016 at 11:30 AM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>
> I think that this would almost work for musl, except that musl would
> still need to be able to tell whether the syscall that eventually gets
> interrupted is a cancellation point, which still may require some
> ability to unwind from the vdso. The syscall handler can easily tell
> the syscall number (it's in EAX), but it may need the effective EIP as
> well.

So having tried to read the posix manual pages on this, it looks like
there is a list of *minimal* cancellation points, but that saying "any
system call is a cancellation point" is also perfectly valid.

"An implementation may also mark other functions not specified in the
standard as cancellation points"

Of course, musl may have more strict ideas than that on cancellation
points. The "any system call" would make even trivial non-blocking
ones like "futex_wake()" and "getpid()" be cancellation points. So
maybe "any system call" isn't acceptable.

But if it *is* acceptable, that would be a pretty simple kernel mod, I think.

And I could see others possibly wanting to use synchronous signal
handlers. It's not like musl is the only project ever to have had
races with signals..

Linus