bugmake - Bugs: bug #63818, V=1 stopped working for Linux...

 
 

bug #63818: V=1 stopped working for Linux kernel module builds with make-4.4

Submitter:  Martin Dorey <mdorey>
Submitted:  Sun 19 Feb 2023 07:59:36 PM UTC
   
 
Severity:  3 - Normal Item Group:  Documentation
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.4 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 19 Feb 2023 07:59:36 PM UTC, original submission:  

As reported by Jan Palus in https://lists.gnu.org/archive/html/bug-make/2022-11/msg00185.html with the diagnosis polished by Paul in reply, the Linux kernel build system goes into silent mode, stopping V=1 from telling you eg about the compiler commands, with make-4.4 (but not earlier), if an s is present in certain parts of the command line.  When compiling modules, this is more likely than it might seem, because an argument of the form M=$(CURDIR) is given to make and s is common in directory names.

This was fixed in the Linux kernel build system by Dmitry with help from Masahiro Yamada for v6.2-rc1 (https://github.com/torvalds/linux/commit/4bf73588165ba7d32131a043775557a54b6e1db5).  I think the problem arrived with v4.13-rc1 (https://github.com/torvalds/linux/commit/6f0fa58e459642b16901521cc58ac474b787ec5b).  To put that in Debian terms, that means that Buster, Bullseye and (likely) Bookworm are afflicted.

Here's a complete example, derived from https://sysprog21.github.io/lkmpg/ but with the Makefile simplified the way I would have written it and a stray quote left deliberately at the end of the .c file:


martind@pizzagate:~/tmp/make-kernel-MAKEFLAGS-with-an-s$ cat Makefile
obj-m += hello-1.o

KVERSION ?= $(shell uname -r)
KVERSION := $(KVERSION)

TARGETS = modules clean
.PHONY: $(TARGETS)
$(TARGETS): %:; $(MAKE) -C /lib/modules/$(KVERSION)/build M=$(CURDIR) $@
martind@pizzagate:~/tmp/make-kernel-MAKEFLAGS-with-an-s$ cat hello-1.c
/*
 * hello-1.c - The simplest kernel module.
 */
#include <linux/kernel.h> /* Needed for pr_info() */
#include <linux/module.h> /* Needed by all modules */

int init_module(void)
{
    pr_info("Hello world 1.\n");

    /* A non 0 return means init_module failed; module can't be loaded. */
    return 0;
}

void cleanup_module(void)
{
    pr_info("Goodbye world 1.\n");
}

MODULE_LICENSE("GPL");
"
martind@pizzagate:~/tmp/make-kernel-MAKEFLAGS-with-an-s$


This is what the problem looks like:


martind@pizzagate:~/tmp/make-kernel-MAKEFLAGS-with-an-s$ ~/download/make-4.4/make V=1
/home/martind/download/make-4.4/make -C /lib/modules/4.19.0-21-amd64/build M=/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s modules
make[1]: Entering directory '/usr/src/linux-headers-4.19.0-21-amd64'
/home/martind/download/make-4.4/make -C /usr/src/linux-headers-4.19.0-21-amd64 KBUILD_SRC=/usr/src/linux-headers-4.19.0-21-common \
-f /usr/src/linux-headers-4.19.0-21-common/Makefile modules
mkdir -p /home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/.tmp_versions ; rm -f /home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/.tmp_versions/*
/home/martind/download/make-4.4/make -f /usr/src/linux-headers-4.19.0-21-common/scripts/Makefile.build obj=/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s
(cat /dev/null;   echo kernel//home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/hello-1.ko;) > /home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/modules.order
/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/hello-1.c:21:1: warning: missing terminating " character
 "
 ^
/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/hello-1.c:21:1: error: missing terminating " character
make[4]: *** [/usr/src/linux-headers-4.19.0-21-common/scripts/Makefile.build:315: /home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/hello-1.o] Error 1
make[3]: *** [/usr/src/linux-headers-4.19.0-21-common/Makefile:1561: _module_/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s] Error 2
make[2]: *** [Makefile:146: sub-make] Error 2
make[1]: *** [Makefile:8: all] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.19.0-21-amd64'
make: *** [Makefile:8: modules] Error 2
martind@pizzagate:~/tmp/make-kernel-MAKEFLAGS-with-an-s$


The one new piece of information I want to present with this not-really-a-bug report is the work around of adding quiet= to the command line, which then adds the gcc line to the output:


martind@pizzagate:~/tmp/make-kernel-MAKEFLAGS-with-an-s$ ~/download/make-4.4/make V=1 quiet=
/home/martind/download/make-4.4/make -C /lib/modules/4.19.0-21-amd64/build M=/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s modules
make[1]: Entering directory '/usr/src/linux-headers-4.19.0-21-amd64'
/home/martind/download/make-4.4/make -C /usr/src/linux-headers-4.19.0-21-amd64 KBUILD_SRC=/usr/src/linux-headers-4.19.0-21-common \
-f /usr/src/linux-headers-4.19.0-21-common/Makefile modules
mkdir -p /home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/.tmp_versions ; rm -f /home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/.tmp_versions/*
/home/martind/download/make-4.4/make -f /usr/src/linux-headers-4.19.0-21-common/scripts/Makefile.build obj=/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s
(cat /dev/null;   echo kernel//home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/hello-1.ko;) > /home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/modules.order
   gcc-8 -Wp,-MD,/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/.hello-1.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/8/include -I/usr/src/linux-headers-4.19.0-21-common/arch/x86/include -I./arch/x86/include/generated  -I/usr/src/linux-headers-4.19.0-21-common/include -I./include -I/usr/src/linux-headers-4.19.0-21-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-4.19.0-21-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-4.19.0-21-common/include/linux/kconfig.h -include /usr/src/linux-headers-4.19.0-21-common/include/linux/compiler_types.h  -I/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s -I/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Werror=return-type -Wno-format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-heade
/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/hello-1.c:21:1: warning: missing terminating " character
 "
 ^
/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/hello-1.c:21:1: error: missing terminating " character
make[4]: *** [/usr/src/linux-headers-4.19.0-21-common/scripts/Makefile.build:315: /home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s/hello-1.o] Error 1
make[3]: *** [/usr/src/linux-headers-4.19.0-21-common/Makefile:1561: _module_/home/martind/tmp/make-kernel-MAKEFLAGS-with-an-s] Error 2
make[2]: *** [Makefile:146: sub-make] Error 2
make[1]: *** [Makefile:8: all] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.19.0-21-amd64'
make: *** [Makefile:8: modules] Error 2
martind@pizzagate:~/tmp/make-kernel-MAKEFLAGS-with-an-s$


This was accepted as a Linux kernel build system bug rather than a Make bug, so there's nothing to do here, but I for one will likely have to compile modules for the afflicted kernels for years yet, so I thought the work around was worth sharing.  Bug #63347 didn't seem like the ideal place.  I guess the mailing list archives are sufficiently durable and I could probably have replied to the old thread without spamming the wrong bug.

Martin Dorey <mdorey>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mdorey (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code