[PATCH v2 03/10] um: vdso: Implement __vdso_getcpu() via syscall

Thomas Weißschuh linux at weissschuh.net
Mon Sep 22 09:04:46 PDT 2025


On 2025-09-22 17:14:18+0200, Johannes Berg wrote:
> On Mon, 2025-09-22 at 16:01 +0200, Thomas Weißschuh wrote:
> > Right now it does not provide any advantage over a regular syscall.
> > Essentially it is just overhead. That said, if you do want to make a
> > real vDSO out of it, I'd be happy to help in that.
> 
> I don't know if I'd say "just overhead" - depends on which path is more
> optimised in a typical libc implementation? I'd basically think it's
> identical, no? You either link to the vDSO, or a __weak same function in
> the libc?

The code also needs to be built and maintained. AFAIK __weak is only for
the compile-time linker. The vDSO call will be an indirect call.

> > > I mean ... on the one hand, sure, it doesn't really do much after this,
> > > but OTOH it lets userspace actually use that path? So might be useful.
> > 
> > What advantage does userspace have from it?
> 
> Right now, none? But it's easier to play with if you have the
> infrastructure, and I'm not convinced there's a _disadvantage_?

So far that hasn't happened. The disadvantages are the ones from above,
nothing critical. But of course it is your subsystem and your call to make.

> > > > Also the functionality to map the host vDSO and vsyscall page into UML
> > > > userspace looks very weird and error-prone. Maybe it can also go away.
> > > 
> > > Surely host vDSO etc. is never mapped into UML userspace and never is,
> > > not sure what you're thinking of, but clearly that's wrong as written.
> > 
> > This is how I understand the 32bit implementation using
> > ARCH_REUSE_HOST_VSYSCALL_AREA and NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr)
> > where vsyscall_ehdr comes from the hosts getauxval(AT_SYSINFO_EHDR).
> 
> Huh, hm, yeah I forgot about that ... 32-bit. Yeah, agree we should just
> kill that. I'm not even sure it works with the host kernel trapping
> there? Oh well.

Ack, do you want me to send a patch? This was my real gripe with the UM
vDSO. I want to enable time namespaces for all architectures but these
need to be handled in the vDSO properly. For the 64-bit stub vDSO it's
not a problem as the syscalls will work correctly.
But the interaction with the weird 32-bit logic on the other hand...


Thomas



More information about the linux-um mailing list