Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lthread _switch() only save/restore general purpose registers #747

Open
bodzhang opened this issue Aug 7, 2020 · 2 comments
Open

lthread _switch() only save/restore general purpose registers #747

bodzhang opened this issue Aug 7, 2020 · 2 comments
Labels
p2 Important but non-urgent priority

Comments

@bodzhang
Copy link
Contributor

bodzhang commented Aug 7, 2020

lthread _switch() does not save/restore FP, SSE or other CPU context. If the multiple lthreads running use FP, SSE or other advanced feature set instructions, the context switch between lthreads might corrupt the CPU context.

It's known that many crypto implementations use SSE or other advanced feature set instructions for performance and security reason (for example, AES-NI based implementation to addresses certain side-channel attack risks).

@bodzhang bodzhang added the needs-triage Bug does not yet have a priority assigned label Aug 7, 2020
@davidchisnall
Copy link
Contributor

I don’t believe this is a bug. The lthread switch routine is a cooperative switch and so needs only to preserve callee-save registers. In the SysV psABI For x86-64, all floating-point and vector register are caller-save. The x87 CW register may need saving.

@davidchisnall davidchisnall added p2 Important but non-urgent priority and removed needs-triage Bug does not yet have a priority assigned labels Aug 10, 2020
@davidchisnall
Copy link
Contributor

The SSE2 CSW also probably needs saving / restoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 Important but non-urgent priority
Projects
None yet
Development

No branches or pull requests

2 participants