arch/x86/null_breakpoint: Remove handler before jumping to payload
If a payload did any NULL dereferencing it would be broken and jump
back to coreboot code. This fixes the SeaBIOS, FILO and possibly other
payloads too.
Fixes: 3f01cd1453
("arch/x86: Add support for catching null
dereferences through debug regs")
TESTED on qemu/i440fx.
Change-Id: I80f69b71f4d0fab3126e4b9f8c8dc7737b372174
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64345
Reviewed-by: Robert Zieba <robertzieba@google.com>
Reviewed-by: Stefan Ott <coreboot@desire.ch>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
38b8bf02d8
commit
6fc12540fc
|
@ -1,6 +1,7 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
#include <arch/breakpoint.h>
|
#include <arch/breakpoint.h>
|
||||||
#include <arch/null_breakpoint.h>
|
#include <arch/null_breakpoint.h>
|
||||||
|
#include <bootstate.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -55,3 +56,12 @@ void null_breakpoint_init(void)
|
||||||
create_deref_breakpoint();
|
create_deref_breakpoint();
|
||||||
create_instruction_breakpoint();
|
create_instruction_breakpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void null_breakpoint_disable(void *unused)
|
||||||
|
{
|
||||||
|
breakpoint_remove(null_fetch_bp);
|
||||||
|
breakpoint_remove(null_deref_bp);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, null_breakpoint_disable, NULL);
|
||||||
|
BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY, null_breakpoint_disable, NULL);
|
||||||
|
|
Loading…
Reference in New Issue