summaryrefslogtreecommitdiffstats
path: root/src/arch/x86
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2022-05-14 10:40:24 +0200
committerArthur Heymans <arthur@aheymans.xyz>2022-05-16 05:00:31 +0000
commit6fc12540fc8031740e93ba05bf307a00ee158088 (patch)
treea98734a67131918aa732fa74de92acd11956c2a6 /src/arch/x86
parent38b8bf02d82031be53b08c677f06d174d3bdbc84 (diff)
downloadcoreboot-6fc12540fc8031740e93ba05bf307a00ee158088.tar.gz
coreboot-6fc12540fc8031740e93ba05bf307a00ee158088.tar.bz2
coreboot-6fc12540fc8031740e93ba05bf307a00ee158088.zip
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: 3f01cd14533f ("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>
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/null_breakpoint.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/arch/x86/null_breakpoint.c b/src/arch/x86/null_breakpoint.c
index 8b21a77cdc95..dbb54aee2aa4 100644
--- a/src/arch/x86/null_breakpoint.c
+++ b/src/arch/x86/null_breakpoint.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/breakpoint.h>
#include <arch/null_breakpoint.h>
+#include <bootstate.h>
#include <console/console.h>
#include <stdint.h>
@@ -55,3 +56,12 @@ void null_breakpoint_init(void)
create_deref_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);