toolchain: introduce config options to include GCC's sanitation libraries
PATCH 1/1 toolchain: introduce config options to include GCC's sanitation libraries
We add config options for external toolchains to allow copying the following libraries into the root file system:
- libasan (-fsanitize=address)
- liblsan (-fsanitize=leak)
- libtsan (-fsanitize=thread)
- libubsan (-fsanitize=undefined)
Copying these shared libraries into the root file system will add run-time support for binaries compiled with one of the above "sanitize" options for enhanced run-time debugging.
--- toolchain/Config.in | 12 ++++++++ .../pkg-toolchain-external.mk | 16 +++++++++++ .../Config.in.options | 28 +++++++++++++++++++ 3 files changed, 56 insertions(+)
toolchain/Config.in +12 -0
@@ -632,4 +632,16 @@ config BR2_TOOLCHAIN_HAS_LIBQUADMATH bool default y if BR2_i386 || BR2_x86_64 +config BR2_TOOLCHAIN_HAS_LIBASAN + bool + +config BR2_TOOLCHAIN_HAS_LIBLSAN + bool + +config BR2_TOOLCHAIN_HAS_LIBTSAN + bool + +config BR2_TOOLCHAIN_HAS_LIBUBSAN + bool + endmenu
toolchain/toolchain-external/pkg-toolchain-external.mk +16 -0
@@ -148,6 +148,22 @@ ifeq ($(BR2_TOOLCHAIN_HAS_OPENMP),y) TOOLCHAIN_EXTERNAL_LIBS += libgomp.so.* endif +ifeq ($(BR2_TOOLCHAIN_HAS_LIBASAN),y) +TOOLCHAIN_EXTERNAL_LIBS += libasan.so* +endif + +ifeq ($(BR2_TOOLCHAIN_HAS_LIBLSAN),y) +TOOLCHAIN_EXTERNAL_LIBS += liblsan.so* +endif + +ifeq ($(BR2_TOOLCHAIN_HAS_LIBTSAN),y) +TOOLCHAIN_EXTERNAL_LIBS += libtsan.so* +endif + +ifeq ($(BR2_TOOLCHAIN_HAS_LIBUBSAN),y) +TOOLCHAIN_EXTERNAL_LIBS += libubsan.so* +endif + TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
toolchain/toolchain-external/toolchain-external-custom/Config.in.options +28 -0
@@ -437,6 +437,34 @@ config BR2_TOOLCHAIN_EXTERNAL_OPENMP support. If you don't know, leave the default value, Buildroot will tell you if it's correct or not. +config BR2_TOOLCHAIN_EXTERNAL_LIBASAN + bool "Toolchain has libasan support?" + select BR2_TOOLCHAIN_HAS_LIBASAN + help + Select this option if your external toolchain has libasan + support (-fsanitize=address). + +config BR2_TOOLCHAIN_EXTERNAL_LIBLSAN + bool "Toolchain has liblsan support?" + select BR2_TOOLCHAIN_HAS_LIBLSAN + help + Select this option if your external toolchain has libasan + support (-fsanitize=leak). + +config BR2_TOOLCHAIN_EXTERNAL_LIBTSAN + bool "Toolchain has libtsan support?" + select BR2_TOOLCHAIN_HAS_LIBTSAN + help + Select this option if your external toolchain has libasan + support (-fsanitize=thread). + +config BR2_TOOLCHAIN_EXTERNAL_LIBUBSAN + bool "Toolchain has libasan support?" + select BR2_TOOLCHAIN_HAS_LIBUBSAN + help + Select this option if your external toolchain has libubsan + support (-fsanitize=undefined). + config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS string "Extra toolchain libraries to be copied to target" help
Signature · 1 line
2.17.1
PATCH 1/1 toolchain: introduce config options to include GCC's sanitation libraries
Hi all,
Quoted 4 lines · Markus Mayer
We add config options for external toolchains to allow copying the following libraries into the root file system:
Quoted 8 lines
- libasan (-fsanitize=address)
- liblsan (-fsanitize=leak)
- libtsan (-fsanitize=thread)
- libubsan (-fsanitize=undefined)Copying these shared libraries into the root file system will add run-time support for binaries compiled with one of the above "sanitize" options for enhanced run-time debugging.
It's been a few months, so I figured I'd follow up on this patch to see if there is any interest in applying this. I think it makes a lot of sense to have this option available. It's sure been handy for us to have the sanitation libraries available at run-time.
I heard from another person who would be interested in seeing this added. I am sure he'll be replying to this thread.
Thanks,
-Markus
Quoted 97 lines
Signed-off-by Markus Mayer <[email protected]>--- toolchain/Config.in | 12 ++++++++ .../pkg-toolchain-external.mk | 16 +++++++++++ .../Config.in.options | 28 +++++++++++++++++++ 3 files changed, 56 insertions(+)toolchain/Config.in +12
-0@@ -632,4 +632,16 @@ config BR2_TOOLCHAIN_HAS_LIBQUADMATH bool default y if BR2_i386 || BR2_x86_64 +config BR2_TOOLCHAIN_HAS_LIBASAN + bool + +config BR2_TOOLCHAIN_HAS_LIBLSAN + bool + +config BR2_TOOLCHAIN_HAS_LIBTSAN + bool + +config BR2_TOOLCHAIN_HAS_LIBUBSAN + bool + endmenutoolchain/toolchain-external/pkg-toolchain-external.mk +16
-0@@ -148,6 +148,22 @@ ifeq ($(BR2_TOOLCHAIN_HAS_OPENMP),y) TOOLCHAIN_EXTERNAL_LIBS += libgomp.so.* endif +ifeq ($(BR2_TOOLCHAIN_HAS_LIBASAN),y) +TOOLCHAIN_EXTERNAL_LIBS += libasan.so* +endif + +ifeq ($(BR2_TOOLCHAIN_HAS_LIBLSAN),y) +TOOLCHAIN_EXTERNAL_LIBS += liblsan.so* +endif + +ifeq ($(BR2_TOOLCHAIN_HAS_LIBTSAN),y) +TOOLCHAIN_EXTERNAL_LIBS += libtsan.so* +endif + +ifeq ($(BR2_TOOLCHAIN_HAS_LIBUBSAN),y) +TOOLCHAIN_EXTERNAL_LIBS += libubsan.so* +endif + TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))toolchain/toolchain-external/toolchain-external-custom/Config.in.options +28
-1@@ -437,6 +437,34 @@ config BR2_TOOLCHAIN_EXTERNAL_OPENMP support. If you don't know, leave the default value, Buildroot will tell you if it's correct or not. +config BR2_TOOLCHAIN_EXTERNAL_LIBASAN + bool "Toolchain has libasan support?" + select BR2_TOOLCHAIN_HAS_LIBASAN + help + Select this option if your external toolchain has libasan + support (-fsanitize=address). + +config BR2_TOOLCHAIN_EXTERNAL_LIBLSAN + bool "Toolchain has liblsan support?" + select BR2_TOOLCHAIN_HAS_LIBLSAN + help + Select this option if your external toolchain has libasan + support (-fsanitize=leak). + +config BR2_TOOLCHAIN_EXTERNAL_LIBTSAN + bool "Toolchain has libtsan support?" + select BR2_TOOLCHAIN_HAS_LIBTSAN + help + Select this option if your external toolchain has libasan + support (-fsanitize=thread). + +config BR2_TOOLCHAIN_EXTERNAL_LIBUBSAN + bool "Toolchain has libasan support?" + select BR2_TOOLCHAIN_HAS_LIBUBSAN + help + Select this option if your external toolchain has libubsan + support (-fsanitize=undefined). + config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS string "Extra toolchain libraries to be copied to target" help --2.17.1
PATCH 1/1 toolchain: introduce config options to include GCC's sanitation libraries
Markus,
Quoted 17 lines · Markus Mayer
Hi all,
Quoted 12 lines · Markus Mayer
We add config options for external toolchains to allow copying the following libraries into the root file system:
- libasan (-fsanitize=address)
- liblsan (-fsanitize=leak)
- libtsan (-fsanitize=thread)
- libubsan (-fsanitize=undefined)Copying these shared libraries into the root file system will add run-time support for binaries compiled with one of the above "sanitize" options for enhanced run-time debugging.
[snip]
Quoted 27 lines
Quoted 27 lines
toolchain/Config.in +12
-0@@ -632,4 +632,16 @@ config BR2_TOOLCHAIN_HAS_LIBQUADMATH bool default y if BR2_i386 || BR2_x86_64 +config BR2_TOOLCHAIN_HAS_LIBASAN + bool + +config BR2_TOOLCHAIN_HAS_LIBLSAN + bool + +config BR2_TOOLCHAIN_HAS_LIBTSAN + bool + +config BR2_TOOLCHAIN_HAS_LIBUBSAN + bool + endmenutoolchain/toolchain-external/pkg-toolchain-external.mk +0
-0@@ -148,6 +148,22 @@ ifeq ($(BR2_TOOLCHAIN_HAS_OPENMP),y) TOOLCHAIN_EXTERNAL_LIBS += libgomp.so.* endif
Quoted 15 lines
Quoted 5 lines
toolchain/toolchain-external/pkg-toolchain-external.mk +5
-0+ifeq ($(BR2_TOOLCHAIN_HAS_LIBASAN),y) +TOOLCHAIN_EXTERNAL_LIBS += libasan.so* +endif + +ifeq ($(BR2_TOOLCHAIN_HAS_LIBLSAN),y)toolchain/toolchain-external/pkg-toolchain-external.mk ifeq ($(BR2_TOOLCHAIN_HAS_OPENMP),y) · line 165
Quoted 10 lines
toolchain/toolchain-external/pkg-toolchain-external.mk +10
-0+TOOLCHAIN_EXTERNAL_LIBS += liblsan.so* +endif + +ifeq ($(BR2_TOOLCHAIN_HAS_LIBTSAN),y) +TOOLCHAIN_EXTERNAL_LIBS += libtsan.so* +endif + +ifeq ($(BR2_TOOLCHAIN_HAS_LIBUBSAN),y) +TOOLCHAIN_EXTERNAL_LIBS += libubsan.so* +endif
Aside from build time impacts, would there be any reason to not just enable these by default in GCC > 4.8 ?
Quoted 50 lines
Quoted 44 lines
toolchain/toolchain-external/pkg-toolchain-external.mk +1
-0+ TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))toolchain/toolchain-external/toolchain-external-custom/Config.in.options +28
-1@@ -437,6 +437,34 @@ config BR2_TOOLCHAIN_EXTERNAL_OPENMP support. If you don't know, leave the default value, Buildroot will tell you if it's correct or not. +config BR2_TOOLCHAIN_EXTERNAL_LIBASAN + bool "Toolchain has libasan support?" + select BR2_TOOLCHAIN_HAS_LIBASAN + help + Select this option if your external toolchain has libasan + support (-fsanitize=address). + +config BR2_TOOLCHAIN_EXTERNAL_LIBLSAN + bool "Toolchain has liblsan support?" + select BR2_TOOLCHAIN_HAS_LIBLSAN + help + Select this option if your external toolchain has libasan + support (-fsanitize=leak). + +config BR2_TOOLCHAIN_EXTERNAL_LIBTSAN + bool "Toolchain has libtsan support?" + select BR2_TOOLCHAIN_HAS_LIBTSAN + help + Select this option if your external toolchain has libasan + support (-fsanitize=thread). + +config BR2_TOOLCHAIN_EXTERNAL_LIBUBSAN + bool "Toolchain has libasan support?" + select BR2_TOOLCHAIN_HAS_LIBUBSAN + help + Select this option if your external toolchain has libubsan + support (-fsanitize=undefined). + config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS string "Extra toolchain libraries to be copied to target" help --Quoted 2 lines
2.17.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 23 lines
Matthew Weber | Associate Director Software Engineer | Commercial Avionics COLLINS AEROSPACE 400 Collins Road NE, Cedar Rapids, Iowa 52498, USA Tel: +1 319 295 7349 | FAX: +1 319 263 6099 matthew.weber at collins.com | collinsaerospace.com CONFIDENTIALITY WARNING: This message may contain proprietary and/or privileged information of Collins Aerospace and its affiliated companies. If you are not the intended recipient, please 1) Do not disclose, copy, distribute or use this message or its contents. 2) Advise the sender by return email. 3) Delete all copies (including all attachments) from your computer. Your cooperation is greatly appreciated. Any export restricted material should be shared using my matthew.weber at corp.rockwellcollins.com address.
PATCH 1/1 toolchain: introduce config options to include GCC's sanitation libraries
Quoted 17 lines · Matthew Weber
Markus,
Quoted 13 lines · Markus Mayer
Hi all,
Quoted 9 lines · Markus Mayer
We add config options for external toolchains to allow copying the following libraries into the root file system:
- libasan (-fsanitize=address)
- liblsan (-fsanitize=leak)
- libtsan (-fsanitize=thread)
- libubsan (-fsanitize=undefined)
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Copying these shared libraries into the root file system will add run-time support for binaries compiled with one of the above "sanitize" options for enhanced run-time debugging.
Aside from build time impacts, would there be any reason to not just enable these by default in GCC > 4.8 ?
Size considerations would also be a reason not to enable it by default. I believe BR tries to keep things minimal, and these are debugging libraries that are not strictly necessary on a production system.
But I am open to doing it either way. I'll leave it up to the BR maintainers to make the call one way or another. Regardless of what the default is, though, it'll be easy to change the settings in a defconfig file or config fragment.
Regards,
-Markus
A message that is not in the archive (sent off-list or not yet received): CAGt4E5sGLJXAbqD7=L+=A9w=EOGVmw6hc1-M1XFj7pY79DGUZA@mail.gmail.com
Markus,
Quoted 14 lines · Markus Mayer
Quoted 12 lines · Matthew Weber
Markus,
Quoted 8 lines · Markus Mayer
Hi all,
Quoted 4 lines · Markus Mayer
We add config options for external toolchains to allow copying the following libraries into the root file system:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
- libasan (-fsanitize=address)
- liblsan (-fsanitize=leak)
- libtsan (-fsanitize=thread)
- libubsan (-fsanitize=undefined)Copying these shared libraries into the root file system will add run-time support for binaries compiled with one of the above "sanitize" options for enhanced run-time debugging.
I've extended then existing external toolchain additional libraries hook via this patch. It should apply to all toolchain types.
http://patchwork.ozlabs.org/patch/1185020/
Regards,
Matt