Skip to content

Commit 74fc72e

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: vdso: remove aarch32_vdso_pages[]
The aarch32_vdso_pages[] array is unnecessarily confusing. We only ever use the C_VECTORS and C_SIGPAGE slots, and the other slots are unused despite having corresponding mappings (sharing pages with the AArch64 vDSO). Let's make this clearer by using separate variables for the vectors page and the sigreturn page. A subsequent patch will clean up the C_* naming and conflation of pages with mappings. Note that since both the vectors page and sig page are single pages, and the mapping is a single page long, their pages array do not need to be NULL-terminated (and this was not the case with the existing code for the sig page as it was the last entry in the aarch32_vdso_pages array). There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Vincenzo Frascino <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 86b8783 commit 74fc72e

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

arch/arm64/kernel/vdso.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,16 @@ static int aarch32_vdso_mremap(const struct vm_special_mapping *sm,
206206
#define C_SIGPAGE 1
207207
#define C_PAGES (C_SIGPAGE + 1)
208208
#endif /* CONFIG_COMPAT_VDSO */
209-
static struct page *aarch32_vdso_pages[C_PAGES] __ro_after_init;
209+
210+
static struct page *aarch32_vectors_page __ro_after_init;
211+
#ifndef CONFIG_COMPAT_VDSO
212+
static struct page *aarch32_sig_page __ro_after_init;
213+
#endif
214+
210215
static struct vm_special_mapping aarch32_vdso_spec[C_PAGES] = {
211216
{
212217
.name = "[vectors]", /* ABI */
213-
.pages = &aarch32_vdso_pages[C_VECTORS],
218+
.pages = &aarch32_vectors_page,
214219
},
215220
#ifdef CONFIG_COMPAT_VDSO
216221
{
@@ -223,7 +228,7 @@ static struct vm_special_mapping aarch32_vdso_spec[C_PAGES] = {
223228
#else
224229
{
225230
.name = "[sigpage]", /* ABI */
226-
.pages = &aarch32_vdso_pages[C_SIGPAGE],
231+
.pages = &aarch32_sig_page,
227232
},
228233
#endif /* CONFIG_COMPAT_VDSO */
229234
};
@@ -243,8 +248,8 @@ static int aarch32_alloc_kuser_vdso_page(void)
243248

244249
memcpy((void *)(vdso_page + 0x1000 - kuser_sz), __kuser_helper_start,
245250
kuser_sz);
246-
aarch32_vdso_pages[C_VECTORS] = virt_to_page(vdso_page);
247-
flush_dcache_page(aarch32_vdso_pages[C_VECTORS]);
251+
aarch32_vectors_page = virt_to_page(vdso_page);
252+
flush_dcache_page(aarch32_vectors_page);
248253
return 0;
249254
}
250255

@@ -275,8 +280,8 @@ static int __aarch32_alloc_vdso_pages(void)
275280
return -ENOMEM;
276281

277282
memcpy((void *)sigpage, __aarch32_sigret_code_start, sigret_sz);
278-
aarch32_vdso_pages[C_SIGPAGE] = virt_to_page(sigpage);
279-
flush_dcache_page(aarch32_vdso_pages[C_SIGPAGE]);
283+
aarch32_sig_page = virt_to_page(sigpage);
284+
flush_dcache_page(aarch32_sig_page);
280285

281286
ret = aarch32_alloc_kuser_vdso_page();
282287
if (ret)

0 commit comments

Comments
 (0)