Page MenuHomeFreeBSD

linux(4): Preserve fpu xsave state across signal delivery on amd64
ClosedPublic

Authored by dchagin on Jun 6 2023, 8:05 PM.
Referenced Files
Unknown Object (File)
Thu, Mar 21, 1:29 PM
Unknown Object (File)
Feb 12 2024, 4:26 AM
Unknown Object (File)
Jan 13 2024, 11:47 PM
Unknown Object (File)
Dec 26 2023, 2:15 AM
Unknown Object (File)
Dec 23 2023, 3:40 AM
Unknown Object (File)
Dec 20 2023, 2:00 AM
Unknown Object (File)
Dec 13 2023, 8:55 AM
Unknown Object (File)
Dec 12 2023, 11:50 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dchagin added reviewers: Linux Emulation, kib.
dchagin added a project: Linux Emulation.

ugh, old commit, fix magic2 printout in error and some comments

Don't leak xfpustate if copyin of magic2 failed

sys/amd64/linux/linux_sysvec.c
329

Is it more correct to check magic before copying xfpustate?

sys/x86/linux/linux_x86_sigframe.h
42

This is somewhat weird way to use sizeof(). Usually we apply it to either type of storage, not an expression, for the purpose of defining the ABI. Is it really sizeof(uint32_t)?

sys/amd64/linux/linux_sysvec.c
329

I've been thinking about it, and leaved as is, as caller will be killed on error or if magic/stack is trashed, and this path is not common. If you insist I’ll fix that, however it does not more sense in my pov

sys/x86/linux/linux_x86_sigframe.h
42

Due to U suffix of LINUX_FP_XSTATE_MAGIC2 it's unsigned int.
It really modeled like a Linux does, and I especially checked this, as I first declared an magic2 variable of the size_t type and spent some time looking for an error reason )))
Perhaps I should add a comment here to avoid confusing

sys/x86/linux/linux_x86_sigframe.h
42

No, it is unsigned int due to suffix + the fact that it fits into unsigned. This is why was triggered by the expression. Of course, size_t is problematic, but uint32_t should be not.

I ask you to change the expression to sizeof(uint32_t), please.

Yes, done, it's much better now, thank you!

whoops, magic2 type changed to uint32_t too

This revision is now accepted and ready to land.Jun 8 2023, 6:50 PM