[SeaBIOS] [RFH] Using the memory error detector AddressSanitizer (ASan)
Paul Menzel
paulepanter at users.sourceforge.net
Sun Apr 26 09:22:36 CEST 2015
Dear SeaBIOS folks,
my goal is to build SeaBIOS with the “fast memory error detector”
AddressSanitizer (ASan) [1].
As I did not find a way to override `CFLAGS` for building SeaBIOS, as
they are defined with `:=` in `Makefile`, I added `-fsanitize=address`
directly to `COMMONCFLAGS`.
$ git diff
diff --git a/Makefile b/Makefile
index a4d945c..9a7897c 100644
--- a/Makefile
+++ b/Makefile
@@ -58,7 +58,7 @@ COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \
-m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \
-minline-all-stringops -fomit-frame-pointer \
-freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \
- -ffunction-sections -fdata-sections -fno-common -fno-merge-constants
+ -ffunction-sections -fdata-sections -fno-common -fno-merge-constants -fsanitize=address
COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)
COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
But, buidling SeaBIOS as a coreboot payload fails with a syntax error.
[…]
Compiling (16bit) out/romlayout.o
Building ld scripts
Version:
rel-1.8.0-24-g0b2165d-dirty-20150426_091353-myasrocke350m1
Fixed space: 0xe05b-0x10000 total: 8101 slack: 12 Percent
slack: 0.1%
16bit size: 89760
32bit segmented size: 9184
32bit flat size: 65456
32bit flat init size: 126720
Lowmem size: 2176
f-segment var size: 1200
Linking out/rom16.o
/usr/bin/ld.bfd.real:out/romlayout16.lds:8: syntax error
Makefile:171: recipe for target 'out/rom16.o' failed
make: *** [out/rom16.o] Error 1
The same happens when building SeaBIOS for QEMU/KVM.
[…]
Building ld scripts
Version: rel-1.8.0-24-g0b2165d-dirty-20150426_092029-myasrocke350m1
Fixed space: 0xe05b-0x10000 total: 8101 slack: 12 Percent slack: 0.1%
16bit size: 92640
32bit segmented size: 9728
32bit flat size: 82384
32bit flat init size: 200864
Lowmem size: 2176
f-segment var size: 1200
Linking out/rom16.o
/usr/bin/ld.bfd.real:out/romlayout16.lds:9: syntax error
Makefile:171: recipe for target 'out/rom16.o' failed
make: *** [out/rom16.o] Error 1
Could you please suggest a way to build SeaBIOS with AddressSanitizer?
Also I’m still curious how possible warnings/messages from
AddressSanitzer will be shown to the user.
Thanks,
Paul
[1] https://code.google.com/p/address-sanitizer/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://www.seabios.org/pipermail/seabios/attachments/20150426/82f17cda/attachment.asc>
More information about the SeaBIOS
mailing list