ANDROID: fix declaration mismatch for ns_to_kernel_old_timeval

The function ns_to_kernel_old_timeval() has inconsistent declarations:

include/linux/time32.h: ns_to_kernel_old_timeval(s64 nsec);
kernel/time/time.c: ns_to_kernel_old_timeval(const s64 nsec);

This causes the ABI checks to mismatch when generated with LTO=thin

It is fixed upstream in 46dae32fe625 ("time: Correct the prototype
of ns_to_kernel_old_timeval and ns_to_timespec64"), however, since
the android13-5.15 KMI is frozen and assumes "const s64", we can't
use the upstream fix which eliminates "const". Instead use __GENKSYMS__
to fix it for ABI generation.

Fixes: a84d116916 ("y2038: Introduce struct __kernel_old_timeval")
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I43c74ae1c457607b53a08fbfb67e77f7426bcda7
This commit is contained in:
Todd Kjos
2022-08-24 09:41:20 -07:00
committed by Treehugger Robot
parent 13e5af1463
commit 17e63e8b13

View File

@@ -67,6 +67,19 @@ int put_old_timex32(struct old_timex32 __user *, const struct __kernel_timex *);
*
* Returns the timeval representation of the nsec parameter.
*/
#ifndef __GENKSYMS__
/*
* There is a mismatch between this signature and the declaration
* in kernel/time/time.c where the argument actually should be
* s64, but is declared as const s64 in kernel/time/time.c. Since
* the KMI expects const, we can't cherry-pick the upstream
* fix: 46dae32fe625 ("time: Correct the prototype of ns_to_kernel_old_timeval
* and ns_to_timespec64"). Use __GENKSYMS__ to force CRC to stay
* constant.
*/
extern struct __kernel_old_timeval ns_to_kernel_old_timeval(const s64 nsec);
#else
extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec);
#endif
#endif