NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-amd64/59188: x86: trap 21/15h #CP pushes error code but handler assumes it doesn't
>Number: 59188
>Category: port-amd64
>Synopsis: x86: trap 21/15h #CP pushes error code but handler assumes it doesn't
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-amd64-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Mar 17 11:05:00 +0000 2025
>Originator: Taylor R Campbell
>Release: current, 10, 9, ...
>Organization:
The NetControl Protection
>Environment:
>Description:
According to
Intel 64 and IA-32 Architecture Software Developer's Manual, Vol. 3: System Programming Guide, April 2022, Order Number: 325384-077US, Sec. 6.3.1 `External Interrupts', Table 6-1, pp. 6-2 through 6-3,
for interrupt vector 21/15h #CP `Control Protection Exception', the CPU pushes an error code on the stack.
However, i386_trap.S and amd64_trap.S use the ZTRAP macro which assumes there is no error code pushed on the stack and pushes zero as a dummy:
https://nxr.netbsd.org/xref/src/sys/arch/i386/i386/i386_trap.S?r=1.23#323
https://nxr.netbsd.org/xref/src/sys/arch/amd64/amd64/amd64_trap.S?r=1.55#481
>How-To-Repeat:
code and manual inspection
>Fix:
Yes, please! Just use TRAP instead of ZTRAP for this interrupt vector.
Home |
Main Index |
Thread Index |
Old Index