Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot build kernel headers - pointer issue in subcmd-util.h #207

Open
jacobleclair opened this issue Jan 3, 2025 · 1 comment
Open
Labels
bug Something isn't working

Comments

@jacobleclair
Copy link

jacobleclair commented Jan 3, 2025

Describe the bug
A clear and concise description of what the bug is.

i can't build the kernel headers due to a pointer issue in subcmd-util.h. i was following #69 because i needed wifi to work.

To Reproduce
Steps to reproduce the behavior:

  1. follow these steps

Expected behavior
kernel headers built into a .deb package

Screenshots / Photos
If applicable, add screenshots or photos to help explain your problem.

(N/A here)

If you are reporting an issue with the build process, please run the scripts in debug mode by putting DEBUG=1 before the build commmand, like sudo DEBUG=1 ./build_complete.sh.

Target Chrome OS Device (please complete the following information):

  • Board Name (e.g. dedede): grunt
  • Device Name (e.g. drawcia) barla (hp chromebook 11a g8 ee)
  • Shimboot version (e.g. v1.0.1) latest

Build Device (please complete the following information):

  • OS: [e.g. Debian 12] ubuntu 24.04
  • Neofetch out [run neofetch --stdout and paste it here] i actually don't have access now :/ tell me if i need the output. but the image seems to work fine so i don't think this is relevant anyway.

Additional context

Add any other context about the problem here.

i was using issue 69 as a reference.

here's the console:

# everything went offscreen in konsole after running make oldconfig, so i'll replicate everything
# first:
# user@shimboot-grunt:~/kernel$ sudo apt-get install git-core make kernel-package bc nano
# [sudo] password for user:
# Reading package lists... Done
# Building dependency tree... Done
# Reading state information... Done
# Note, selecting 'git' instead of 'git-core'
# Package kernel-package is not available, but is referred to by another package.
# This may mean that the package is missing, has been obsoleted, or
# is only available from another source
#
# E: Package 'kernel-package' has no installation candidate
# user@shimboot-grunt:~/kernel$
#
# then uname -r
# 4.14.75-07801-g33ec60e0b6e9
# then i cloned, git clone https://chromium.googlesource.com/chromiumos/third_party/kernel -b factory-grunt-11164.135.B-chromeos-4.14
# then cd into kernel and git checkout 07801-g33ec60e0b6e9
# then i removed the dirty flag
# then i ran these:
# $ modprobe configs; zless /proc/config.gz
# $ cat /proc/config.gz | gunzip > ~/Downloads/base.config
#
# and then i renamed ./chromeos/config/base.config to ./chromeos/config/base.config.orig
# then i moved ~/Downloads/base.config to ./chromeos/config/base.config
# then i ran ./chromeos/scripts/prepareconfig chromeos-intel-pineview
# then finally i ran make oldconfig. this is what you can see below. tell me if i should rerun that command and show the other outputs.

.config:7023:warning: override: reassigning to symbol NET_FC
.config:7024:warning: override: reassigning to symbol NET_PACKET_ENGINE
.config:7025:warning: override: reassigning to symbol NET_SB1000
.config:7026:warning: override: reassigning to symbol NET_TULIP
.config:7027:warning: override: reassigning to symbol NET_VENDOR_3COM
.config:7028:warning: override: reassigning to symbol NET_VENDOR_ADAPTEC
.config:7029:warning: override: reassigning to symbol NET_VENDOR_AGERE
.config:7030:warning: override: reassigning to symbol NET_VENDOR_ALTEON
.config:7031:warning: override: reassigning to symbol NET_VENDOR_AMD
.config:7032:warning: override: reassigning to symbol NET_VENDOR_ATHEROS
.config:7033:warning: override: reassigning to symbol NET_VENDOR_BROCADE
.config:7034:warning: override: reassigning to symbol NET_VENDOR_CAVIUM
.config:7035:warning: override: reassigning to symbol NET_VENDOR_CHELSIO
.config:7036:warning: override: reassigning to symbol NET_VENDOR_CISCO
# i deleted most of this to make this more concise.
.config:7955:warning: override: reassigning to symbol SND_HDA_CODEC_CONEXANT
.config:7956:warning: override: reassigning to symbol SND_HDA_CODEC_REALTEK
.config:7957:warning: override: reassigning to symbol SND_HDA_CODEC_SI3054
.config:7958:warning: override: reassigning to symbol SND_HDA_CODEC_SIGMATEL
.config:7959:warning: override: reassigning to symbol SND_HDA_CODEC_VIA
.config:7963:warning: override: reassigning to symbol SND_HDA_POWER_SAVE_DEFAULT
.config:7967:warning: override: reassigning to symbol SND_SOC_ADAU7002
.config:7968:warning: override: reassigning to symbol SND_SOC_AMD_ACP
.config:7988:warning: override: reassigning to symbol SND_SOC_INTEL_SST_TOPLEVEL
.config:7989:warning: override: reassigning to symbol SND_SOC_MAX98373
.config:7990:warning: override: reassigning to symbol SND_SOC_MAX98927
.config:7995:warning: override: reassigning to symbol SND_SOC_SSM4567
.config:7997:warning: override: reassigning to symbol SND_SOC_TS3A227E
.config:7999:warning: override: reassigning to symbol SSB
.config:8000:warning: override: reassigning to symbol TCG_CR50
.config:8001:warning: override: reassigning to symbol TCG_CR50_I2C
.config:8002:warning: override: reassigning to symbol TCG_CR50_SPI
.config:8003:warning: override: reassigning to symbol THERMAL_GOV_BANG_BANG
.config:8096:warning: override: reassigning to symbol WLAN_VENDOR_INTEL
.config:8097:warning: override: reassigning to symbol WMI_BMOF
.config:8098:warning: override: reassigning to symbol X86_AMD_FREQ_SENSITIVITY
.config:8099:warning: override: reassigning to symbol X86_INTEL_LPSS
.config:8102:warning: override: reassigning to symbol X86_INTEL_PSTATE
.config:8103:warning: override: reassigning to symbol X86_MCE_AMD
.config:8104:warning: override: reassigning to symbol X86_MCE_INTEL
#
# configuration written to .config
#
user@shimboot-grunt:~/kernel$ make deb-pkg -j$(nproc --all)
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  UPD     include/config/kernel.release
make clean
  TAR     linux-4.14.75-15134-g33ec60e0b6e9.tar.gz
make KBUILD_SRC=
  SYSTBL  arch/x86/include/generated/asm/syscalls_32.h
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/bin2c
  CHK     include/config/kernel.release
  SYSHDR  arch/x86/include/generated/asm/unistd_32_ia32.h
  SYSHDR  arch/x86/include/generated/asm/unistd_64_x32.h
  SYSTBL  arch/x86/include/generated/asm/syscalls_64.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_32.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_64.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_x32.h
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  DESCEND  objtool
  HOSTCC   /home/user/kernel/tools/objtool/fixdep.o
  HOSTLD   /home/user/kernel/tools/objtool/fixdep-in.o
  LINK     /home/user/kernel/tools/objtool/fixdep
  CC       /home/user/kernel/tools/objtool/exec-cmd.o
  CC       /home/user/kernel/tools/objtool/help.o
  CC       /home/user/kernel/tools/objtool/pager.o
In file included from help.c:12:
In function ‘xrealloc’,
    inlined from ‘add_cmdname’ at help.c:24: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       /home/user/kernel/tools/objtool/parse-options.o
cc1: all warnings being treated as errors
mv: cannot stat '/home/user/kernel/tools/objtool/.help.o.tmp': No such file or directory
make[6]: *** [/home/user/kernel/tools/build/Makefile.build:97: /home/user/kernel/tools/objtool/help.o] Error 1
make[6]: *** Waiting for unfinished jobs....
make[5]: *** [Makefile:52: /home/user/kernel/tools/objtool/libsubcmd-in.o] Error 2
make[4]: *** [Makefile:54: /home/user/kernel/tools/objtool/libsubcmd.a] Error 2
make[3]: *** [Makefile:62: objtool] Error 2
make[2]: *** [Makefile:1658: tools/objtool] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [scripts/package/Makefile:87: deb-pkg] Error 2
make: *** [Makefile:1372: deb-pkg] Error 2
user@shimboot-grunt:~/kernel$ # so yeah, i have no clue why that's happening. i don't think it's a dependency problem or anything, because memory allocation issues would probably have nothing to do with that. so is it a problem with the code? it's really strange. i'll try changing the warning flag, but as you'll see it doesn't seem to do anything. i've tried compiling multiple times, multiple operating systems, multiple machines, even using an older version of debian, but nothing seems to work.
user@shimboot-grunt:~/kernel$ nano chromeos/config/base.config
user@shimboot-grunt:~/kernel$ # it said:
user@shimboot-grunt:~/kernel$ # Automatically generated file; DO NOT EDIT.
user@shimboot-grunt:~/kernel$ # whoops ¯\_(ツ)_/¯
user@shimboot-grunt:~/kernel$ # (btw i did it anyway, just to be clear)
user@shimboot-grunt:~/kernel$ make deb-pkg -j$(nproc --all)
  CHK     include/config/kernel.release
make clean
  TAR     linux-4.14.75-15134-g33ec60e0b6e9.tar.gz
make KBUILD_SRC=
  HOSTCC  scripts/basic/fixdep
  CHK     include/config/kernel.release
  HOSTCC  scripts/basic/bin2c
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  DESCEND  objtool
  HOSTCC   /home/user/kernel/tools/objtool/fixdep.o
  HOSTLD   /home/user/kernel/tools/objtool/fixdep-in.o
  LINK     /home/user/kernel/tools/objtool/fixdep
  CC       /home/user/kernel/tools/objtool/exec-cmd.o
  CC       /home/user/kernel/tools/objtool/help.o
  GEN      /home/user/kernel/tools/objtool/arch/x86/lib/inat-tables.c
  CC       /home/user/kernel/tools/objtool/arch/x86/decode.o
In file included from help.c:12:
In function ‘xrealloc’,
    inlined from ‘add_cmdname’ at help.c:24: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
mv: cannot stat '/home/user/kernel/tools/objtool/.help.o.tmp': No such file or directory
make[6]: *** [/home/user/kernel/tools/build/Makefile.build:96: /home/user/kernel/tools/objtool/help.o] Error 1
make[5]: *** [Makefile:52: /home/user/kernel/tools/objtool/libsubcmd-in.o] Error 2
make[4]: *** [Makefile:54: /home/user/kernel/tools/objtool/libsubcmd.a] Error 2
make[4]: *** Waiting for unfinished jobs....
  CC       /home/user/kernel/tools/objtool/builtin-check.o
  CC       /home/user/kernel/tools/objtool/builtin-orc.o
  CC       /home/user/kernel/tools/objtool/check.o
  LD       /home/user/kernel/tools/objtool/arch/x86/objtool-in.o
  CC       /home/user/kernel/tools/objtool/orc_gen.o
  CC       /home/user/kernel/tools/objtool/orc_dump.o
  CC       /home/user/kernel/tools/objtool/elf.o
  CC       /home/user/kernel/tools/objtool/special.o
  CC       /home/user/kernel/tools/objtool/objtool.o
  CC       /home/user/kernel/tools/objtool/libstring.o
  CC       /home/user/kernel/tools/objtool/str_error_r.o
  LD       /home/user/kernel/tools/objtool/objtool-in.o
make[3]: *** [Makefile:62: objtool] Error 2
make[2]: *** [Makefile:1658: tools/objtool] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [scripts/package/Makefile:87: deb-pkg] Error 2
make: *** [Makefile:1372: deb-pkg] Error 2
user@shimboot-grunt:~/kernel$
@jacobleclair jacobleclair added the bug Something isn't working label Jan 3, 2025
@ading2210
Copy link
Owner

Sometimes you need an older C compiler to compile these old kernels properly. Try something like gcc 10. Follow https://askubuntu.com/a/1229794, but use the Debian repository instead of Ubuntu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants