mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-28 16:53:49 +00:00
csky/vdso: Remove gettimeofday() and friends from VDSO
The time-related VDSO functionality was introduced in 2021 in commit87f3248cdb
("csky: Reconstruct VDSO framework") and commit0d3b051adb
("csky: Add VDSO with GENERIC_GETTIMEOFDAY, GENERIC_TIME_VSYSCALL, HAVE_GENERIC_VDSO"). However the corresponding aux-vector entry AT_SYSINFO_EHDR was never wired up, making these functions impossible to test or use. The VDSO itself is kept as it also provides rt_sigreturn which is exposed differently to userspace. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20241010-vdso-generic-base-v1-1-b64f0842d512@linutronix.de
This commit is contained in:
parent
d4a65302dd
commit
cf12469600
@ -64,9 +64,6 @@ config CSKY
|
||||
select GENERIC_IRQ_MULTI_HANDLER
|
||||
select GENERIC_SCHED_CLOCK
|
||||
select GENERIC_SMP_IDLE_THREAD
|
||||
select GENERIC_TIME_VSYSCALL
|
||||
select GENERIC_VDSO_32
|
||||
select GENERIC_GETTIMEOFDAY
|
||||
select GX6605S_TIMER if CPU_CK610
|
||||
select HAVE_ARCH_TRACEHOOK
|
||||
select HAVE_ARCH_AUDITSYSCALL
|
||||
@ -80,7 +77,6 @@ config CSKY
|
||||
select HAVE_DEBUG_KMEMLEAK
|
||||
select HAVE_DYNAMIC_FTRACE
|
||||
select HAVE_DYNAMIC_FTRACE_WITH_REGS
|
||||
select HAVE_GENERIC_VDSO
|
||||
select HAVE_FUNCTION_TRACER
|
||||
select HAVE_FUNCTION_GRAPH_TRACER
|
||||
select HAVE_FUNCTION_ERROR_INJECTION
|
||||
|
@ -1,9 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#ifndef __ASM_VDSO_CSKY_CLOCKSOURCE_H
|
||||
#define __ASM_VDSO_CSKY_CLOCKSOURCE_H
|
||||
|
||||
#define VDSO_ARCH_CLOCKMODES \
|
||||
VDSO_CLOCKMODE_ARCHTIMER
|
||||
|
||||
#endif /* __ASM_VDSO_CSKY_CLOCKSOURCE_H */
|
@ -1,114 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#ifndef __ASM_VDSO_CSKY_GETTIMEOFDAY_H
|
||||
#define __ASM_VDSO_CSKY_GETTIMEOFDAY_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <asm/barrier.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <abi/regdef.h>
|
||||
#include <uapi/linux/time.h>
|
||||
|
||||
#define VDSO_HAS_CLOCK_GETRES 1
|
||||
|
||||
static __always_inline
|
||||
int gettimeofday_fallback(struct __kernel_old_timeval *_tv,
|
||||
struct timezone *_tz)
|
||||
{
|
||||
register struct __kernel_old_timeval *tv asm("a0") = _tv;
|
||||
register struct timezone *tz asm("a1") = _tz;
|
||||
register long ret asm("a0");
|
||||
register long nr asm(syscallid) = __NR_gettimeofday;
|
||||
|
||||
asm volatile ("trap 0\n"
|
||||
: "=r" (ret)
|
||||
: "r"(tv), "r"(tz), "r"(nr)
|
||||
: "memory");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static __always_inline
|
||||
long clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
|
||||
{
|
||||
register clockid_t clkid asm("a0") = _clkid;
|
||||
register struct __kernel_timespec *ts asm("a1") = _ts;
|
||||
register long ret asm("a0");
|
||||
register long nr asm(syscallid) = __NR_clock_gettime64;
|
||||
|
||||
asm volatile ("trap 0\n"
|
||||
: "=r" (ret)
|
||||
: "r"(clkid), "r"(ts), "r"(nr)
|
||||
: "memory");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static __always_inline
|
||||
long clock_gettime32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
|
||||
{
|
||||
register clockid_t clkid asm("a0") = _clkid;
|
||||
register struct old_timespec32 *ts asm("a1") = _ts;
|
||||
register long ret asm("a0");
|
||||
register long nr asm(syscallid) = __NR_clock_gettime;
|
||||
|
||||
asm volatile ("trap 0\n"
|
||||
: "=r" (ret)
|
||||
: "r"(clkid), "r"(ts), "r"(nr)
|
||||
: "memory");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static __always_inline
|
||||
int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
|
||||
{
|
||||
register clockid_t clkid asm("a0") = _clkid;
|
||||
register struct __kernel_timespec *ts asm("a1") = _ts;
|
||||
register long ret asm("a0");
|
||||
register long nr asm(syscallid) = __NR_clock_getres_time64;
|
||||
|
||||
asm volatile ("trap 0\n"
|
||||
: "=r" (ret)
|
||||
: "r"(clkid), "r"(ts), "r"(nr)
|
||||
: "memory");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static __always_inline
|
||||
int clock_getres32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
|
||||
{
|
||||
register clockid_t clkid asm("a0") = _clkid;
|
||||
register struct old_timespec32 *ts asm("a1") = _ts;
|
||||
register long ret asm("a0");
|
||||
register long nr asm(syscallid) = __NR_clock_getres;
|
||||
|
||||
asm volatile ("trap 0\n"
|
||||
: "=r" (ret)
|
||||
: "r"(clkid), "r"(ts), "r"(nr)
|
||||
: "memory");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t csky_pmu_read_cc(void);
|
||||
static __always_inline u64 __arch_get_hw_counter(s32 clock_mode,
|
||||
const struct vdso_data *vd)
|
||||
{
|
||||
#ifdef CONFIG_CSKY_PMU_V1
|
||||
return csky_pmu_read_cc();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static __always_inline const struct vdso_data *__arch_get_vdso_data(void)
|
||||
{
|
||||
return _vdso_data;
|
||||
}
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* __ASM_VDSO_CSKY_GETTIMEOFDAY_H */
|
@ -1,12 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#ifndef __ASM_VDSO_CSKY_PROCESSOR_H
|
||||
#define __ASM_VDSO_CSKY_PROCESSOR_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#define cpu_relax() barrier()
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __ASM_VDSO_CSKY_PROCESSOR_H */
|
@ -1,22 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#ifndef __ASM_VDSO_CSKY_VSYSCALL_H
|
||||
#define __ASM_VDSO_CSKY_VSYSCALL_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <vdso/datapage.h>
|
||||
|
||||
extern struct vdso_data *vdso_data;
|
||||
|
||||
static __always_inline struct vdso_data *__csky_get_k_vdso_data(void)
|
||||
{
|
||||
return vdso_data;
|
||||
}
|
||||
#define __arch_get_k_vdso_data __csky_get_k_vdso_data
|
||||
|
||||
#include <asm-generic/vdso/vsyscall.h>
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* __ASM_VDSO_CSKY_VSYSCALL_H */
|
@ -8,23 +8,19 @@
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <asm/page.h>
|
||||
#include <vdso/datapage.h>
|
||||
|
||||
extern char vdso_start[], vdso_end[];
|
||||
|
||||
static unsigned int vdso_pages;
|
||||
static struct page **vdso_pagelist;
|
||||
|
||||
static union vdso_data_store vdso_data_store __page_aligned_data;
|
||||
struct vdso_data *vdso_data = vdso_data_store.data;
|
||||
|
||||
static int __init vdso_init(void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
vdso_pages = (vdso_end - vdso_start) >> PAGE_SHIFT;
|
||||
vdso_pagelist =
|
||||
kcalloc(vdso_pages + 1, sizeof(struct page *), GFP_KERNEL);
|
||||
kcalloc(vdso_pages, sizeof(struct page *), GFP_KERNEL);
|
||||
if (unlikely(vdso_pagelist == NULL)) {
|
||||
pr_err("vdso: pagelist allocation failed\n");
|
||||
return -ENOMEM;
|
||||
@ -36,7 +32,6 @@ static int __init vdso_init(void)
|
||||
pg = virt_to_page(vdso_start + (i << PAGE_SHIFT));
|
||||
vdso_pagelist[i] = pg;
|
||||
}
|
||||
vdso_pagelist[i] = virt_to_page(vdso_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -52,11 +47,8 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
|
||||
static struct vm_special_mapping vdso_mapping = {
|
||||
.name = "[vdso]",
|
||||
};
|
||||
static struct vm_special_mapping vvar_mapping = {
|
||||
.name = "[vvar]",
|
||||
};
|
||||
|
||||
vdso_len = (vdso_pages + 1) << PAGE_SHIFT;
|
||||
vdso_len = vdso_pages << PAGE_SHIFT;
|
||||
|
||||
mmap_write_lock(mm);
|
||||
vdso_base = get_unmapped_area(NULL, 0, vdso_len, 0, 0);
|
||||
@ -85,15 +77,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
|
||||
}
|
||||
|
||||
vdso_base += (vdso_pages << PAGE_SHIFT);
|
||||
vvar_mapping.pages = &vdso_pagelist[vdso_pages];
|
||||
vma = _install_special_mapping(mm, vdso_base, PAGE_SIZE,
|
||||
(VM_READ | VM_MAYREAD), &vvar_mapping);
|
||||
|
||||
if (IS_ERR(vma)) {
|
||||
ret = PTR_ERR(vma);
|
||||
mm->context.vdso = NULL;
|
||||
goto end;
|
||||
}
|
||||
ret = 0;
|
||||
end:
|
||||
mmap_write_unlock(mm);
|
||||
@ -104,8 +87,5 @@ const char *arch_vma_name(struct vm_area_struct *vma)
|
||||
{
|
||||
if (vma->vm_mm && (vma->vm_start == (long)vma->vm_mm->context.vdso))
|
||||
return "[vdso]";
|
||||
if (vma->vm_mm && (vma->vm_start ==
|
||||
(long)vma->vm_mm->context.vdso + PAGE_SIZE))
|
||||
return "[vdso_data]";
|
||||
return NULL;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ include $(srctree)/lib/vdso/Makefile
|
||||
|
||||
# Symbols present in the vdso
|
||||
vdso-syms += rt_sigreturn
|
||||
vdso-syms += vgettimeofday
|
||||
|
||||
# Files to link into the vdso
|
||||
obj-vdso = $(patsubst %, %.o, $(vdso-syms)) note.o
|
||||
|
@ -49,10 +49,6 @@ VERSION
|
||||
LINUX_5.10 {
|
||||
global:
|
||||
__vdso_rt_sigreturn;
|
||||
__vdso_clock_gettime;
|
||||
__vdso_clock_gettime64;
|
||||
__vdso_gettimeofday;
|
||||
__vdso_clock_getres;
|
||||
local: *;
|
||||
};
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <linux/time.h>
|
||||
#include <linux/types.h>
|
||||
#include <vdso/gettime.h>
|
||||
|
||||
extern
|
||||
int __vdso_clock_gettime(clockid_t clock,
|
||||
struct old_timespec32 *ts)
|
||||
{
|
||||
return __cvdso_clock_gettime32(clock, ts);
|
||||
}
|
||||
|
||||
int __vdso_clock_gettime64(clockid_t clock,
|
||||
struct __kernel_timespec *ts)
|
||||
{
|
||||
return __cvdso_clock_gettime(clock, ts);
|
||||
}
|
||||
|
||||
int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
|
||||
struct timezone *tz)
|
||||
{
|
||||
return __cvdso_gettimeofday(tv, tz);
|
||||
}
|
||||
|
||||
int __vdso_clock_getres(clockid_t clock_id,
|
||||
struct old_timespec32 *res)
|
||||
{
|
||||
return __cvdso_clock_getres_time32(clock_id, res);
|
||||
}
|
Loading…
Reference in New Issue
Block a user