NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/55731: (custom) kernel build failure with ``no options PTRACE''



>Number:         55731
>Category:       kern
>Synopsis:       (custom) kernel fails when certain options are removed
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 18 13:45:00 +0000 2020
>Originator:     Paul Goyette
>Release:        NetBSD 9.99.73
>Organization:
+--------------------+--------------------------+-----------------------+
| Paul Goyette       | PGP Key fingerprint:     | E-mail addresses:     |
| (Retired)          | FA29 0E3B 35AF E8AE 6651 | paul%whooppee.com@localhost     |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoyette%netbsd.org@localhost   |
+--------------------+--------------------------+-----------------------+
>Environment:
	
	
System: NetBSD speedy.whooppee.com 9.99.73 NetBSD 9.99.73 (SPEEDY 2020-09-19 19:15:42 UTC) #0: Sat Sep 19 21:45:32 UTC 2020 paul%speedy.whooppee.com@localhost:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY amd64
Architecture: x86_64
Machine: amd64
>Description:
	Recent changes in 9.99.74 have broken the build for kernels which
	do not include the PTRACE, COREDUMP, EXEC_ELF32, and EXEC_ELF64
	options.  (Note that the exec_elf32 and exec_elf64 modules are
	expected to be autoloaded as needed;  kernels prior to 2020-10-16
	at 13:18:24 UTC work fine with the same set of kernel options and
	modules.)  The build fails with the folllowing errors:
	#      link  SPEEDY/netbsd
	/build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-ld -Map netbsd.map --cref -T netbsd.ldscript -Ttext 0xffffffff80200000 -e start -z max-page-size=0x200000 -X -o netbsd ${SYSTEM_OBJ:[@]:Nswapnetbsd.o} ${EXTRA_OBJ} vers.o swapnetbsd.o
	/build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-ld: process_machdep.o: in function `ptrace_machdep_dorequest':
	/build/netbsd-local/src/sys/arch/amd64/amd64/process_machdep.c:329: undefined reference to `ptrace_update_lwp'
	/build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-ld: /build/netbsd-local/src/sys/arch/amd64/amd64/process_machdep.c:372: undefined reference to `ptrace_update_lwp'
	*** [netbsd] Error code 1

	Christos offered an initial patch in [1].  With this patch, the
	build fails while building modules:

	#   compile  coredump/kern_core.o
	/build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-gcc -O2 -g   -std=gnu99    -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare  -Wsystem-headers   -Wno-traditional   -Wa,--fatal-warnings  -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare -Werror  -Wno-error=address-of-packed-member   -ffreestanding  -fno-strict-aliasing -Wno-pointer-sign -mno-red-zone -mno-mmx -mno-sse -mno-avx -msoft-float -mcmodel=kernel -fno-omit-frame-pointer   -I/build/netbsd-local/src/common/include -DDIAGNOSTIC --sysroot=/build/netbsd-local/dest/amd64 -I/build/netbsd-local/src/common/include -DDIAGNOSTIC  -nostdinc -I. -I/build/netbsd-local/src/sys/modules/coredump -isystem /build/netbsd-local/src/sys -isystem /build/netbsd-local/src/sys/arch -isystem /build/netbsd-local/src/sys/../common/include -D_KERNEL -D_MODULE -DSYSCTL_INCLUDE_DESCR -c  -Wno-cast-function-type    /build/netbsd-local/src/sys/kern/kern
 _core.c
	In file included from /build/netbsd-local/src/sys/sys/compat_stub.h:35,
	                 from /build/netbsd-local/src/sys/kern/kern_core.c:53:
	/build/netbsd-local/src/sys/kern/kern_core.c: In function 'coredump_modcmd':
	/build/netbsd-local/src/sys/kern/kern_core.c:80:40: error: 'real_coredump_elf32' undeclared (first use in this function); did you mean 'real_coredump_netbsd'?
	   80 |   MODULE_HOOK_SET(coredump_elf32_hook, real_coredump_elf32);
	      |                                        ^~~~~~~~~~~~~~~~~~~
	/build/netbsd-local/src/sys/kern/kern_core.c:80:40: note: each undeclared identifier is reported only once for each function it appears in
	/build/netbsd-local/src/sys/kern/kern_core.c:81:40: error: 'real_coredump_elf64' undeclared (first use in this function); did you mean 'real_coredump_netbsd'?
	   81 |   MODULE_HOOK_SET(coredump_elf64_hook, real_coredump_elf64);
	      |                                        ^~~~~~~~~~~~~~~~~~~
	*** [kern_core.o] Error code 1


	christos@ suggested adding the missing symbols to header file
	sys/sys/exec_elf.h but that breaks compilation of kern/kern_core.c

	...
	#   compile  coredump/kern_core.o
	... (gcc command line elided)
	In file included from /build/netbsd-local/src_ro/sys/sys/compat_stub.h:35,
	                 from /build/netbsd-local/src_ro/sys/kern/kern_core.c:53:
	/build/netbsd-local/src_ro/sys/kern/kern_core.c: In function 'coredump_modcmd':
	/build/netbsd-local/src_ro/sys/kern/kern_core.c:80:40: error: 'real_coredump_elf32' undeclared (first use in this function); did you mean 'real_coredump_netbsd'?
	   80 |   MODULE_HOOK_SET(coredump_elf32_hook, real_coredump_elf32);
	      |                                        ^~~~~~~~~~~~~~~~~~~
	/build/netbsd-local/src_ro/sys/kern/kern_core.c:80:40: note: each undeclared identifier is reported only once for each function it appears in
	/build/netbsd-local/src_ro/sys/kern/kern_core.c:81:40: error: 'real_coredump_elf64' undeclared (first use in this function); did you mean 'real_coredump_netbsd'?
	   81 |   MODULE_HOOK_SET(coredump_elf64_hook, real_coredump_elf64);
	      |                                        ^~~~~~~~~~~~~~~~~~~


	On my own initiative, I tried to #include <sys/exec_elf.h> in
	kern/kern_core.c but that results in a different compile error
	or kern/kern/core_elf32.c

	#   compile  coredump/core_elf32.o
	/build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-gcc -O2 -g   -std=gnu99    -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare  -Wsystem-headers   -Wno-traditional   -Wa,--fatal-warnings  -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare -Werror  -Wno-error=address-of-packed-member   -ffreestanding  -fno-strict-aliasing -Wno-pointer-sign -mno-red-zone -mno-mmx -mno-sse -mno-avx -msoft-float -mcmodel=kernel -fno-omit-frame-pointer   -I/build/netbsd-local/src_ro/common/include -DDIAGNOSTIC --sysroot=/build/netbsd-local/dest/amd64 -I/build/netbsd-local/src_ro/common/include -DDIAGNOSTIC  -nostdinc -I. -I/build/netbsd-local/src_ro/sys/modules/coredump -isystem /build/netbsd-local/src_ro/sys -isystem /build/netbsd-local/src_ro/sys/arch -isystem /build/netbsd-local/src_ro/sys/../common/include -D_KERNEL -D_MODULE -DSYSCTL_INCLUDE_DESCR -c    /build/netbsd-local/src_ro/sys/kern/core_elf
 32.c
	In file included from /build/netbsd-local/src_ro/sys/kern/core_elf32.c:42:
	/build/netbsd-local/src_ro/sys/kern/core_elf32.c: In function 'coredump_note_procinfo':
	/build/netbsd-local/src_ro/sys/kern/core_elf32.c:424:13: error: implicit declaration of function 'coredump_savenote_elf32'; did you mean 'coredump_note_elf32'? [-Werror=implicit-function-declaration]
	  424 |  ELFNAMEEND(coredump_savenote)(ns, ELF_NOTE_NETBSD_CORE_PROCINFO,
	      |             ^~~~~~~~~~~~~~~~~
	/build/netbsd-local/src_ro/sys/kern/core_elf32.c: In function 'coredump_note_elf32':
	/build/netbsd-local/src_ro/sys/kern/core_elf32.c:541:2: error: 'PT32_GETXSTATE' undeclared (first use in this function); did you mean 'PT64_GETXSTATE'?
	  541 |  COREDUMP_MACHDEP_LWP_NOTES(l, ns, d->name);
	      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~
	/build/netbsd-local/src_ro/sys/kern/core_elf32.c:541:2: note: each undeclared identifier is reported only once for each function it appears in
	/build/netbsd-local/src_ro/sys/kern/core_elf32.c: At top level:
	/build/netbsd-local/src_ro/sys/kern/core_elf32.c:583:12: error: no previous prototype for 'coredump_savenote_elf32' [-Werror=missing-prototypes]
	  583 | ELFNAMEEND(coredump_savenote)(struct note_state *ns, unsigned int type,
	      |            ^~~~~~~~~~~~~~~~~
	/build/netbsd-local/src_ro/sys/kern/core_elf32.c:583:12: error: conflicting types for 'coredump_savenote_elf32' [-Werror]
	/build/netbsd-local/src_ro/sys/kern/core_elf32.c:424:13: note: previous implicit declaration of 'coredump_savenote_elf32' was here
	  424 |  ELFNAMEEND(coredump_savenote)(ns, ELF_NOTE_NETBSD_CORE_PROCINFO,
	      |             ^~~~~~~~~~~~~~~~~
	cc1: all warnings being treated as errors
	*** [core_elf32.o] Error code 1



	[1] https://mail-index.netbsd.org/current-users/2020/10/17/msg039701.html

>How-To-Repeat:
	see above - build a kernel and modules with

		no options PTRACE
		no options COREDUMP
		no options EXEC_ELF32
		no options EXEC_ELF64
>Fix:
	unknown

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index