Bug 14826 - make qemu_x86_64_defconfig stopped working
Summary: make qemu_x86_64_defconfig stopped working
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2022.02.2
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: Yann E. MORIN
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-30 19:41 UTC by buildroot
Modified: 2022-06-04 08:24 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments
linux: don't build host tools with -Werror (1.07 KB, patch)
2022-05-31 12:15 UTC, Yann E. MORIN
Details

Note You need to log in before you can comment on or make changes to this bug.
Description buildroot 2022-05-30 19:41:01 UTC
Runnning

make qemu_x86_64_defconfig; make clean all

has stopped working for me. I get the following compilation error:



In file included from sigchain.c:3:
In function 'xrealloc',
    inlined from 'sigchain_push.isra' at sigchain.c:26:2:
subcmd-util.h:56:23: error: pointer may be used after 'realloc' [-Werror=use-after-free]
   56 |                 ret = realloc(ptr, size);
      |                       ^~~~~~~~~~~~~~~~~~
subcmd-util.h:52:21: note: call to 'realloc' here
   52 |         void *ret = realloc(ptr, size);
      |                     ^~~~~~~~~~~~~~~~~~
subcmd-util.h:58:31: error: pointer may be used after 'realloc' [-Werror=use-after-free]
   58 |                         ret = realloc(ptr, 1);
      |                               ^~~~~~~~~~~~~~~
subcmd-util.h:52:21: note: call to 'realloc' here
   52 |         void *ret = realloc(ptr, size);
      |                     ^~~~~~~~~~~~~~~~~~
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  CC      scripts/mod/devicetable-offsets.s
In function 'xrealloc',
    inlined from 'sigchain_push' at sigchain.c:26:2,
    inlined from 'sigchain_push_common' at sigchain.c:53:2:
subcmd-util.h:56:23: error: pointer may be used after 'realloc' [-Werror=use-after-free]
   56 |                 ret = realloc(ptr, size);
      |                       ^~~~~~~~~~~~~~~~~~
subcmd-util.h:52:21: note: call to 'realloc' here
   52 |         void *ret = realloc(ptr, size);
      |                     ^~~~~~~~~~~~~~~~~~
subcmd-util.h:58:31: error: pointer may be used after 'realloc' [-Werror=use-after-free]
   58 |                         ret = realloc(ptr, 1);
      |                               ^~~~~~~~~~~~~~~
subcmd-util.h:52:21: note: call to 'realloc' here
   52 |         void *ret = realloc(ptr, size);
      |                     ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Comment 1 Yann E. MORIN 2022-05-30 22:04:02 UTC
Hello,

I am afraid I was not able to reproduce the failure.

From a clean checkout of git master (d590003), I did:

    make qemu_x86_64_defconfig
    make

And the build succeeded.

What version of Buildroot are you using?
What system are you building on?

Regards,
Yann E. MORIN.
Comment 2 buildroot 2022-05-30 23:40:55 UTC
I'd say that's good news. I just tried master and it doesn't work either.

A system update just broke something on my end. I'm using Arch on kernel 5.17.9.

Is there a recommended distro to use for building buildroot?
Comment 3 buildroot 2022-05-30 23:41:54 UTC
I'd say that's good news. I just tried master and it doesn't work either.

A system update just broke something on my end. I'm using Arch on kernel 5.17.9.

Is there a recommended distro to use for building buildroot?

EDIT: **A system update probably broke something on my end
Comment 4 Yann E. MORIN 2022-05-31 09:28:38 UTC
Hello,

This issue is caused by a gcc-12 extra check about use-after-free,
which has been fixed in the kernel with:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=52a9dab6d892763b2a8334a568bd4e2c1a6fde66

You hit this issue because Archlinux is now using gcc-12.1.0 as the
default compiler, and because the kernel uses -Werror to build that
host tool.

So, either update your kernel to one that has the fix, or backport it
yourself, or downgrade your compiler to a (slightly) older one.

Regards,
Yann E. MORIN.
Comment 5 Yann E. MORIN 2022-05-31 12:15:18 UTC
Created attachment 9316 [details]
linux: don't build host tools with -Werror

Hello,

Can you please try this patch, and report the result?

If that works for you, I'll submit a proper patch later.

Regards,
Yann E. MORIN.
Comment 6 buildroot 2022-05-31 17:48:30 UTC
Thanks for figuring this out! I can confirm that the patch works on master, commit eb5e2d2d43c5c0f71ae8243081625261de2cd134.

Bit of a tangential question: is there an easy way to see what kernel version commit 52a9dab6d892763b2a8334a568bd4e2c1a6fde66 would have made it into?

Thanks again!
Comment 7 Yann E. MORIN 2022-06-04 08:24:42 UTC
All,

Thanks for the report. We believe this has now been fixed with commit
baa55a4e26e6 (linux: disable -Werror when building host tools) that has
just been applied to master.

Regards,
Yann E. MORIN.