Skip to contentSkip to conversation

xtables-addons build fail with linux 5.0: "error: implicit declaration of function 'do_gettimeofday'; did you mean 'do_settimeofday64'?"

DISCUSSION Applied PGNet Dev 2 participants 4 messages Mar 4, 2019 – Mar 7, 2019 netfilter

lore
Share & tools
lore

PGNet Dev

author
#0 lore raw

Building 'xtable-addons' v3.2 for just-released Linux 5.0,

https://build.opensuse.org/package/show/home:pgnd:Kernel:stable/xtables-addons

fails at

	https://build.opensuse.org/public/build/home:pgnd:Kernel:stable/openSUSE_Leap_15.0/x86_64/xtables-addons/_log

	...
	[53s]gcc -Wp, -MD, /home/abuild/rpmbuild/BUILD/xtables-addons-default-3.2/extensions/.xt_condition.o.d  -nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/8/include -I/usr/src/linux-5.0.0-lp150.4.g6bc6477/arch/x86/include -I./arch/x86/include/generated  -I/usr/src/linux-5.0.0-lp150.4.g6bc6477/include -I./include -I/usr/src/linux-5.0.0-lp150.4.g6bc6477/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-5.0.0-lp150.4.g6bc6477/include/uapi -I./include/generated/uapi -include /usr/src/linux-5.0.0-lp150.4.g6bc6477/include/linux/kconfig.h -include /usr/src/linux-5.0.0-lp150.4.g6bc6477/include/linux/compiler_types.h  -I/home/abuild/rpmbuild/BUILD/xtables-addons-default-3.2/extensions -I/home/abuild/rpmbuild/BUILD/xtables-addons-default-3.2/extensions -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror-implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89-mno-sse -mno-mmx -mno-sse2-mno-3dnow -mno-avx -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 -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_AVX=1-DCONFIG_AS_AVX2=1-DCONFIG_AS_AVX512=1-DCONFIG_AS_SHA1_NI=1-DCONFIG_AS_SHA256_NI=1-Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -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 -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-var-tracking-assignments -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-5.0.0-lp150.4.g6bc6477/= -Wno-packed-not-aligned  -DMODULE  -DKBUILD_BASENAME='"xt_condition"' -DKBUILD_MODNAME='"xt_condition"' -c -o /home/abuild/rpmbuild/BUILD/xtables-addons-default-3.2/extensions/xt_condition.o /home/abuild/rpmbuild/BUILD/xtables-addons-default-3.2/extensions/xt_condition.c
	[53s]/home/abuild/rpmbuild/BUILD/xtables-addons-default-3.2/extensions/xt_SYSRQ.c: In function 'sysrq_crypto_init':
	[53s]/home/abuild/rpmbuild/BUILD/xtables-addons-default-3.2/extensions/xt_SYSRQ.c:342:2: error: implicit declaration of function 'do_gettimeofday'; did you mean 'do_settimeofday64'? [
	-Werror=implicit-function-declaration
	]
	[53s]do_gettimeofday(&now);
	[53s]^~~~~~~~~~~~~~~
	[53s]do_settimeofday64
	[53s]cc1: some warnings being treated as errors
	...

Doing some limited digging, I do find

	https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1811721/comments/6

which, although re: NVIDIA build, *does* point out

	...
	change in kernel function do_gettimeofday to efi_gettimeofday
	...

I haven't yet found the documentation of that change on kernel.org for v5.0 ...

Can anyone confirm that kernel change, and if there's a fix/thread already underway for xtables-addons?

author
#2 lore raw

this patch,

https://bugzilla.opensuse.org/show_bug.cgi?id=1127790#c3

--------

extensions/xt_SYSRQ.c +5 -3
diff -ur xtables-addons-3.2.ORIG/extensions/xt_SYSRQ.c xtables-addons-3.2/extensions/xt_SYSRQ.c
@@ -314,7 +314,7 @@
 static int __init sysrq_crypto_init(void)
 {
 #if defined(WITH_CRYPTO)
-	struct timeval now;
+	struct timespec64 now;
 	int ret;
 
 	sysrq_tfm = crypto_alloc_shash(sysrq_hash, 0, 0);
@@ -339,7 +339,10 @@
 		    sizeof(sysrq_password), GFP_KERNEL);
 	if (sysrq_digest_password == NULL)
 		goto fail;
-	do_gettimeofday(&now);
+/* https://github.com/torvalds/linux/blob/master/Documentation/core-api/timekeeping.rst
+ * https://gitlab.com/snippets/1799795
+ */
+	ktime_get_real_ts64(&now);
 	sysrq_seqno = now.tv_sec;
 	return 0;
--------

appears to enable an ok build.