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
Unknown Object (File)
Mon, Apr 20, 11:25 AM
Unknown Object (File)
Sat, Apr 18, 4:14 PM
Unknown Object (File)
Wed, Apr 15, 4:24 AM
Unknown Object (File)
Tue, Apr 14, 2:05 PM
Unknown Object (File)
Tue, Apr 14, 9:26 AM
Unknown Object (File)
Tue, Apr 14, 8:19 AM
Unknown Object (File)
Tue, Apr 14, 6:15 AM
Unknown Object (File)
Thu, Apr 9, 9:08 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 Skipped
Unit
Tests Skipped

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