Skip to content

[PW_SID:1057499] vdso/datapage: Define vdso data pointers as arrays#1494

Open
linux-riscv-bot wants to merge 1 commit intoworkflow__riscv__fixesfrom
pw1057499
Open

[PW_SID:1057499] vdso/datapage: Define vdso data pointers as arrays#1494
linux-riscv-bot wants to merge 1 commit intoworkflow__riscv__fixesfrom
pw1057499

Conversation

@linux-riscv-bot
Copy link

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

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>
@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 136.86 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1126.77 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1648.08 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.75 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.76 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.40 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 81.72 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
kdoc
Desc: Detects for kdoc errors
Duration: 0.88 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "vdso/datapage: Define vdso data pointers as arrays"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants