All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Kconfig warnings with GCC9
@ 2020-01-10 19:17 Markus Mayer
  2020-01-10 20:56 ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Mayer @ 2020-01-10 19:17 UTC (permalink / raw)
  To: buildroot

Hi all,

Using GCC9 (Ubuntu 19.10), I am getting some compiler warnings
(potential buffer overruns) in the Kconfig code. Is this a known
issue?

Looks like GCC9 is pickier (yet again) than older versions.

$ lsb_release  -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.10
Release: 19.10
Codename: eoan

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
9.2.1-9ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2
--prefix=/usr --with-gcc-major-version-only --program-suffix=-9
--program-prefix=x86_64-linux-gnu- --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib=auto --enable-multiarch
--disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-offload-targets=nvptx-none,hsa
--without-cuda-driver --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)

My latest BR commit is:

commit 84d471a0b150bc2ff1d08755d36be86d9380c2c5 (queue/master, master)
Author: Peter Korsgaard <peter@korsgaard.com>
Date:   Fri Jan 10 08:33:58 2020 +0100

    package/iputils: use relative symlink for ping6

    Fixes (part of):
    http://autobuild.buildroot.net/results/5659e1c91831921bd9ad6af670258783771b4dc8/

$ mkdir -p output/rpi
$ make O="/storage/Development/br-current/output/rpi" raspberrypi4_defconfig
mkdir -p /storage/Development/br-current/output/rpi/build/buildroot-config/lxdialog
PKG_CONFIG_PATH="" make CC="/usr/bin/gcc" HOSTCC="/usr/bin/gcc" \
    obj=/storage/Development/br-current/output/rpi/build/buildroot-config
-C support/kconfig -f Makefile.br conf
/usr/bin/gcc -DCURSES_LOC="<curses.h>" -DLOCALE
-I/storage/Development/br-current/output/rpi/build/buildroot-config
-DCONFIG_=\"\"  -MM *.c >
/storage/Development/br-current/output/rpi/build/buildroot-config/.depend
2>/dev/null || :
/usr/bin/gcc -DCURSES_LOC="<curses.h>" -DLOCALE
-I/storage/Development/br-current/output/rpi/build/buildroot-config
-DCONFIG_=\"\"   -c conf.c -o
/storage/Development/br-current/output/rpi/build/buildroot-config/conf.o
/usr/bin/gcc -DCURSES_LOC="<curses.h>" -DLOCALE
-I/storage/Development/br-current/output/rpi/build/buildroot-config
-DCONFIG_=\"\"  -I. -c
/storage/Development/br-current/output/rpi/build/buildroot-config/zconf.tab.c
-o /storage/Development/br-current/output/rpi/build/buildroot-config/zconf.tab.o
In file included from
/storage/Development/br-current/output/rpi/build/buildroot-config/zconf.tab.c:2484:
./util.c: In function ?file_write_dep?:
./util.c:54:18: warning: ?..config.tmp? directive writing 12 bytes
into a region of size between 1 and 4097 [-Wformat-overflow=]
   54 |  sprintf(buf, "%s..config.tmp", dir);
      |                  ^~~~~~~~~~~~
./util.c:54:2: note: ?sprintf? output between 13 and 4109 bytes into a
destination of size 4097
   54 |  sprintf(buf, "%s..config.tmp", dir);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/storage/Development/br-current/output/rpi/build/buildroot-config/zconf.tab.c:2485:
./confdata.c: In function ?conf_write?:
./confdata.c:778:23: warning: ?.tmpconfig.? directive writing 11 bytes
into a region of size between 1 and 4097 [-Wformat-overflow=]
  778 |   sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
      |                       ^~~~~~~~~~~
./confdata.c:778:3: note: ?sprintf? output between 13 and 4119 bytes
into a destination of size 4097
  778 |   sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./confdata.c: In function ?conf_write_autoconf?:
./confdata.c:989:18: warning: ?.config.cmd? directive writing 11 bytes
into a region of size between 1 and 4097 [-Wformat-overflow=]
  989 |  sprintf(buf, "%s.config.cmd", dir);
      |                  ^~~~~~~~~~~
./confdata.c:989:2: note: ?sprintf? output between 12 and 4108 bytes
into a destination of size 4097
  989 |  sprintf(buf, "%s.config.cmd", dir);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./confdata.c:995:18: warning: ?.tmpconfig? directive writing 10 bytes
into a region of size between 1 and 4097 [-Wformat-overflow=]
  995 |  sprintf(buf, "%s.tmpconfig", dir);
      |                  ^~~~~~~~~~
./confdata.c:995:2: note: ?sprintf? output between 11 and 4107 bytes
into a destination of size 4097
  995 |  sprintf(buf, "%s.tmpconfig", dir);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./confdata.c:1000:18: warning: ?.tmpconfig_tristate? directive writing
19 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
 1000 |  sprintf(buf, "%s.tmpconfig_tristate", dir);
      |                  ^~~~~~~~~~~~~~~~~~~
./confdata.c:1000:2: note: ?sprintf? output between 20 and 4116 bytes
into a destination of size 4097
 1000 |  sprintf(buf, "%s.tmpconfig_tristate", dir);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./confdata.c:1007:18: warning: ?.tmpconfig.h? directive writing 12
bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
 1007 |  sprintf(buf, "%s.tmpconfig.h", dir);
      |                  ^~~~~~~~~~~~
./confdata.c:1007:2: note: ?sprintf? output between 13 and 4109 bytes
into a destination of size 4097
 1007 |  sprintf(buf, "%s.tmpconfig.h", dir);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./confdata.c:1040:18: warning: ?.tmpconfig.h? directive writing 12
bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
 1040 |  sprintf(buf, "%s.tmpconfig.h", dir);
      |                  ^~~~~~~~~~~~
./confdata.c:1040:2: note: ?sprintf? output between 13 and 4109 bytes
into a destination of size 4097
 1040 |  sprintf(buf, "%s.tmpconfig.h", dir);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./confdata.c:1046:18: warning: ?.tmpconfig_tristate? directive writing
19 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
 1046 |  sprintf(buf, "%s.tmpconfig_tristate", dir);
      |                  ^~~~~~~~~~~~~~~~~~~
./confdata.c:1046:2: note: ?sprintf? output between 20 and 4116 bytes
into a destination of size 4097
 1046 |  sprintf(buf, "%s.tmpconfig_tristate", dir);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./confdata.c:1054:18: warning: ?.tmpconfig? directive writing 10 bytes
into a region of size between 1 and 4097 [-Wformat-overflow=]
 1054 |  sprintf(buf, "%s.tmpconfig", dir);
      |                  ^~~~~~~~~~
./confdata.c:1054:2: note: ?sprintf? output between 11 and 4107 bytes
into a destination of size 4097
 1054 |  sprintf(buf, "%s.tmpconfig", dir);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/gcc -DCURSES_LOC="<curses.h>" -DLOCALE
-I/storage/Development/br-current/output/rpi/build/buildroot-config
-DCONFIG_=\"\"
/storage/Development/br-current/output/rpi/build/buildroot-config/conf.o
/storage/Development/br-current/output/rpi/build/buildroot-config/zconf.tab.o
 -o /storage/Development/br-current/output/rpi/build/buildroot-config/conf
rm /storage/Development/br-current/output/rpi/build/buildroot-config/zconf.tab.c
  GEN     /storage/Development/br-current/output/rpi/Makefile
#
# configuration written to /storage/Development/br-current/output/rpi/.config
#

Regards,
-Markus

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

* [Buildroot] Kconfig warnings with GCC9
  2020-01-10 19:17 [Buildroot] Kconfig warnings with GCC9 Markus Mayer
@ 2020-01-10 20:56 ` Thomas Petazzoni
  2020-01-10 22:35   ` Markus Mayer
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2020-01-10 20:56 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 10 Jan 2020 11:17:47 -0800
Markus Mayer <mmayer@broadcom.com> wrote:

> Hi all,
> 
> Using GCC9 (Ubuntu 19.10), I am getting some compiler warnings
> (potential buffer overruns) in the Kconfig code. Is this a known
> issue?

You can try to update the kconfig code in Buildroot with the kconfig
code available from the latest kernel, and see if it fixes the
warnings. We're currently using the kconfig code from 4.17-rc2 it seems.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] Kconfig warnings with GCC9
  2020-01-10 20:56 ` Thomas Petazzoni
@ 2020-01-10 22:35   ` Markus Mayer
  2020-01-11  8:32     ` Peter Korsgaard
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Mayer @ 2020-01-10 22:35 UTC (permalink / raw)
  To: buildroot

On Fri, 10 Jan 2020 at 12:56, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Fri, 10 Jan 2020 11:17:47 -0800
> Markus Mayer <mmayer@broadcom.com> wrote:
>
> > Hi all,
> >
> > Using GCC9 (Ubuntu 19.10), I am getting some compiler warnings
> > (potential buffer overruns) in the Kconfig code. Is this a known
> > issue?
>
> You can try to update the kconfig code in Buildroot with the kconfig
> code available from the latest kernel, and see if it fixes the
> warnings. We're currently using the kconfig code from 4.17-rc2 it seems.

I'll give it a shot.

Regards,
-Markus

> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

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

* [Buildroot] Kconfig warnings with GCC9
  2020-01-10 22:35   ` Markus Mayer
@ 2020-01-11  8:32     ` Peter Korsgaard
  2020-01-11 17:59       ` Markus Mayer
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Korsgaard @ 2020-01-11  8:32 UTC (permalink / raw)
  To: buildroot

>>>>> "Markus" == Markus Mayer <mmayer@broadcom.com> writes:

 > On Fri, 10 Jan 2020 at 12:56, Thomas Petazzoni
 > <thomas.petazzoni@bootlin.com> wrote:
 >> 
 >> Hello,
 >> 
 >> On Fri, 10 Jan 2020 11:17:47 -0800
 >> Markus Mayer <mmayer@broadcom.com> wrote:
 >> 
 >> > Hi all,
 >> >
 >> > Using GCC9 (Ubuntu 19.10), I am getting some compiler warnings
 >> > (potential buffer overruns) in the Kconfig code. Is this a known
 >> > issue?
 >> 
 >> You can try to update the kconfig code in Buildroot with the kconfig
 >> code available from the latest kernel, and see if it fixes the
 >> warnings. We're currently using the kconfig code from 4.17-rc2 it seems.

 > I'll give it a shot.

Before doing that, try running make menuconfig with a recent Linux
kernel to check if those warnings are no longer triggered.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] Kconfig warnings with GCC9
  2020-01-11  8:32     ` Peter Korsgaard
@ 2020-01-11 17:59       ` Markus Mayer
       [not found]         ` <CAGt4E5vMQgJKAKfFgr7oUmMJjyDufB72L7VVUgS-UGg8g6c+_A@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Mayer @ 2020-01-11 17:59 UTC (permalink / raw)
  To: buildroot

On Sat, 11 Jan 2020 at 00:32, Peter Korsgaard <peter@korsgaard.com> wrote:
>  > On Fri, 10 Jan 2020 at 12:56, Thomas Petazzoni
>  > <thomas.petazzoni@bootlin.com> wrote:
>  >>
>  >> Hello,
>  >>
>  >> On Fri, 10 Jan 2020 11:17:47 -0800
>  >> Markus Mayer <mmayer@broadcom.com> wrote:
>  >>
>  >> > Hi all,
>  >> >
>  >> > Using GCC9 (Ubuntu 19.10), I am getting some compiler warnings
>  >> > (potential buffer overruns) in the Kconfig code. Is this a known
>  >> > issue?
>  >>
>  >> You can try to update the kconfig code in Buildroot with the kconfig
>  >> code available from the latest kernel, and see if it fixes the
>  >> warnings. We're currently using the kconfig code from 4.17-rc2 it seems.
>
>  > I'll give it a shot.
>
> Before doing that, try running make menuconfig with a recent Linux
> kernel to check if those warnings are no longer triggered.

That's kernel 5.4. Kconfig itself complains about a few Kconfig values
for my stock kernel (maybe because that's 5.3?), but the compiler is
fine. So we should be good.

$ make menuconfig
  HOSTCC  scripts/basic/fixdep
  UPD     scripts/kconfig/mconf-cfg
  HOSTCC  scripts/kconfig/mconf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf  Kconfig
#
# using defaults found in /boot/config-5.3.0-26-generic
#
/boot/config-5.3.0-26-generic:8195:warning: symbol value 'm' invalid for ASHMEM
/boot/config-5.3.0-26-generic:8460:warning: symbol value 'm' invalid
for REMOTEPROC
/boot/config-5.3.0-26-generic:9141:warning: symbol value 'm' invalid
for ANDROID_BINDER_IPC
/boot/config-5.3.0-26-generic:9142:warning: symbol value 'm' invalid
for ANDROID_BINDERFS

Also, comparing the config sources, there are changes like these,
which remove the code that produces the warnings.

$ diff -u br-current/support/kconfig/confdata.c linux/scripts/kconfig/confdata.c
[...]
-       sprintf(buf, "%s.tmpconfig", dir);
-       out = fopen(buf, "w");
+       out = fopen(".tmpconfig", "w");
        if (!out)
                return 1;

-       sprintf(buf, "%s.tmpconfig_tristate", dir);
-       tristate = fopen(buf, "w");
+       tristate = fopen(".tmpconfig_tristate", "w");
        if (!tristate) {
                fclose(out);
                return 1;
        }

-       sprintf(buf, "%s.tmpconfig.h", dir);
-       out_h = fopen(buf, "w");
+       out_h = fopen(".tmpconfig.h", "w");
        if (!out_h) {
                fclose(out);
                fclose(tristate);
[...]

Regards,
-Markus

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

* [Buildroot] Kconfig warnings with GCC9
       [not found]         ` <CAGt4E5vMQgJKAKfFgr7oUmMJjyDufB72L7VVUgS-UGg8g6c+_A@mail.gmail.com>
@ 2020-02-06 20:22           ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2020-02-06 20:22 UTC (permalink / raw)
  To: buildroot

Hello Markus,

On Thu, 6 Feb 2020 10:30:28 -0800
Markus Mayer <markus.mayer@broadcom.com> wrote:

> > That's kernel 5.4. Kconfig itself complains about a few Kconfig values
> > for my stock kernel (maybe because that's 5.3?), but the compiler is
> > fine. So we should be good.  
> 
> Okay. I poked around some more. Turns out that kconfig on the Linux
> side changed *a lot* between 4.17-rc2 and 5.5. Many files were
> renamed. A good number of functions was rewritten (partially precisely
> to avoid the format-overflow warnings). The easiest approach might
> just be to take the Linux kconfig implementation as is and re-apply
> the Buildroot customizations on top of the new implementation rather
> than trying to merge in all the changes from Linux and risking
> breakage by doing that incorrectly.

This easiest approach is what we do every time we update the Kconfig
code in Buildroot.

> Is there an easy-ish way to see all the customizations that Buildroot
> did to kconfig over the years (excluding code changes imported from
> Linux during past kconfig upgrades)?

See support/kconfig/patches/ and support/kconfig/README.buildroot.

Looking forward to the bump of our Kconfig code base!

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2020-02-06 20:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10 19:17 [Buildroot] Kconfig warnings with GCC9 Markus Mayer
2020-01-10 20:56 ` Thomas Petazzoni
2020-01-10 22:35   ` Markus Mayer
2020-01-11  8:32     ` Peter Korsgaard
2020-01-11 17:59       ` Markus Mayer
     [not found]         ` <CAGt4E5vMQgJKAKfFgr7oUmMJjyDufB72L7VVUgS-UGg8g6c+_A@mail.gmail.com>
2020-02-06 20:22           ` Thomas Petazzoni

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.