coreboot-kgpe-d16/util/crossgcc/patches
Harshit Sharma ac8e1062cb crossgcc: Enable GCC to get asan shadow offset at runtime
Unlike Linux kernel which has a static shadow region layout, we have
multiple stages in coreboot and thus require a different shadow offset
address. Unfortunately, GCC currently only supports adding a static
shadow offset at compile time using -fasan-shadow-offset flag.

For this reason, we enable GCC to determine asan shadow offset address
at runtime using a callback function named __asan_shadow_offset().
This supersedes the need to specify this address at compile time. GCC
then makes use of this shadow offset to protect stack buffers by
inserting red zones around them.

Some other benefits of having this GCC patch are:
a. We can place the shadow region in a separate linker section with
   all its advantages like automatic fit insurance. This ensures if
   a platform doesn't have enough memory space to hold shadow region,
   the build will fail. (However, if we use a fixed shadow offset on a
   platform that actually doesn't have enough memory, it may still
   build without any errors.)
b. We don't modify the memory layout compared to the current one, as
   we are placing the shadow region at the end of the space already
   occupied by the program.
c. We can be much more flexible later if needed (thinking of other
   stages like bootblock).
d. Since we are appending the shadow buffer to the region already
   occupied, we make efficient use of the limited memory available
   which is highly beneficial when using cache as ram.

Further, we have made sure that if you compile you tree with ASan
enabled but missed this patch, it will end up in the following
compilation error:
"invalid --param name 'asan-use-shadow-offset-callback'"
So, you cannot accidentally enable the feature without having your
compiler patched.

Change-Id: I401631938532a406a6d41e77c6c9716b6b2bf48d
Signed-off-by: Harshit Sharma <harshitsharmajs@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42794
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
2020-08-17 09:03:19 +00:00
..
acpica-unix2-20200717_iasl.patch crossgcc: Upgrade IASL to version 20200717 2020-08-17 07:07:33 +00:00
binutils-2.35_as-ipxe.patch crossgcc: Upgrade binutils to version 2.35 2020-08-17 07:05:11 +00:00
binutils-2.35_mips-gold.patch crossgcc: Upgrade binutils to version 2.35 2020-08-17 07:05:11 +00:00
binutils-2.35_no-bfd-doc.patch crossgcc: Upgrade binutils to version 2.35 2020-08-17 07:05:11 +00:00
binutils-2.35_no-makeinfo.patch crossgcc: Upgrade binutils to version 2.35 2020-08-17 07:05:11 +00:00
gcc-8.3.0_ada-musl_workaround.patch Revert "crossgcc: Upgrade GCC to 9.2.0" 2020-03-16 14:45:32 +00:00
gcc-8.3.0_asan_shadow_offset_callback.patch crossgcc: Enable GCC to get asan shadow offset at runtime 2020-08-17 09:03:19 +00:00
gcc-8.3.0_gnat-bad_constant.patch Revert "crossgcc: Upgrade GCC to 9.2.0" 2020-03-16 14:45:32 +00:00
gcc-8.3.0_gnat.patch Revert "crossgcc: Upgrade GCC to 9.2.0" 2020-03-16 14:45:32 +00:00
gcc-8.3.0_gnat_eh.patch crossgcc: Backport GNAT exception handler v1 patch 2020-06-10 09:44:50 +00:00
gcc-8.3.0_libgcc.patch Revert "crossgcc: Upgrade GCC to 9.2.0" 2020-03-16 14:45:32 +00:00
gcc-8.3.0_nds32_ite.patch Revert "crossgcc: Upgrade GCC to 9.2.0" 2020-03-16 14:45:32 +00:00
gdb-9.2_amd64.patch crossgcc: Upgrade GDB to version 9.2 2020-06-17 16:32:05 +00:00
gdb-9.2_no-doc.patch crossgcc: Upgrade GDB to version 9.2 2020-06-17 16:32:05 +00:00
gdb-9.2_pythonhome.patch crossgcc: Upgrade GDB to version 9.2 2020-06-17 16:32:05 +00:00