Skip to content

Commit f2535cf

Browse files
committed
Automatic merge of 'next' into merge (2024-10-29 13:24)
2 parents 96d177c + 0882db7 commit f2535cf

File tree

13 files changed

+42
-40
lines changed

13 files changed

+42
-40
lines changed

arch/powerpc/include/asm/vdso.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ int vdso_getcpu_init(void);
2525
#ifdef __VDSO64__
2626
#define V_FUNCTION_BEGIN(name) \
2727
.globl name; \
28+
.type name,@function; \
2829
name: \
2930

3031
#define V_FUNCTION_END(name) \

arch/powerpc/include/asm/vdso/getrandom.h

+14-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#ifndef __ASSEMBLY__
99

10+
#include <asm/vdso_datapage.h>
11+
1012
static __always_inline int do_syscall_3(const unsigned long _r0, const unsigned long _r3,
1113
const unsigned long _r4, const unsigned long _r5)
1214
{
@@ -43,11 +45,21 @@ static __always_inline ssize_t getrandom_syscall(void *buffer, size_t len, unsig
4345

4446
static __always_inline struct vdso_rng_data *__arch_get_vdso_rng_data(void)
4547
{
46-
return NULL;
48+
struct vdso_arch_data *data;
49+
50+
asm (
51+
" bcl 20, 31, .+4 ;"
52+
"0: mflr %0 ;"
53+
" addis %0, %0, (_vdso_datapage - 0b)@ha ;"
54+
" addi %0, %0, (_vdso_datapage - 0b)@l ;"
55+
: "=r" (data) : : "lr"
56+
);
57+
58+
return &data->rng_data;
4759
}
4860

4961
ssize_t __c_kernel_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state,
50-
size_t opaque_len, const struct vdso_rng_data *vd);
62+
size_t opaque_len);
5163

5264
#endif /* !__ASSEMBLY__ */
5365

arch/powerpc/include/asm/vdso_datapage.h

+7-17
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ struct vdso_arch_data {
8282
__u32 syscall_map[SYSCALL_MAP_SIZE]; /* Map of syscalls */
8383
__u32 compat_syscall_map[SYSCALL_MAP_SIZE]; /* Map of compat syscalls */
8484

85-
struct vdso_data data[CS_BASES];
8685
struct vdso_rng_data rng_data;
86+
87+
struct vdso_data data[CS_BASES] __aligned(1 << CONFIG_PAGE_SHIFT);
8788
};
8889

8990
#else /* CONFIG_PPC64 */
@@ -95,8 +96,9 @@ struct vdso_arch_data {
9596
__u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */
9697
__u32 syscall_map[SYSCALL_MAP_SIZE]; /* Map of syscalls */
9798
__u32 compat_syscall_map[0]; /* No compat syscalls on PPC32 */
98-
struct vdso_data data[CS_BASES];
9999
struct vdso_rng_data rng_data;
100+
101+
struct vdso_data data[CS_BASES] __aligned(1 << CONFIG_PAGE_SHIFT);
100102
};
101103

102104
#endif /* CONFIG_PPC64 */
@@ -105,29 +107,17 @@ extern struct vdso_arch_data *vdso_data;
105107

106108
#else /* __ASSEMBLY__ */
107109

108-
.macro get_datapage ptr
110+
.macro get_datapage ptr offset=0
109111
bcl 20, 31, .+4
110112
999:
111113
mflr \ptr
112-
addis \ptr, \ptr, (_vdso_datapage - 999b)@ha
113-
addi \ptr, \ptr, (_vdso_datapage - 999b)@l
114+
addis \ptr, \ptr, (_vdso_datapage - 999b + \offset)@ha
115+
addi \ptr, \ptr, (_vdso_datapage - 999b + \offset)@l
114116
.endm
115117

116118
#include <asm/asm-offsets.h>
117119
#include <asm/page.h>
118120

119-
.macro get_realdatapage ptr scratch
120-
get_datapage \ptr
121-
#ifdef CONFIG_TIME_NS
122-
lwz \scratch, VDSO_CLOCKMODE_OFFSET(\ptr)
123-
xoris \scratch, \scratch, VDSO_CLOCKMODE_TIMENS@h
124-
xori \scratch, \scratch, VDSO_CLOCKMODE_TIMENS@l
125-
cntlzw \scratch, \scratch
126-
rlwinm \scratch, \scratch, PAGE_SHIFT - 5, 1 << PAGE_SHIFT
127-
add \ptr, \ptr, \scratch
128-
#endif
129-
.endm
130-
131121
#endif /* __ASSEMBLY__ */
132122

133123
#endif /* __KERNEL__ */

arch/powerpc/kernel/asm-offsets.c

-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ int main(void)
335335

336336
/* datapage offsets for use by vdso */
337337
OFFSET(VDSO_DATA_OFFSET, vdso_arch_data, data);
338-
OFFSET(VDSO_RNG_DATA_OFFSET, vdso_arch_data, rng_data);
339338
OFFSET(CFG_TB_TICKS_PER_SEC, vdso_arch_data, tb_ticks_per_sec);
340339
#ifdef CONFIG_PPC64
341340
OFFSET(CFG_ICACHE_BLOCKSZ, vdso_arch_data, icache_block_size);

arch/powerpc/kernel/vdso.c

+10-6
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ long sys_ni_syscall(void);
4848
*/
4949
static union {
5050
struct vdso_arch_data data;
51-
u8 page[PAGE_SIZE];
51+
u8 page[2 * PAGE_SIZE];
5252
} vdso_data_store __page_aligned_data;
5353
struct vdso_arch_data *vdso_data = &vdso_data_store.data;
5454

5555
enum vvar_pages {
56-
VVAR_DATA_PAGE_OFFSET,
56+
VVAR_BASE_PAGE_OFFSET,
57+
VVAR_TIME_PAGE_OFFSET,
5758
VVAR_TIMENS_PAGE_OFFSET,
5859
VVAR_NR_PAGES,
5960
};
@@ -119,7 +120,7 @@ static struct vm_special_mapping vdso64_spec __ro_after_init = {
119120
#ifdef CONFIG_TIME_NS
120121
struct vdso_data *arch_get_vdso_data(void *vvar_page)
121122
{
122-
return ((struct vdso_arch_data *)vvar_page)->data;
123+
return vvar_page;
123124
}
124125

125126
/*
@@ -153,11 +154,14 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
153154
unsigned long pfn;
154155

155156
switch (vmf->pgoff) {
156-
case VVAR_DATA_PAGE_OFFSET:
157+
case VVAR_BASE_PAGE_OFFSET:
158+
pfn = virt_to_pfn(vdso_data);
159+
break;
160+
case VVAR_TIME_PAGE_OFFSET:
157161
if (timens_page)
158162
pfn = page_to_pfn(timens_page);
159163
else
160-
pfn = virt_to_pfn(vdso_data);
164+
pfn = virt_to_pfn(vdso_data->data);
161165
break;
162166
#ifdef CONFIG_TIME_NS
163167
case VVAR_TIMENS_PAGE_OFFSET:
@@ -170,7 +174,7 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
170174
*/
171175
if (!timens_page)
172176
return VM_FAULT_SIGBUS;
173-
pfn = virt_to_pfn(vdso_data);
177+
pfn = virt_to_pfn(vdso_data->data);
174178
break;
175179
#endif /* CONFIG_TIME_NS */
176180
default:

arch/powerpc/kernel/vdso/cacheflush.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
3030
#ifdef CONFIG_PPC64
3131
mflr r12
3232
.cfi_register lr,r12
33-
get_realdatapage r10, r11
33+
get_datapage r10
3434
mtlr r12
3535
.cfi_restore lr
3636
#endif

arch/powerpc/kernel/vdso/datapage.S

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map)
2828
mflr r12
2929
.cfi_register lr,r12
3030
mr. r4,r3
31-
get_realdatapage r3, r11
31+
get_datapage r3
3232
mtlr r12
3333
#ifdef __powerpc64__
3434
addi r3,r3,CFG_SYSCALL_MAP64
@@ -52,7 +52,7 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq)
5252
.cfi_startproc
5353
mflr r12
5454
.cfi_register lr,r12
55-
get_realdatapage r3, r11
55+
get_datapage r3
5656
#ifndef __powerpc64__
5757
lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
5858
#endif

arch/powerpc/kernel/vdso/getrandom.S

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
PPC_STL r2, PPC_MIN_STKFRM + STK_GOT(r1)
3232
.cfi_rel_offset r2, PPC_MIN_STKFRM + STK_GOT
3333
#endif
34-
get_realdatapage r8, r11
35-
addi r8, r8, VDSO_RNG_DATA_OFFSET
3634
bl CFUNC(DOTSYM(\funct))
3735
PPC_LL r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1)
3836
#ifdef __powerpc64__

arch/powerpc/kernel/vdso/gettimeofday.S

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@
3232
PPC_STL r2, PPC_MIN_STKFRM + STK_GOT(r1)
3333
.cfi_rel_offset r2, PPC_MIN_STKFRM + STK_GOT
3434
#endif
35-
get_datapage r5
3635
.ifeq \call_time
37-
addi r5, r5, VDSO_DATA_OFFSET
36+
get_datapage r5 VDSO_DATA_OFFSET
3837
.else
39-
addi r4, r5, VDSO_DATA_OFFSET
38+
get_datapage r4 VDSO_DATA_OFFSET
4039
.endif
4140
bl CFUNC(DOTSYM(\funct))
4241
PPC_LL r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1)

arch/powerpc/kernel/vdso/vdso32.lds.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ OUTPUT_ARCH(powerpc:common)
1616

1717
SECTIONS
1818
{
19-
PROVIDE(_vdso_datapage = . - 2 * PAGE_SIZE);
19+
PROVIDE(_vdso_datapage = . - 3 * PAGE_SIZE);
2020
. = SIZEOF_HEADERS;
2121

2222
.hash : { *(.hash) } :text

arch/powerpc/kernel/vdso/vdso64.lds.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ OUTPUT_ARCH(powerpc:common64)
1616

1717
SECTIONS
1818
{
19-
PROVIDE(_vdso_datapage = . - 2 * PAGE_SIZE);
19+
PROVIDE(_vdso_datapage = . - 3 * PAGE_SIZE);
2020
. = SIZEOF_HEADERS;
2121

2222
.hash : { *(.hash) } :text

arch/powerpc/kernel/vdso/vgetrandom.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <linux/types.h>
99

1010
ssize_t __c_kernel_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state,
11-
size_t opaque_len, const struct vdso_rng_data *vd)
11+
size_t opaque_len)
1212
{
13-
return __cvdso_getrandom_data(vd, buffer, len, flags, opaque_state, opaque_len);
13+
return __cvdso_getrandom(buffer, len, flags, opaque_state, opaque_len);
1414
}

tools/testing/selftests/vDSO/parse_vdso.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ void *vdso_sym(const char *version, const char *name)
222222
ELF(Sym) *sym = &vdso_info.symtab[chain];
223223

224224
/* Check for a defined global or weak function w/ right name. */
225-
if (ELF64_ST_TYPE(sym->st_info) != STT_FUNC &&
226-
ELF64_ST_TYPE(sym->st_info) != STT_NOTYPE)
225+
if (ELF64_ST_TYPE(sym->st_info) != STT_FUNC)
227226
continue;
228227
if (ELF64_ST_BIND(sym->st_info) != STB_GLOBAL &&
229228
ELF64_ST_BIND(sym->st_info) != STB_WEAK)

0 commit comments

Comments
 (0)