Harshit Sharma has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42794 )
Change subject: crossgcc: Enable GCC to get asan shadow offset at runtime
......................................................................
Patch Set 20:
Sorry. I had forgotten to update the commit message in the actual patch file.
--
To view, visit https://review.coreboot.org/c/coreboot/+/42794
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I401631938532a406a6d41e77c6c9716b6b2bf48d
Gerrit-Change-Number: 42794
Gerrit-PatchSet: 20
Gerrit-Owner: Harshit Sharma <harshitsharmajs(a)gmail.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Comment-Date: Wed, 12 Aug 2020 01:54:55 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Hello build bot (Jenkins), Patrick Georgi, Paul Menzel, Werner Zeh,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42794
to look at the new patch set (#20).
Change subject: crossgcc: Enable GCC to get asan shadow offset at runtime
......................................................................
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(a)gmail.com>
---
A util/crossgcc/patches/gcc-8.3.0_asan_shadow_offset_callback.patch
1 file changed, 109 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/42794/20
--
To view, visit https://review.coreboot.org/c/coreboot/+/42794
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I401631938532a406a6d41e77c6c9716b6b2bf48d
Gerrit-Change-Number: 42794
Gerrit-PatchSet: 20
Gerrit-Owner: Harshit Sharma <harshitsharmajs(a)gmail.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Raul Rangel <rrangel(a)chromium.org>
Gerrit-MessageType: newpatchset
Hello build bot (Jenkins), Patrick Georgi, Paul Menzel, Werner Zeh,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42794
to look at the new patch set (#19).
Change subject: crossgcc: Enable GCC to get asan shadow offset at runtime
......................................................................
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(a)gmail.com>
---
A util/crossgcc/patches/gcc-8.3.0_asan_shadow_offset_callback.patch
1 file changed, 109 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/42794/19
--
To view, visit https://review.coreboot.org/c/coreboot/+/42794
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I401631938532a406a6d41e77c6c9716b6b2bf48d
Gerrit-Change-Number: 42794
Gerrit-PatchSet: 19
Gerrit-Owner: Harshit Sharma <harshitsharmajs(a)gmail.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Raul Rangel <rrangel(a)chromium.org>
Gerrit-MessageType: newpatchset
Harshit Sharma has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42496 )
Change subject: lib: Add ASan support to ramstage on x86 arch
......................................................................
Patch Set 27:
(2 comments)
https://review.coreboot.org/c/coreboot/+/42496/26/src/include/asan.h
File src/include/asan.h:
https://review.coreboot.org/c/coreboot/+/42496/26/src/include/asan.h@42
PS26, Line 42:
> Would you mind to align this comment properly with the line before?
Sure. No problem.
https://review.coreboot.org/c/coreboot/+/42496/26/src/include/asan.h@45
PS26, Line 45:
> Same here.
Done
--
To view, visit https://review.coreboot.org/c/coreboot/+/42496
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ica06bd2be78fcfc79fa888721ed920d4e8248f3b
Gerrit-Change-Number: 42496
Gerrit-PatchSet: 27
Gerrit-Owner: Harshit Sharma <harshitsharmajs(a)gmail.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Comment-Date: Wed, 12 Aug 2020 00:44:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-MessageType: comment
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Paul Menzel, Julius Werner, Werner Zeh,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42496
to look at the new patch set (#27).
Change subject: lib: Add ASan support to ramstage on x86 arch
......................................................................
lib: Add ASan support to ramstage on x86 arch
This patch adds address sanitizer module to the library and reserves
a linker section representing the shadow region for ramstage. Also,
it adds an instruction to initialize shadow region on x86
architecture when ramstage is loaded.
Change-Id: Ica06bd2be78fcfc79fa888721ed920d4e8248f3b
Signed-off-by: Harshit Sharma <harshitsharmajs(a)gmail.com>
---
M src/arch/x86/c_start.S
A src/include/asan.h
M src/include/symbols.h
M src/lib/asan.c
M src/lib/program.ld
5 files changed, 528 insertions(+), 19 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/96/42496/27
--
To view, visit https://review.coreboot.org/c/coreboot/+/42496
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ica06bd2be78fcfc79fa888721ed920d4e8248f3b
Gerrit-Change-Number: 42496
Gerrit-PatchSet: 27
Gerrit-Owner: Harshit Sharma <harshitsharmajs(a)gmail.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-CC: Raul Rangel <rrangel(a)chromium.org>
Gerrit-MessageType: newpatchset