* [arnd-playground:y2038-endgame-20191114 30/95] kernel/time/time.c:210:3: note: in expansion of macro 'if'
@ 2019-11-16 4:01 kbuild test robot
0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2019-11-16 4:01 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 8689 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-endgame-20191114
head: 640d99621db89609782df419f3d2a9035e46319d
commit: 79968b0019a1f5327d55f9b6b45099ddf6994eef [30/95] y2038: time: avoid timespec usage in settimeofday()
config: i386-randconfig-f002-20191115 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout 79968b0019a1f5327d55f9b6b45099ddf6994eef
# save the attached .config to linux build tree
make ARCH=i386
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/export.h:42:0,
from kernel/time/time.c:27:
kernel/time/time.c: In function '__do_sys_settimeofday':
kernel/time/time.c:210:14: error: 'struct timespec64' has no member named 'tv_usec'; did you mean 'tv_sec'?
if (new_ts.tv_usec > USEC_PER_SEC)
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> kernel/time/time.c:210:3: note: in expansion of macro 'if'
if (new_ts.tv_usec > USEC_PER_SEC)
^~
kernel/time/time.c:210:14: error: 'struct timespec64' has no member named 'tv_usec'; did you mean 'tv_sec'?
if (new_ts.tv_usec > USEC_PER_SEC)
^
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> kernel/time/time.c:210:3: note: in expansion of macro 'if'
if (new_ts.tv_usec > USEC_PER_SEC)
^~
kernel/time/time.c:210:14: error: 'struct timespec64' has no member named 'tv_usec'; did you mean 'tv_sec'?
if (new_ts.tv_usec > USEC_PER_SEC)
^
include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
(cond) ? \
^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~~~~~~~~~~~
>> kernel/time/time.c:210:3: note: in expansion of macro 'if'
if (new_ts.tv_usec > USEC_PER_SEC)
^~
vim +/if +210 kernel/time/time.c
> 27 #include <linux/export.h>
28 #include <linux/kernel.h>
29 #include <linux/timex.h>
30 #include <linux/capability.h>
31 #include <linux/timekeeper_internal.h>
32 #include <linux/errno.h>
33 #include <linux/syscalls.h>
34 #include <linux/security.h>
35 #include <linux/fs.h>
36 #include <linux/math64.h>
37 #include <linux/ptrace.h>
38
39 #include <linux/uaccess.h>
40 #include <linux/compat.h>
41 #include <asm/unistd.h>
42
43 #include <generated/timeconst.h>
44 #include "timekeeping.h"
45
46 /*
47 * The timezone where the local system is located. Used as a default by some
48 * programs who obtain this value by using gettimeofday.
49 */
50 struct timezone sys_tz;
51
52 EXPORT_SYMBOL(sys_tz);
53
54 #ifdef __ARCH_WANT_SYS_TIME
55
56 /*
57 * sys_time() can be implemented in user-level using
58 * sys_gettimeofday(). Is this for backwards compatibility? If so,
59 * why not move it into the appropriate arch directory (for those
60 * architectures that need it).
61 */
62 SYSCALL_DEFINE1(time, __kernel_old_time_t __user *, tloc)
63 {
64 __kernel_old_time_t i = (__kernel_old_time_t)ktime_get_real_seconds();
65
66 if (tloc) {
67 if (put_user(i,tloc))
68 return -EFAULT;
69 }
70 force_successful_syscall_return();
71 return i;
72 }
73
74 /*
75 * sys_stime() can be implemented in user-level using
76 * sys_settimeofday(). Is this for backwards compatibility? If so,
77 * why not move it into the appropriate arch directory (for those
78 * architectures that need it).
79 */
80
81 SYSCALL_DEFINE1(stime, __kernel_old_time_t __user *, tptr)
82 {
83 struct timespec64 tv;
84 int err;
85
86 if (get_user(tv.tv_sec, tptr))
87 return -EFAULT;
88
89 tv.tv_nsec = 0;
90
91 err = security_settime64(&tv, NULL);
92 if (err)
93 return err;
94
95 do_settimeofday64(&tv);
96 return 0;
97 }
98
99 #endif /* __ARCH_WANT_SYS_TIME */
100
101 #ifdef CONFIG_COMPAT_32BIT_TIME
102 #ifdef __ARCH_WANT_SYS_TIME32
103
104 /* old_time32_t is a 32 bit "long" and needs to get converted. */
105 SYSCALL_DEFINE1(time32, old_time32_t __user *, tloc)
106 {
107 old_time32_t i;
108
109 i = (old_time32_t)ktime_get_real_seconds();
110
111 if (tloc) {
112 if (put_user(i,tloc))
113 return -EFAULT;
114 }
115 force_successful_syscall_return();
116 return i;
117 }
118
119 SYSCALL_DEFINE1(stime32, old_time32_t __user *, tptr)
120 {
121 struct timespec64 tv;
122 int err;
123
124 if (get_user(tv.tv_sec, tptr))
125 return -EFAULT;
126
127 tv.tv_nsec = 0;
128
129 err = security_settime64(&tv, NULL);
130 if (err)
131 return err;
132
133 do_settimeofday64(&tv);
134 return 0;
135 }
136
137 #endif /* __ARCH_WANT_SYS_TIME32 */
138 #endif
139
140 SYSCALL_DEFINE2(gettimeofday, struct __kernel_old_timeval __user *, tv,
141 struct timezone __user *, tz)
142 {
143 if (likely(tv != NULL)) {
144 struct timespec64 ts;
145
146 ktime_get_real_ts64(&ts);
147 if (put_user(ts.tv_sec, &tv->tv_sec) ||
148 put_user(ts.tv_nsec / 1000, &tv->tv_usec))
149 return -EFAULT;
150 }
151 if (unlikely(tz != NULL)) {
152 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
153 return -EFAULT;
154 }
155 return 0;
156 }
157
158 /*
159 * In case for some reason the CMOS clock has not already been running
160 * in UTC, but in some local time: The first time we set the timezone,
161 * we will warp the clock so that it is ticking UTC time instead of
162 * local time. Presumably, if someone is setting the timezone then we
163 * are running in an environment where the programs understand about
164 * timezones. This should be done at boot time in the /etc/rc script,
165 * as soon as possible, so that the clock can be set right. Otherwise,
166 * various programs will get confused when the clock gets warped.
167 */
168
169 int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tz)
170 {
171 static int firsttime = 1;
172 int error = 0;
173
174 if (tv && !timespec64_valid_settod(tv))
175 return -EINVAL;
176
177 error = security_settime64(tv, tz);
178 if (error)
179 return error;
180
181 if (tz) {
182 /* Verify we're witin the +-15 hrs range */
183 if (tz->tz_minuteswest > 15*60 || tz->tz_minuteswest < -15*60)
184 return -EINVAL;
185
186 sys_tz = *tz;
187 update_vsyscall_tz();
188 if (firsttime) {
189 firsttime = 0;
190 if (!tv)
191 timekeeping_warp_clock();
192 }
193 }
194 if (tv)
195 return do_settimeofday64(tv);
196 return 0;
197 }
198
199 SYSCALL_DEFINE2(settimeofday, struct __kernel_old_timeval __user *, tv,
200 struct timezone __user *, tz)
201 {
202 struct timespec64 new_ts;
203 struct timezone new_tz;
204
205 if (tv) {
206 if (get_user(new_ts.tv_sec, &tv->tv_sec) ||
207 get_user(new_ts.tv_nsec, &tv->tv_usec))
208 return -EFAULT;
209
> 210 if (new_ts.tv_usec > USEC_PER_SEC)
211 return -EINVAL;
212
213 new_ts.tv_nsec *= NSEC_PER_USEC;
214 }
215 if (tz) {
216 if (copy_from_user(&new_tz, tz, sizeof(*tz)))
217 return -EFAULT;
218 }
219
220 return do_sys_settimeofday64(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
221 }
222
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33949 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-11-16 4:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-16 4:01 [arnd-playground:y2038-endgame-20191114 30/95] kernel/time/time.c:210:3: note: in expansion of macro 'if' kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.