The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Vladimir Murzin <vladimir.murzin@arm.com>
To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Cc: Michal Marek <michal.lkml@markovi.net>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Vladimir Murzin <Vladimir.Murzin@arm.com>,
	arnd@arndb.de
Subject: Possible regression due to 269a535ca931 "modpost: generate vmlinux.symvers and reuse it for the second modpost"
Date: Thu, 4 Mar 2021 16:21:40 +0000	[thread overview]
Message-ID: <42e0adf2-dbf5-9c1b-a18d-05bf5f1960a1@arm.com> (raw)

Hi,

Recently, I had to dig awkward build issue for external module (originally with ARCH=arm)
like

MODPOST module/path/Module.symvers
ERROR: modpost: "__put_user_1" [module/path/name.ko] undefined!
ERROR: modpost: "__aeabi_unwind_cpp_pr0" [/module/path/name.ko] undefined!

and it looks like it is happening due to

269a535ca931 "modpost: generate vmlinux.symvers and reuse it for the second modpost"

Here is result of my investigation (with ARCH=arm64)

$ git describe
v5.7-rc5-72-g269a535
# Start with clean build
$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 mrproper
$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 defconfig
$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 -j5 > /dev/null
$ cp vmlinux.symvers vmlinux.symvers.defconfig
$ cp Module.symvers Module.symvers.defconfig
# Alter configuration
$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 allnoconfig
$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 -j5 > /dev/null
$ cp vmlinux.symvers vmlinux.symvers.allnoconfig
$ cp Module.symvers Module.symvers.allnoconfig
$ diff vmlinux.symvers.defconfig vmlinux.symvers.allnoconfig > /dev/null
$ echo $?
1
$ diff Module.symvers.defconfig Module.symvers.allnoconfig > /dev/null
$ echo $?
0

So, Module.sysver not reflecting changes in configuration, yet IIUC it
it supposed to include vmlinux.symvers

If you are lucky enough with stale Module.symver there is a chance to
fail build of external module in very awkward way

Obviously

$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 mrproper
$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 allnoconfig
$ ls *.symvers
vmlinux.symvers

With that external module build would splat

WARNING: Symbol version dump "Module.symvers" is missing.
         Modules may not have dependencies or modversions.

Also, there are several reports on user forums describing
symptoms which could be due to the issue, with workarounds
like "enable random in-tree module" or/and "create empty
Module.symvers"

One commit before 269a535ca931 "modpost: generate vmlinux.symvers and reuse it for the second modpost"

$ git describe
v5.7-rc5-71-gf1005b3
# Start with clean build
$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 mrproper
# Build defconfig
$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 defconfig
$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 -j5 > /dev/null
$ cp Module.symvers Module.symvers.defconfig
# Alter configuration
$ CROSS_COMPILE=make ARCH=arm64 allnoconfig
$ cp Module.symvers Module.symvers.allnoconfig
$ diff Module.symvers.defconfig Module.symvers.allnoconfig > /dev/null
$ echo $?
1

As you can see Module.symvers gets updated

$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 mrproper
$ CROSS_COMPILE=aarch64-none-linux-gnu- make ARCH=arm64 allnoconfig
$ CROSS_COMPILE=make ARCH=arm64 -j5 > /dev/null
$ ls *.symvers
Module.symvers

As you can see Modeule.symver gets created

Does that make sense? What I'm missing?

P.S.
I've also checked v5.12-rc1 and see the same symptoms

Cheers
Vladimir

             reply	other threads:[~2021-03-04 16:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 16:21 Vladimir Murzin [this message]
2021-03-04 17:24 ` Possible regression due to 269a535ca931 "modpost: generate vmlinux.symvers and reuse it for the second modpost" Masahiro Yamada
2021-03-05 14:15   ` Vladimir Murzin
2021-03-05 14:33     ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42e0adf2-dbf5-9c1b-a18d-05bf5f1960a1@arm.com \
    --to=vladimir.murzin@arm.com \
    --cc=arnd@arndb.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox