Page MenuHomeFreeBSD

Provide the CloudABI vDSO to its executables.
ClosedPublic

Authored by ed on Aug 8 2016, 1:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 1:35 AM
Unknown Object (File)
Thu, Apr 4, 9:27 AM
Unknown Object (File)
Dec 20 2023, 1:09 AM
Unknown Object (File)
Dec 19 2023, 3:51 PM
Unknown Object (File)
Nov 25 2023, 3:50 PM
Unknown Object (File)
Nov 23 2023, 2:32 PM
Unknown Object (File)
Nov 16 2023, 6:16 AM
Unknown Object (File)
Nov 13 2023, 10:13 PM
Subscribers

Details

Summary

CloudABI executables already provide support for passing in vDSOs. This
functionality is used by the emulator for OS X to inject system call
handlers. On FreeBSD, we could use it to optimize calls to
gettimeofday(), etc.

Though I don't have any plans to optimize any system calls right now,
let's go ahead and already pass in a vDSO. This will allow us to
simplify the executables, as the traditional "syscall" shims can be
removed.

Test Plan

Seems to work both on x86-64 and aarch64, both compiled into the kernel
and built as a kernel module.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 4722
Build 4776: arc lint + arc unit

Event Timeline

ed retitled this revision from to Provide the CloudABI vDSO to its executables..
ed updated this object.
ed edited the test plan for this revision. (Show Details)
ed added a reviewer: kib.

Hi Kostik,

The reason why I'm putting you down as a reviewer: could you please take a look at the code in cloudabi_vdso.c to see whether I'm using the VM API correctly?

Thanks,
Ed

sys/compat/cloudabi/cloudabi_vdso.c
56

Why do you check this, instead of assigning sv_shared_page_len to the needed value ?

70

vdso_length is size_t, i.e. unsigned. I suspect that this calculation does not do what you want, on the last partial page of the vdso, the first argument to MIN() is very large unsigned value..

Simply update the vDSO length dynamically.

There is no need to have a fixed space hardcoded in the sysentvec.
cloudabi_vdso_init() can simply compute those values correctly for us.

Thanks for the feedback. What do you think of this version?

sys/compat/cloudabi/cloudabi_vdso.c
56

That's a good question. I have to confess I inherited this construct from how we do the vDSO for Linux. I've just fixed it up to adjust these fields dynamically. Thanks!

70

i * PAGE_SIZE is guaranteed to not exceed vdso_length in this case, so it should never be negative. i is strictly smaller than the number of pages needed to hold the vDSO.

This revision was automatically updated to reflect the committed changes.