HomeFreeBSD

irettraps: i386 does not push %ss/%esp when exception does not switch rings

Description

irettraps: i386 does not push %ss/%esp when exception does not switch rings

Which means that we must not copy top 8 bytes from the trampoline stack
for the exception frame to the regular thread kstack. As consequence,
this stops corruption of the pcb. The visible effect was often a broken
fork(2) on the CPU where corruption occured.

Account for the detail by substracting 8 from the copy byte count when
moving exception frames from trampoline to the regular stack.

[irettraps handles segmentation/stack/protection faults which could
occur on the doreti path, where we might already switched stack and
address space]

Reported and tested by: pho
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D36302

Details

Provenance
kibAuthored on Aug 22 2022, 1:20 AM
Reviewer
jhb
Differential Revision
D36302: Series of fixes for i386
Parents
rG95f773e59482: i386 copyout_fast: improve detection of a fault on accessing userspace
Branches
Unknown
Tags
Unknown