Skip to content

Commit

Permalink
From patchwork series 427405
Browse files Browse the repository at this point in the history
  • Loading branch information
Fox Snowpatch committed Oct 10, 2024
1 parent f85c105 commit 070f5c1
Show file tree
Hide file tree
Showing 57 changed files with 296 additions and 563 deletions.
2 changes: 1 addition & 1 deletion arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,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
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
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
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
43 changes: 13 additions & 30 deletions arch/arm64/kernel/vdso.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,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 +111,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 +129,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 +172,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 +200,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 +230,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 +254,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 +303,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 +397,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
9 changes: 0 additions & 9 deletions arch/csky/include/asm/vdso/clocksource.h

This file was deleted.

114 changes: 0 additions & 114 deletions arch/csky/include/asm/vdso/gettimeofday.h

This file was deleted.

12 changes: 0 additions & 12 deletions arch/csky/include/asm/vdso/processor.h

This file was deleted.

Loading

0 comments on commit 070f5c1

Please sign in to comment.