coreboot-kgpe-d16/payloads/libpayload/libc
Julius Werner 9665d389e4 libpayload: dma_malloc: Prevent warm reboot problems and add debugging
Since the DMA memory is allocated by Coreboot (outside of the payload's
linker script), it won't get zeroed upon loading like the heap.
Therefore, a warm reboot that doesn't reset memory may leave stale
malloc cookies lying around and misinterpret them as memory that is
still in use on the next boot. After several boots this may fill up the
whole DMA memory and lead to OOM conditions.

Therefore, this patch explicitly wipes the first cookie in
init_dma_memory() to prevent that from happening. It also expands the
existing memory allocator debugging code to cover the DMA parts, which
was very helpful in identifying this particular problem.

Change-Id: I6e2083c286ff8ec865b22dd922c39c456944b451
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/169455
Reviewed-by: Stefan Reinauer <reinauer@google.com>
(cherry picked from commit 8e5e1784638563b865553125cd5dab1d36a5d2cb)
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
Reviewed-on: http://review.coreboot.org/6645
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2014-08-14 23:41:44 +02:00
..
Makefile.inc libpayload: Change CONFIG_* to CONFIG_LP_* in the kconfig. 2014-08-05 18:44:08 +02:00
args.c
console.c serial: Separate the serial hardware init and the serial console init. 2014-08-10 08:26:48 +02:00
ctype.c
exec.c libpayload: Change CONFIG_* to CONFIG_LP_* in the kconfig. 2014-08-05 18:44:08 +02:00
getopt_long.c
hexdump.c libpayload: hexdump.c: Change type of length argument to size_t 2014-08-10 08:30:07 +02:00
ipchecksum.c
lar.c
lib.c
malloc.c libpayload: dma_malloc: Prevent warm reboot problems and add debugging 2014-08-14 23:41:44 +02:00
memory.c libpayload: make functions static that are unused outside memory.c 2013-02-15 06:51:17 +01:00
printf.c libpayload: fix size_t handling 2013-03-26 19:35:28 +01:00
qsort.c libpayload: Fix whitespace errors 2013-06-27 14:46:43 +02:00
rand.c
readline.c
string.c libpayload: Add strerror 2013-06-28 10:39:57 +02:00
strings.c
strlcpy.c
sysinfo.c
time.c libpayload: Change CONFIG_* to CONFIG_LP_* in the kconfig. 2014-08-05 18:44:08 +02:00