All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] toolchain: introduce config options to include GCC's sanitation libraries
@ 2019-06-05 21:41 Markus Mayer
  2019-10-26 18:29 ` Markus Mayer
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Mayer @ 2019-06-05 21:41 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
 toolchain/Config.in                           | 12 ++++++++
 .../pkg-toolchain-external.mk                 | 16 +++++++++++
 .../Config.in.options                         | 28 +++++++++++++++++++
 3 files changed, 56 insertions(+)

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 2da537e7d4c8..15bd2179f9a2 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -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
diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index baf719ad1f09..ca4dd00446b5 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -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))
 
 
diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
index cb7095632fff..c62745103740 100644
--- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
+++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
@@ -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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] toolchain: introduce config options to include GCC's sanitation libraries
  2019-06-05 21:41 [Buildroot] [PATCH] toolchain: introduce config options to include GCC's sanitation libraries Markus Mayer
@ 2019-10-26 18:29 ` Markus Mayer
  2019-10-26 19:03   ` Matthew Weber
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Mayer @ 2019-10-26 18:29 UTC (permalink / raw)
  To: buildroot

Hi all,

On Wed, 5 Jun 2019 at 14:42, Markus Mayer <mmayer@broadcom.com> wrote:
>
> 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.

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

> Signed-off-by: Markus Mayer <mmayer@broadcom.com>
> ---
>  toolchain/Config.in                           | 12 ++++++++
>  .../pkg-toolchain-external.mk                 | 16 +++++++++++
>  .../Config.in.options                         | 28 +++++++++++++++++++
>  3 files changed, 56 insertions(+)
>
> diff --git a/toolchain/Config.in b/toolchain/Config.in
> index 2da537e7d4c8..15bd2179f9a2 100644
> --- a/toolchain/Config.in
> +++ b/toolchain/Config.in
> @@ -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
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index baf719ad1f09..ca4dd00446b5 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -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))
>
>
> diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> index cb7095632fff..c62745103740 100644
> --- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> +++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> @@ -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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] toolchain: introduce config options to include GCC's sanitation libraries
  2019-10-26 18:29 ` Markus Mayer
@ 2019-10-26 19:03   ` Matthew Weber
  2019-10-26 21:49     ` Markus Mayer
       [not found]     ` <CAGt4E5sGLJXAbqD7=L+=A9w=EOGVmw6hc1-M1XFj7pY79DGUZA@mail.gmail.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Matthew Weber @ 2019-10-26 19:03 UTC (permalink / raw)
  To: buildroot

Markus,

On Sat, Oct 26, 2019 at 1:29 PM Markus Mayer <mmayer@broadcom.com> wrote:
>
> Hi all,
>
> On Wed, 5 Jun 2019 at 14:42, Markus Mayer <mmayer@broadcom.com> wrote:
> >
> > 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]

> > --- a/toolchain/Config.in
> > +++ b/toolchain/Config.in
> > @@ -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
> > diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> > index baf719ad1f09..ca4dd00446b5 100644
> > --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> > +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> > @@ -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

Aside from build time impacts, would there be any reason to not just
enable these by default in GCC > 4.8 ?


> > +
> >  TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
> >
> >
> > diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> > index cb7095632fff..c62745103740 100644
> > --- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> > +++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> > @@ -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
> >
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot



-- 

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] toolchain: introduce config options to include GCC's sanitation libraries
  2019-10-26 19:03   ` Matthew Weber
@ 2019-10-26 21:49     ` Markus Mayer
       [not found]     ` <CAGt4E5sGLJXAbqD7=L+=A9w=EOGVmw6hc1-M1XFj7pY79DGUZA@mail.gmail.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Markus Mayer @ 2019-10-26 21:49 UTC (permalink / raw)
  To: buildroot

On Sat, 26 Oct 2019 at 12:03, Matthew Weber <matthew.weber@collins.com> wrote:
>
> Markus,
>
> On Sat, Oct 26, 2019 at 1:29 PM Markus Mayer <mmayer@broadcom.com> wrote:
> >
> > Hi all,
> >
> > On Wed, 5 Jun 2019 at 14:42, Markus Mayer <mmayer@broadcom.com> wrote:
> > >
> > > 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.
> >
>
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [External] Re: [PATCH] toolchain: introduce config options to include GCC's sanitation libraries
       [not found]     ` <CAGt4E5sGLJXAbqD7=L+=A9w=EOGVmw6hc1-M1XFj7pY79DGUZA@mail.gmail.com>
@ 2019-10-27 19:17       ` Matthew Weber
  0 siblings, 0 replies; 5+ messages in thread
From: Matthew Weber @ 2019-10-27 19:17 UTC (permalink / raw)
  To: buildroot

Markus,


On Sat, Oct 26, 2019 at 4:48 PM Markus Mayer <markus.mayer@broadcom.com> wrote:
>
> On Sat, 26 Oct 2019 at 12:03, Matthew Weber <matthew.weber@collins.com> wrote:
> >
> > Markus,
> >
> > On Sat, Oct 26, 2019 at 1:29 PM Markus Mayer <mmayer@broadcom.com> wrote:
> > >
> > > Hi all,
> > >
> > > On Wed, 5 Jun 2019 at 14:42, Markus Mayer <mmayer@broadcom.com> wrote:
> > > >
> > > > 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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-27 19:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-05 21:41 [Buildroot] [PATCH] toolchain: introduce config options to include GCC's sanitation libraries Markus Mayer
2019-10-26 18:29 ` Markus Mayer
2019-10-26 19:03   ` Matthew Weber
2019-10-26 21:49     ` Markus Mayer
     [not found]     ` <CAGt4E5sGLJXAbqD7=L+=A9w=EOGVmw6hc1-M1XFj7pY79DGUZA@mail.gmail.com>
2019-10-27 19:17       ` [Buildroot] [External] " Matthew Weber

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.