Page MenuHomeFreeBSD

amd64: check that %cs and %ss values from ucontext fit into registers
ClosedPublic

Authored by kib on Mar 15 2026, 7:20 AM.
Tags
None
Referenced Files
F163111370: D55861.id173976.diff
Mon, Jul 20, 4:15 AM
Unknown Object (File)
Wed, Jul 15, 7:13 AM
Unknown Object (File)
Wed, Jul 15, 7:13 AM
Unknown Object (File)
Sun, Jul 12, 1:48 AM
Unknown Object (File)
Sat, Jul 11, 12:36 AM
Unknown Object (File)
Sat, Jul 4, 2:33 AM
Unknown Object (File)
Tue, Jun 30, 9:51 PM
Unknown Object (File)
Mon, Jun 29, 6:25 PM
Subscribers

Details

Summary
This change only checks that the values from the user-supplied context
are not truncated by C implicit type convertions.  The validity of the
segment selectors is still checked by hardware.

Diff Detail

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

Event Timeline

kib requested review of this revision.Mar 15 2026, 7:20 AM
This revision is now accepted and ready to land.Mar 19 2026, 2:39 PM
sys/amd64/amd64/exec_machdep.c
275

These fields are register_t, which is signed.

sys/amd64/ia32/ia32_signal.c
217

... here, the fields are unsigned.

kib marked 2 inline comments as done.

Centralize and fix checks.

This revision now requires review to proceed.Mar 20 2026, 3:13 AM
sys/amd64/ia32/ia32_signal.c
721

This should be updated too?

kib marked an inline comment as done.

Missed check.

This revision is now accepted and ready to land.Mar 20 2026, 4:57 AM