Skip to content

Commit

Permalink
extables: verify entry validity during boot
Browse files Browse the repository at this point in the history
Ensure all entries have a fixup IP or a callback. Panic if an entry
lacks both.

Signed-off-by: Mathias Krause <[email protected]>
  • Loading branch information
minipli-oss authored and 82marbag committed Oct 15, 2021
1 parent 8530b2d commit c46bc09
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion arch/x86/extables.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates.
* Copyright (c) 2021 Open Source Security, Inc.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -23,5 +24,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

void init_extables(void) { /* no-op */
#include <mm/regions.h>

void init_extables(void) {
for (extable_entry_t *cur = __start_extables; cur < __stop_extables; ++cur) {
if (!cur->fixup && !cur->cb)
panic("extable entry #%d for addr 0x%lx lacks fixup and callback!\n",
cur - __start_extables, cur->fault_addr);
}
}

0 comments on commit c46bc09

Please sign in to comment.