lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 22 Aug 2022 09:45:28 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Dmitrii Bundin <dmitrii.bundin.a@...il.com>
Cc:     Masahiro Yamada <masahiroy@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Dan Williams <dan.j.williams@...el.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Isabella Basso <isabbasso@...eup.net>,
        Josh Poimboeuf <jpoimboe@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Fangrui Song <maskray@...gle.com>,
        Michal Marek <michal.lkml@...kovi.net>,
        Nathan Chancellor <nathan@...nel.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Vlastimil Babka <vbabka@...e.cz>
Subject: Re: [PATCH v3] kbuild: add debug level and macro defs options

On Fri, Aug 19, 2022 at 3:52 PM Dmitrii Bundin
<dmitrii.bundin.a@...il.com> wrote:
>
> On Fri, Aug 19, 2022 at 8:42 PM Nick Desaulniers
> <ndesaulniers@...gle.com> wrote:
> >
> > Is any of this really necessary?
>
> Consider the case if CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y.
> Prior to GCC11/Clang12 -gsplit-dwarf implied -g2. So on newer
> compilers with -gsplit-dwarf in use there would be no debug symbols
> produced.

```
diff --git a/scripts/Makefile.debug b/scripts/Makefile.debug
index 9f39b0130551..a881954c1382 100644
--- a/scripts/Makefile.debug
+++ b/scripts/Makefile.debug
@@ -1,7 +1,7 @@
 DEBUG_CFLAGS   :=

 ifdef CONFIG_DEBUG_INFO_SPLIT
-DEBUG_CFLAGS   += -gsplit-dwarf
+DEBUG_CFLAGS   += -gsplit-dwarf -g2
 else
 DEBUG_CFLAGS   += -g
 endif
```

or perhaps that simply needs to be `-g -gsplit-dwarf`?  In which case,
that if/else could just be re-arranged.

> -gdwarf-4/5 still implies -g2, but in case
> CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y neither of the options are
> set.

-g is set, which has an implicit default level.

> So it seems like a reasonable choice to provide a debug info
> level config that would explicitly set the level without relying on
> implicits. The default value of the config is set to -g2 to not change
> the build behavior that was before introducing the option. And it
> works for both older and newer versions of GCC/Clang in the same way.
> The benefits of the -g1 option are indeed questionable except that it
> produces an image with ~20% less in size.

Until there's a concrete need, YAGNI.

>
> > It seems like a great way to bloat
> > vmlinux artifacts built with CONFIG_DEBUG_INFO even further.
> The defaults were chosen to not change the build behavior that was
> before introducing the options. Or did you mean something else?
>
> > The
> > above link mentions "when debugging with GDB."  In that case, please
> > don't add new Kconfigs for these; just set -g3 when
> > CONFIG_GDB_SCRIPTS=y.
>
> CONFIG_GDB_SCRIPTS does not necessarily mean that -g3 is wanted, -g2
> (default) is usually a reasonable choice. The -g3 option is very
> useful when debugging macro-intensive code, but requires much more
> disk space to build. I documented it explicitly in the help section of
> DEBUG_INFO_LEVEL. GCC and Clang use different options to include macro
> definitions so it was handled depending on the compiler used.

Honestly, I really don't think we need to be wrapping every compiler
command line flag under the sun in a kconfig option.

-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ