coreboot/src/lib
Julius Werner 34cf073220 cbfs: Allow mcache to be found after the first lookup
This patch addresses the same problem as CB:48429, but hopefully this
time correctly. Since the mcache is not guaranteed to be available on
the first CBFS lookup for some special cases, we can no longer treat it
as a one-time fire-and-forget initialization. Instead, we test
cbd->mcache_size to check if the mcache has been initialized yet, and
keep trying on every lookup if we don't find it the first time.

Since the mcache is a hard requirement for TOCTOU safety, also make it
more clear in Kconfig that configurations known to do CBFS accesses
before CBMEM init are incompatbile with that, and make sure we die()
rather than do something unsafe if there's a case that Kconfig didn't
catch.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I4e01e9a9905f7dcba14eaf05168495201ed5de60
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48482
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-12-09 17:44:52 +00:00
..
gnat lib/gnat/i-c.ads: Add uintptr_t type 2020-11-16 12:13:31 +00:00
asan.c src: Add missing 'include <console/console.h>' 2020-11-17 09:01:14 +00:00
b64_decode.c
boot_device.c
bootblock.c src/lib/bootblock.c: make bootblock_main_with_timestamp public 2020-09-22 07:00:34 +00:00
bootmem.c lib/bootmem.c: Improve bootmem_allocate_buffer algorithm 2020-07-30 17:13:28 +00:00
bootmode.c
bootsplash.c cbfs: Simplify load/map API names, remove type arguments 2020-12-02 22:13:17 +00:00
cb.ads
cbfs.c cbfs: Allow mcache to be found after the first lookup 2020-12-09 17:44:52 +00:00
cbmem_common.c
cbmem_console.c
cbmem_stage_cache.c
compute_ip_checksum.c
coreboot_table.c cbfs: Simplify load/map API names, remove type arguments 2020-12-02 22:13:17 +00:00
crc_byte.c
decompressor.c
delay.c
device_tree.c
dimm_info_util.c
edid.c lib/edid: Add missing name descriptor presence flag 2020-10-26 13:28:41 +00:00
edid_fill_fb.c
espi_debug.c
ext_stage_cache.c src/lib: Remove unused function parameters in imd.c 2020-08-04 07:13:59 +00:00
fallback_boot.c
fit.c
fit_payload.c
fmap.c cbfs: Add verification for RO CBFS metadata hash 2020-12-03 00:11:08 +00:00
fw_config.c cbfs: Simplify load/map API names, remove type arguments 2020-12-02 22:13:17 +00:00
gcc.c
gcov-glue.c lib/gcov: Remove assert(0) 2020-08-03 10:36:00 +00:00
gcov-io.c
gcov-io.h
gcov-iov.h
gpio.c gpio: Pull down HiZ pins after reading tristate GPIO strapping 2020-08-06 23:54:41 +00:00
halt.c
hardwaremain.c ACPI S3: Replace acpi_is_wakeup() 2020-11-19 14:48:31 +00:00
hexdump.c
hexstrtobin.c
hw-time-timer.adb
imd.c lib/imd: move struct definitions to a new header file 2020-10-19 06:55:03 +00:00
imd_cbmem.c lib/imd_cbmem.c: Add a helper function to indicate that cbmem is ready 2020-08-17 06:22:58 +00:00
jpeg.c src/lib/jpeg.c: Drop dead code 2020-07-09 23:50:51 +00:00
jpeg.h
Kconfig cbfs: Enable CBFS mcache on most chipsets 2020-12-02 22:12:10 +00:00
Kconfig.cbfs_verification cbfs: Allow mcache to be found after the first lookup 2020-12-09 17:44:52 +00:00
libgcc.c
libgcov.c lib/libgcov.c: Do not redefine alloca 2020-07-29 09:27:33 +00:00
list.c
lzma.c
lzmadecode.c
lzmadecode.h
Makefile.inc cbfs: Add verification for RO CBFS metadata hash 2020-12-03 00:11:08 +00:00
malloc.c
memchr.c
memcmp.c
memcpy.c
memmove.c
memrange.c
memset.c
metadata_hash.c cbfs: Add verification for RO CBFS metadata hash 2020-12-03 00:11:08 +00:00
nhlt.c
primitive_memtest.c
prog_loaders.c
prog_ops.c
program.ld cbfs: Add verification for RO CBFS metadata hash 2020-12-03 00:11:08 +00:00
ramdetect.c
ramtest.c
reg_script.c lib/reg_script: Add cast to fix compilation on x86_64 2020-12-01 16:00:57 +00:00
region_file.c region_file_update_data_arr: Modify region_file with array of buffers 2020-09-16 16:02:54 +00:00
reset.c
rmodule.c
rmodule.ld
romstage_handoff.c src: Update some incorrect config options in comments 2020-11-16 12:09:58 +00:00
rtc.c
selfboot.c
spd_bin.c cbfs: Simplify load/map API names, remove type arguments 2020-12-02 22:13:17 +00:00
spd_cache.c
stack.c
string.c lib/string: Add standard strstr() function 2020-08-03 05:12:23 +00:00
thread.c
timer.c
timer_queue.c src: Remove unused 'include <stddef.h> 2020-08-18 12:15:44 +00:00
timestamp.c symbols: Change implementation details of DECLARE_OPTIONAL_REGION() 2020-08-27 22:11:17 +00:00
ubsan.c lib/ubsan.c: Remove GCC 5.x workaround 2020-10-05 16:18:24 +00:00
uuid.c
version.c
wrdd.c