Created attachment 4206 [details] diffoscope output comparing two builds. Building the same modules in two different folders at two different times results in about 15 different kernel-module-lttng packages having different srcversions (please see the attached file). This makes no sense, as the source code for the modules should be identical, hence the srcversion as well. This was only observed with meta-intel, without meta-intel the srcversion seems to be always the same.
This potentially affects all kernel modules, (problem is not to meta-intel specific, not lttng modules specific). If the build directory name is rather long, some files are basically skipped from checksum calculation. If the folder names are kept short, no problems are observed. Now that I can reproduce this, finding the culprit should be straightforward.
So I found the root cause (scripts/modpost.c - get_next_line): if a file line is longer than 4096 bytes, it is silently ignored. This is later on interpreted as EOF. The consequence being some source files are skipped and do not contribute to srcversion checksum. Sent a patch to kernel build mailing list: https://patchwork.kernel.org/patch/10318141/
Patch sent to ML: https://patchwork.openembedded.org/patch/149757/
http://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto/commit/?h=v4.15/standard/base&id=91084d030bc841c483c31e8664289c7940aa5506