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.
Showing the changes to lib/vdso (1 of 1 file). Show all
Unified · Split
| @@ -25,6 +25,8 @@ · 24 unmodified lines | ||
| 25 | 25 | */ |
| 26 | 26 | #include <asm/vdso/gettimeofday.h> |
| 27 | 27 | |
| 28 | +#include <linux/build_bug.h> | |
| 29 | + | |
| 28 | 30 | /* Bring in default accessors */ |
| 29 | 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 | 327 | struct __kernel_timespec ts; |
| 326 | 328 | bool ok; |
| 327 | 329 | |
| 330 | + BUILD_BUG_ON(!IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)); | |
| 331 | + | |
| 328 | 332 | ok = __cvdso_clock_gettime_common(vd, clock, &ts); |
| 329 | 333 | |
| 330 | 334 | if (unlikely(!ok)) |
| @@ -354,6 +358,8 @@ __cvdso_gettimeofday_data(const struct vdso_time_data *vd, · 23 unmodified lines | ||
| 354 | 358 | BUILD_BUG(); |
| 355 | 359 | #endif |
| 356 | 360 | |
| 361 | + BUILD_BUG_ON(sizeof(tv->tv_sec) != 8 && !IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)); | |
| 362 | + | |
| 357 | 363 | if (likely(tv != NULL)) { |
| 358 | 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 | 398 | BUILD_BUG(); |
| 393 | 399 | #endif |
| 394 | 400 | |
| 401 | + BUILD_BUG_ON(sizeof(*time) != 8 && !IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)); | |
| 402 | + | |
| 395 | 403 | if (vdso_is_timens_clock(vc)) { |
| 396 | 404 | vd = vdso_timens_data(vd); |
| 397 | 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 | 489 | struct __kernel_timespec ts; |
| 482 | 490 | bool ok; |
| 483 | 491 | |
| 492 | + BUILD_BUG_ON(!IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)); | |
| 493 | + | |
| 484 | 494 | ok = __cvdso_clock_getres_common(vd, clock, &ts); |
| 485 | 495 | |
| 486 | 496 | if (unlikely(!ok)) |