Page MenuHomeFreeBSD

getcontext/setcontext: Make extra CPU state more explicitly a bug
Needs ReviewPublic

Authored by imp on Jan 4 2024, 5:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 3 2024, 7:33 PM
Unknown Object (File)
Apr 27 2024, 1:08 PM
Unknown Object (File)
Apr 27 2024, 1:05 PM
Unknown Object (File)
Apr 27 2024, 11:58 AM
Unknown Object (File)
Feb 28 2024, 4:27 PM
Unknown Object (File)
Jan 11 2024, 4:09 PM
Unknown Object (File)
Jan 5 2024, 6:23 PM
Subscribers
None

Details

Reviewers
kib
Summary

getcontext and setcontext don't handle extra CPU state added after their
ABIs were laid down. getcontextx and setcontextx do, however, so note that.
Add .Xr to sigreturn, and note the hazard there as well.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 55247
Build 52136: arc lint + arc unit

Event Timeline

imp requested review of this revision.Jan 4 2024, 5:58 PM
imp created this revision.

This makes an impression that sigreturn(2) does not handle extended CPU state, which is not true, at least on both 32 and 64bit x86.
And for me it is not clear what do you mean by 'though the kernel typically manages the ucontext_t'.

IMO it is better to explain that ucontext_t MD layout was fixed in times where more modern CPU registers files were not yet introduced, and this is the reason that the state cannot be embedded into ucontext_t without breaking ABI. Instead, we provide them out of structure with pointers ...