If CONFIG_COMPAT_32BIT_TIME is disabled then the vDSO should not provide any 32-bit time related functionality. Add some build-time validations to make sure the architecture-specific glue satisfies this requirement.
Unified · Split
| @@ -25,6 +25,8 @@ · 24 unmodified lines | |||
| 25 | */ | 25 | */ |
| 26 | #include <asm/vdso/gettimeofday.h> | 26 | #include <asm/vdso/gettimeofday.h> |
| 27 | 27 | ||
| 28 | #include <linux/build_bug.h> | ||
| 29 | |||
| 28 | /* Bring in default accessors */ | 30 | /* Bring in default accessors */ |
| 29 | #include <vdso/vsyscall.h> | 31 | #include <vdso/vsyscall.h> |
| 30 | 32 | ||
| @@ -325,6 +327,8 @@ __cvdso_clock_gettime32_data(const struct vdso_time_data *vd, clockid_t clock, · 294 unmodified lines | |||
| 325 | struct __kernel_timespec ts; | 327 | struct __kernel_timespec ts; |
| 326 | bool ok; | 328 | bool ok; |
| 327 | 329 | ||
| 330 | BUILD_BUG_ON(!IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)); | ||
| 331 | |||
| 328 | ok = __cvdso_clock_gettime_common(vd, clock, &ts); | 332 | ok = __cvdso_clock_gettime_common(vd, clock, &ts); |
| 329 | 333 | ||
| 330 | if (unlikely(!ok)) | 334 | if (unlikely(!ok)) |
| @@ -354,6 +358,8 @@ __cvdso_gettimeofday_data(const struct vdso_time_data *vd, · 23 unmodified lines | |||
| 354 | BUILD_BUG(); | 358 | BUILD_BUG(); |
| 355 | #endif | 359 | #endif |
| 356 | 360 | ||
| 361 | BUILD_BUG_ON(sizeof(tv->tv_sec) != 8 && !IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)); | ||
| 362 | |||
| 357 | if (likely(tv != NULL)) { | 363 | if (likely(tv != NULL)) { |
| 358 | struct __kernel_timespec ts; | 364 | struct __kernel_timespec ts; |
| 359 | 365 | ||
| @@ -392,6 +398,8 @@ __cvdso_time_data(const struct vdso_time_data *vd, __kernel_old_time_t *time) · 32 unmodified lines | |||
| 392 | BUILD_BUG(); | 398 | BUILD_BUG(); |
| 393 | #endif | 399 | #endif |
| 394 | 400 | ||
| 401 | BUILD_BUG_ON(sizeof(*time) != 8 && !IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)); | ||
| 402 | |||
| 395 | if (vdso_is_timens_clock(vc)) { | 403 | if (vdso_is_timens_clock(vc)) { |
| 396 | vd = vdso_timens_data(vd); | 404 | vd = vdso_timens_data(vd); |
| 397 | vc = vd->clock_data; | 405 | vc = vd->clock_data; |
| @@ -481,6 +489,8 @@ __cvdso_clock_getres_time32_data(const struct vdso_time_data *vd, clockid_t cloc · 83 unmodified lines | |||
| 481 | struct __kernel_timespec ts; | 489 | struct __kernel_timespec ts; |
| 482 | bool ok; | 490 | bool ok; |
| 483 | 491 | ||
| 492 | BUILD_BUG_ON(!IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)); | ||
| 493 | |||
| 484 | ok = __cvdso_clock_getres_common(vd, clock, &ts); | 494 | ok = __cvdso_clock_getres_common(vd, clock, &ts); |
| 485 | 495 | ||
| 486 | if (unlikely(!ok)) | 496 | if (unlikely(!ok)) |