Skip to content

Add TLS support to SVA. TLS segmentation is managed in SVA.#35

Open
tupipa wants to merge 1 commit intojtcriswell:masterfrom
tupipa:tls_v2
Open

Add TLS support to SVA. TLS segmentation is managed in SVA.#35
tupipa wants to merge 1 commit intojtcriswell:masterfrom
tupipa:tls_v2

Conversation

@tupipa
Copy link
Copy Markdown

@tupipa tupipa commented Dec 30, 2018

Enable FS/FSBASE and related SVA structure save/restore during system call dispatching (SVAsyscall in handler.S) and context switching (sva_swap_integer). Kernel is also patched (as a hack) for initialization (or reset) of FSBASE.

A clearer patch for kernel can be viewed online: tupipa/sva_freebsd90@a1edb59

Known Issues:

  1. multi-threading library (pthread) not supported. Applications creating new thread will get error: "SVA: Error! Kernel performing unauthorized fork()!"
  2. When booting into multi-user mode, some user programs will crash with segmentation fault, such as dd, cat, sysctl, ps, etc. But the system will boot and run with TLS enabled applications.

  1. added two members 'fsbase', and 'state_flags' in structure sva_integer_state_t
  2. updated system call entry: SVAsyscall in handler.S: reset state_flags to 0 before enter syscall; after syscall returns, check state_flags to determine wheter to restore FSBASE MSR
  3. updated context switch (sva_swap_integer): set state_flags to 1 for old thread.
  4. added a hack function sva_init_fsbase. This is used for Kernel to update 'fsbase' in SVA. This is a hack since 'fsbase' should not be exposed to Kernel. A better solution could be allowing the application to issue a hypercall directly to SVA to initializae 'fsbase'.
@tupipa
Copy link
Copy Markdown
Author

tupipa commented Dec 31, 2018

Tested on Intel Sandy Bridge (Core i5-2410M). -- Note: This arch has no 'rdrand' instruction which is used to generate SVA thread ID. Thus this is replaced by an integer number during testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant