ucontext, kernel vs. userspace (glibc)
Catalin Marinas
catalin.marinas at arm.com
Tue Aug 31 10:44:14 PDT 2021
Hi Ben,
On Mon, Aug 30, 2021 at 08:40:03PM +1000, Benjamin Herrenschmidt wrote:
> So I'm discovering arm64 intricacies and today, as I was looking at SVE
> support (in the context of distro glibc backports.. don't ask), I
> noticed that glibc has no provision for dealing with kernel generated
> ucontext's in its {get,set,swap}_context functions...
>
> (It says so explicitly in the code unless I misunderstood).
>
> So one thing we did to "solve" this on ppc64 a while ago was to create
> a swapcontext syscall which can operate as all 3 operations (you can
> have NULL arguments), which also handles the sigprocmask (bonus:
> atomically with the context get/set from a userspace perspective).
>
> Would it make sense to do something similar on aarch64 ? (And have
> glibc then exploit it).
>
> The hard-to-solve thing is the case where the SVE context spills
> outside of the ucontext itself, in the extra room on the stack, since
> programs that "now" about ucontext will not have allocated space for
> that, so that's more/less a lost cause already.
I haven't fully parsed your email yet but adding a Mark B for SVE and
Szabolcs for glibc (and removing Dave who left Arm recently).
--
Catalin
More information about the linux-arm-kernel
mailing list