Skip to content

Commit

Permalink
Automatic merge of 'topic/vdso' into merge-test (2024-11-04 17:03)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpe committed Nov 4, 2024
2 parents 751abf8 + 51ec783 commit 7dcd2c1
Show file tree
Hide file tree
Showing 98 changed files with 372 additions and 782 deletions.
2 changes: 1 addition & 1 deletion arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,7 @@ config HAVE_SPARSE_SYSCALL_NR
entries at 4000, 5000 and 6000 locations. This option turns on syscall
related optimizations for a given architecture.

config ARCH_HAS_VDSO_DATA
config ARCH_HAS_VDSO_TIME_DATA
bool

config HAVE_STATIC_CALL
Expand Down
6 changes: 1 addition & 5 deletions arch/alpha/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

#include <linux/const.h>
#include <asm/pal.h>

/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
#include <vdso/page.h>

#ifndef __ASSEMBLY__

Expand Down
7 changes: 3 additions & 4 deletions arch/arc/include/uapi/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/* PAGE_SHIFT determines the page size */
#ifdef __KERNEL__
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
#include <vdso/page.h>
#else
/*
* Default 8k
Expand All @@ -24,11 +24,10 @@
* not available
*/
#define PAGE_SHIFT 13
#define PAGE_SIZE _BITUL(PAGE_SHIFT) /* Default 8K */
#define PAGE_MASK (~(PAGE_SIZE-1))
#endif

#define PAGE_SIZE _BITUL(PAGE_SHIFT) /* Default 8K */
#define PAGE_OFFSET _AC(0x80000000, UL) /* Kernel starts at 2G onwrds */

#define PAGE_MASK (~(PAGE_SIZE-1))

#endif /* _UAPI__ASM_ARC_PAGE_H */
5 changes: 1 addition & 4 deletions arch/arm/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
#ifndef _ASMARM_PAGE_H
#define _ASMARM_PAGE_H

/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
#include <vdso/page.h>

#ifndef __ASSEMBLY__

Expand Down
4 changes: 1 addition & 3 deletions arch/arm/include/asm/vdso/gettimeofday.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#define VDSO_HAS_CLOCK_GETRES 1

extern struct vdso_data *__get_datapage(void);

static __always_inline int gettimeofday_fallback(
struct __kernel_old_timeval *_tv,
struct timezone *_tz)
Expand Down Expand Up @@ -139,7 +137,7 @@ static __always_inline u64 __arch_get_hw_counter(int clock_mode,

static __always_inline const struct vdso_data *__arch_get_vdso_data(void)
{
return __get_datapage();
return _vdso_data;
}

#endif /* !__ASSEMBLY__ */
Expand Down
4 changes: 0 additions & 4 deletions arch/arm/include/asm/vdso/vsyscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@

#ifndef __ASSEMBLY__

#include <linux/timekeeper_internal.h>
#include <vdso/datapage.h>
#include <asm/cacheflush.h>

extern struct vdso_data *vdso_data;
extern bool cntvct_ok;

/*
* Update the vDSO data page to keep in sync with kernel timekeeping.
*/
static __always_inline
struct vdso_data *__arm_get_k_vdso_data(void)
{
Expand Down
1 change: 0 additions & 1 deletion arch/arm/kernel/vdso.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <linux/of.h>
#include <linux/printk.h>
#include <linux/slab.h>
#include <linux/timekeeper_internal.h>
#include <linux/vmalloc.h>
#include <asm/arch_timer.h>
#include <asm/barrier.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/vdso/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include $(srctree)/lib/vdso/Makefile

hostprogs := vdsomunge

obj-vdso := vgettimeofday.o datapage.o note.o
obj-vdso := vgettimeofday.o note.o

# Build rules
targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.so.raw vdso.lds
Expand Down
16 changes: 0 additions & 16 deletions arch/arm/vdso/datapage.S

This file was deleted.

3 changes: 2 additions & 1 deletion arch/arm/vdso/vdso.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include <linux/const.h>
#include <asm/asm-offsets.h>
#include <asm/page.h>
#include <asm/vdso.h>

Expand All @@ -19,7 +20,7 @@ OUTPUT_ARCH(arm)

SECTIONS
{
PROVIDE(_start = .);
PROVIDE(_vdso_data = . - VDSO_DATA_SIZE);

. = SIZEOF_HEADERS;

Expand Down
5 changes: 1 addition & 4 deletions arch/arm64/include/asm/page-def.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

#include <linux/const.h>

/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
#include <vdso/page.h>

#endif /* __ASM_PAGE_DEF_H */
9 changes: 1 addition & 8 deletions arch/arm64/include/asm/vdso.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
#ifndef __ASM_VDSO_H
#define __ASM_VDSO_H

/*
* Default link address for the vDSO.
* Since we randomise the VDSO mapping, there's little point in trying
* to prelink this.
*/
#define VDSO_LBASE 0x0

#define __VVAR_PAGES 2

#ifndef __ASSEMBLY__
Expand All @@ -20,7 +13,7 @@

#define VDSO_SYMBOL(base, name) \
({ \
(void *)(vdso_offset_##name - VDSO_LBASE + (unsigned long)(base)); \
(void *)(vdso_offset_##name + (unsigned long)(base)); \
})

extern char vdso_start[], vdso_end[];
Expand Down
3 changes: 1 addition & 2 deletions arch/arm64/include/asm/vdso/vsyscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#ifndef __ASSEMBLY__

#include <linux/timekeeper_internal.h>
#include <vdso/datapage.h>

enum vvar_pages {
Expand Down Expand Up @@ -37,7 +36,7 @@ struct vdso_rng_data *__arm64_get_k_vdso_rnd_data(void)
#define __arch_get_k_vdso_rng_data __arm64_get_k_vdso_rnd_data

static __always_inline
void __arm64_update_vsyscall(struct vdso_data *vdata, struct timekeeper *tk)
void __arm64_update_vsyscall(struct vdso_data *vdata)
{
vdata[CS_HRES_COARSE].mask = VDSO_PRECISION_MASK;
vdata[CS_RAW].mask = VDSO_PRECISION_MASK;
Expand Down
44 changes: 13 additions & 31 deletions arch/arm64/kernel/vdso.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <linux/signal.h>
#include <linux/slab.h>
#include <linux/time_namespace.h>
#include <linux/timekeeper_internal.h>
#include <linux/vmalloc.h>
#include <vdso/datapage.h>
#include <vdso/helpers.h>
Expand All @@ -39,8 +38,6 @@ struct vdso_abi_info {
const char *vdso_code_start;
const char *vdso_code_end;
unsigned long vdso_pages;
/* Data Mapping */
struct vm_special_mapping *dm;
/* Code Mapping */
struct vm_special_mapping *cm;
};
Expand Down Expand Up @@ -113,6 +110,8 @@ struct vdso_data *arch_get_vdso_data(void *vvar_page)
return (struct vdso_data *)(vvar_page);
}

static const struct vm_special_mapping vvar_map;

/*
* The vvar mapping contains data for a specific time namespace, so when a task
* changes namespace we must unmap its vvar data for the old namespace.
Expand All @@ -129,12 +128,8 @@ int vdso_join_timens(struct task_struct *task, struct time_namespace *ns)
mmap_read_lock(mm);

for_each_vma(vmi, vma) {
if (vma_is_special_mapping(vma, vdso_info[VDSO_ABI_AA64].dm))
zap_vma_pages(vma);
#ifdef CONFIG_COMPAT_VDSO
if (vma_is_special_mapping(vma, vdso_info[VDSO_ABI_AA32].dm))
if (vma_is_special_mapping(vma, &vvar_map))
zap_vma_pages(vma);
#endif
}

mmap_read_unlock(mm);
Expand Down Expand Up @@ -176,6 +171,11 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
return vmf_insert_pfn(vma, vmf->address, pfn);
}

static const struct vm_special_mapping vvar_map = {
.name = "[vvar]",
.fault = vvar_fault,
};

static int __setup_additional_pages(enum vdso_abi abi,
struct mm_struct *mm,
struct linux_binprm *bprm,
Expand All @@ -199,7 +199,7 @@ static int __setup_additional_pages(enum vdso_abi abi,

ret = _install_special_mapping(mm, vdso_base, VVAR_NR_PAGES * PAGE_SIZE,
VM_READ|VM_MAYREAD|VM_PFNMAP,
vdso_info[abi].dm);
&vvar_map);
if (IS_ERR(ret))
goto up_fail;

Expand Down Expand Up @@ -229,7 +229,6 @@ static int __setup_additional_pages(enum vdso_abi abi,
enum aarch32_map {
AA32_MAP_VECTORS, /* kuser helpers */
AA32_MAP_SIGPAGE,
AA32_MAP_VVAR,
AA32_MAP_VDSO,
};

Expand All @@ -254,10 +253,6 @@ static struct vm_special_mapping aarch32_vdso_maps[] = {
.pages = &aarch32_sig_page,
.mremap = aarch32_sigpage_mremap,
},
[AA32_MAP_VVAR] = {
.name = "[vvar]",
.fault = vvar_fault,
},
[AA32_MAP_VDSO] = {
.name = "[vdso]",
.mremap = vdso_mremap,
Expand Down Expand Up @@ -307,7 +302,6 @@ static int __init __aarch32_alloc_vdso_pages(void)
if (!IS_ENABLED(CONFIG_COMPAT_VDSO))
return 0;

vdso_info[VDSO_ABI_AA32].dm = &aarch32_vdso_maps[AA32_MAP_VVAR];
vdso_info[VDSO_ABI_AA32].cm = &aarch32_vdso_maps[AA32_MAP_VDSO];

return __vdso_init(VDSO_ABI_AA32);
Expand Down Expand Up @@ -402,26 +396,14 @@ int aarch32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
}
#endif /* CONFIG_COMPAT */

enum aarch64_map {
AA64_MAP_VVAR,
AA64_MAP_VDSO,
};

static struct vm_special_mapping aarch64_vdso_maps[] __ro_after_init = {
[AA64_MAP_VVAR] = {
.name = "[vvar]",
.fault = vvar_fault,
},
[AA64_MAP_VDSO] = {
.name = "[vdso]",
.mremap = vdso_mremap,
},
static struct vm_special_mapping aarch64_vdso_map __ro_after_init = {
.name = "[vdso]",
.mremap = vdso_mremap,
};

static int __init vdso_init(void)
{
vdso_info[VDSO_ABI_AA64].dm = &aarch64_vdso_maps[AA64_MAP_VVAR];
vdso_info[VDSO_ABI_AA64].cm = &aarch64_vdso_maps[AA64_MAP_VDSO];
vdso_info[VDSO_ABI_AA64].cm = &aarch64_vdso_map;

return __vdso_init(VDSO_ABI_AA64);
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/vdso/vdso.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SECTIONS
#ifdef CONFIG_TIME_NS
PROVIDE(_timens_data = _vdso_data + PAGE_SIZE);
#endif
. = VDSO_LBASE + SIZEOF_HEADERS;
. = SIZEOF_HEADERS;

.hash : { *(.hash) } :text
.gnu.hash : { *(.gnu.hash) }
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/vdso32/vdso.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SECTIONS
#ifdef CONFIG_TIME_NS
PROVIDE_HIDDEN(_timens_data = _vdso_data + PAGE_SIZE);
#endif
. = VDSO_LBASE + SIZEOF_HEADERS;
. = SIZEOF_HEADERS;

.hash : { *(.hash) } :text
.gnu.hash : { *(.gnu.hash) }
Expand Down
4 changes: 0 additions & 4 deletions arch/csky/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 2 additions & 6 deletions arch/csky/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
#include <asm/cache.h>
#include <linux/const.h>

/*
* PAGE_SHIFT determines the page size: 4KB
*/
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE - 1))
#include <vdso/page.h>

#define THREAD_SIZE (PAGE_SIZE * 2)
#define THREAD_MASK (~(THREAD_SIZE - 1))
#define THREAD_SHIFT (PAGE_SHIFT + 1)
Expand Down
9 changes: 0 additions & 9 deletions arch/csky/include/asm/vdso/clocksource.h

This file was deleted.

Loading

0 comments on commit 7dcd2c1

Please sign in to comment.