* 32-bit vdso syscall cancellation proposal
@ 2015-08-28 1:44 Andy Lutomirski
0 siblings, 0 replies; only message in thread
From: Andy Lutomirski @ 2015-08-28 1:44 UTC (permalink / raw)
To: musl, libc-alpha, linux-kernel, X86 ML, Brian Gerst
Hi-
After chatting with Rich Felker on IRC, he's convinced me that the
32-bit vsyscall mechanism is annoying for syscall cancellation. To
help, I propose we add two functions:
unsigned long __vdso_pending_vsyscall_eip(void *context);
If context is a signal context pointing to the AT_SYSINFO entry and if
that entry has *not* executed its syscall yet (or if it has but it's
about to resume it), then returns the EIP to which the vsyscall will
return. Otherwise returns -1.
int __vdso_cancel_pending_vsyscall(void *context);
If not in a valid pending vsyscall, returns -EINVAL. Otherwise
clobbers all vsyscall return registers except ESP, EIP, and EAX and
arranges for EAX to be -ENOSYS on return and for the vsyscall to be
skipped. Returns 0.
(Musl would slightly prefer -EINTR, but that's harder to implement.
Musl would like the ability to *change* the return EIP even more, but
that's considerably harder, given that the location of the saved EIP
will vary depending on where we are in the vsyscall.)
Ingo, if I implement something like this, it'll come with a careful
test case. I already have a test case that tests the CFI annotations
(by single-stepping through a syscall and asserting that it unwinds
correctly from every single SIGTRAP). It'll also be on top of a
series that turns __kernel_vsyscall into a *single* function.
__vdso_pending_vsyscall_eip can't be reliably implemented using the
CFI annotations, because you can't tell which side of the syscall
you're on. __vdso_cancel_pending_vsyscall could be, but that's quite
heavyweight, and implementing it directly will only be a couple lines
of code.
--Andy
--
Andy Lutomirski
AMA Capital Management, LLC
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-08-28 1:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-28 1:44 32-bit vdso syscall cancellation proposal Andy Lutomirski
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).