summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2021-01-11 16:44:06 -0800
committerJulius Werner <jwerner@chromium.org>2021-03-17 00:13:59 +0000
commit535846763825f9bc4531b9322b1b61f3973cd6f8 (patch)
treef403f851438c5bc1cf71470e9e52db4475880265 /src/include
parent965846fcd0657bead026056e9bdc3625a534552e (diff)
prog_loaders: Remove prog_locate()
This patch rewrites the last few users of prog_locate() to access CBFS APIs directly and removes the call. This eliminates the double-meaning of prog_rdev() (referring to both the boot medium where the program is stored before loading, and the memory area where it is loaded after) and makes sure that programs are always located and loaded in a single operation. This makes CBFS verification easier to implement and secure because it avoids leaking a raw rdev of unverified data outside the CBFS core code. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I7a5525f66e1d5f3a632e8f6f0ed9e116e3cebfcf Reviewed-on: https://review.coreboot.org/c/coreboot/+/49337 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/program_loading.h23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/include/program_loading.h b/src/include/program_loading.h
index f936c618ad..bb4f6ea1d2 100644
--- a/src/include/program_loading.h
+++ b/src/include/program_loading.h
@@ -41,8 +41,7 @@ void arch_segment_loaded(uintptr_t start, size_t size, int flags);
/* Representation of a program. */
struct prog {
- /* The region_device is the source of program content to load. After
- * loading program it represents the memory region of the stages and
+ /* The region_device represents the memory region of the stages and
* payload. For architectures that use a bounce buffer
* then it would represent the bounce buffer. */
enum prog_type type;
@@ -128,13 +127,10 @@ static inline void prog_set_arg(struct prog *prog, void *arg)
prog->arg = arg;
}
-/* Locate the identified program to run. Return 0 on success. < 0 on error. */
-int prog_locate(struct prog *prog);
/* The prog_locate_hook() is called prior to CBFS traversal. The hook can be
- * used to implement policy that allows or prohibits further progress through
- * prog_locate(). The type and name field within struct prog are the only valid
- * fields. A 0 return value allows further progress while a non-zero return
- * value prohibits further progress */
+ * used to implement policy that allows or prohibits further program loading.
+ * The type and name field within struct prog are the only valid fields. A 0
+ * return value allows loading while a non-zero return value prohibits it. */
int prog_locate_hook(struct prog *prog);
/* Run the program described by prog. */
@@ -147,17 +143,6 @@ void arch_prog_run(struct prog *prog);
* code it needs to that as well. */
void platform_prog_run(struct prog *prog);
-struct prog_loader_ops {
- const char *name;
- /* Determine if the loader is the active one. If so returns 1 else 0
- * or < 0 on error. */
- int (*is_loader_active)(struct prog *prog);
- /* Returns < 0 on error or 0 on success. This function locates
- * the rdev representing the file data associated with the passed in
- * prog. */
- int (*locate)(struct prog *prog);
-};
-
/************************
* ROMSTAGE LOADING *
************************/