[PW_SID:1057499] vdso/datapage: Define vdso data pointers as arrays#1494
[PW_SID:1057499] vdso/datapage: Define vdso data pointers as arrays#1494linux-riscv-bot wants to merge 1 commit intoworkflow__riscv__fixesfrom
Conversation
The vdso_u_time_data, vdso_u_rng_data, and vdso_u_arch_data arrays
are seen by GCC as single instances (due to their declarations in
include/vdso/datapage.h). When the vdso data pointers are dereferenced
with an offset, GCC thinks there is an access beyond the returned single
instance. These are actually arrays constructed at link time, so declare
them as such.
Silence the warning seen with -Warray-bounds:
In file included from ../include/linux/export.h:5,
from ../include/linux/linkage.h:7,
from ../arch/x86/include/asm/cache.h:5,
from ../include/vdso/cache.h:5,
from ../include/linux/cache.h:6,
from ../include/linux/time.h:5,
from ../arch/x86/entry/vdso/vclock_gettime.c:11:
In function 'vdso_read_begin',
inlined from 'do_coarse_timens' at ../arch/x86/entry/vdso/../../../../lib/vdso/gettimeofday.c:204:9,
inlined from 'do_coarse' at ../arch/x86/entry/vdso/../../../../lib/vdso/gettimeofday.c:233:12,
inlined from '__cvdso_clock_gettime_common' at ../arch/x86/entry/vdso/../../../../lib/vdso/gettimeofday.c:305:10,
inlined from '__cvdso_clock_gettime_data.constprop' at ../arch/x86/entry/vdso/../../../../lib/vdso/gettimeofday.c:322:7:
../include/asm-generic/rwonce.h:44:26: error: array subscript 1024 is outside array bounds of 'struct vdso_time_data[1]' [-Werror=array-bounds=]
...
../include/vdso/helpers.h:14:32: note: in expansion of macro 'READ_ONCE'
14 | while (unlikely((seq = READ_ONCE(vc->seq)) & 1))
| ^~~~~~~~~
Reachable via:
static __always_inline const struct vdso_time_data *__arch_get_vdso_u_time_data(void)
{
return &vdso_u_time_data;
}
...
return __cvdso_clock_gettime_data(__arch_get_vdso_u_time_data(), clock, ts);
...
__cvdso_clock_gettime_common(const struct vdso_time_data *vd, ...)
...
const struct vdso_clock *vc = vd->clock_data;
...
if (likely(msk & VDSO_HRES))
vc = &vc[CS_HRES_COARSE];
...
while (unlikely((seq = READ_ONCE(vc->seq)) & 1))
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
|
Patch 1: "vdso/datapage: Define vdso data pointers as arrays" |
PR for series 1057499 applied to workflow__riscv__fixes
Name: vdso/datapage: Define vdso data pointers as arrays
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1057499
Version: 1