Date: Tue, 20 Jul 2021 07:10:29 GMT From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 09cffde975b8 - main - linux(4): Fixup the vDSO initialization order. Message-ID: <202107200710.16K7AT9U030356@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=09cffde975b87b293457c9a228cb980ec729384a commit 09cffde975b87b293457c9a228cb980ec729384a Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2021-07-20 07:02:34 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2021-07-20 07:02:34 +0000 linux(4): Fixup the vDSO initialization order. The vDSO initialisation order should be as follows: - native abi init via exec_sysvec_init(); - vDSO symbols queued to the linux_vdso_syms list; - linux_vdso_install(); - linux_exec_sysvec_init(); As the exec_sysvec_init() called with SI_ORDER_ANY (last) at SI_SUB_EXEC order, move linux_vdso_install() and linux_exec_sysvec_init() to the SI_SUB_EXEC+1 order. Reviewed by: trasz Differential Revision: https://reviews.freebsd.org/D30902 MFC after 2 weeks --- sys/amd64/linux/linux_sysvec.c | 8 ++++++-- sys/amd64/linux32/linux32_sysvec.c | 8 ++++++-- sys/arm64/linux/linux_sysvec.c | 8 ++++++-- sys/i386/linux/linux_sysvec.c | 13 +++++++++++-- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 999f22a410ab..2a429f323682 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -804,6 +804,10 @@ linux_on_exec_vmspace(struct proc *p, struct image_params *imgp) return (error); } +/* + * linux_vdso_install() and linux_exec_sysvec_init() must be called + * after exec_sysvec_init() which is SI_SUB_EXEC (SI_ORDER_ANY). + */ static void linux_exec_sysvec_init(void *param) { @@ -826,7 +830,7 @@ linux_exec_sysvec_init(void *param) if (bootverbose) printf("Linux x86-64 vDSO tsc_selector: %lu\n", *ktsc_selector); } -SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC + 1, SI_ORDER_ANY, linux_exec_sysvec_init, &elf_linux_sysvec); static void @@ -850,7 +854,7 @@ linux_vdso_install(const void *param) linux_vdso_reloc(linux_vdso_mapping, linux_vdso_base); } -SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_FIRST, +SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC + 1, SI_ORDER_FIRST, linux_vdso_install, NULL); static void diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 720df298b670..38b777fb5629 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -970,6 +970,10 @@ linux_on_exec_vmspace(struct proc *p, struct image_params *imgp) return (error); } +/* + * linux_vdso_install() and linux_exec_sysvec_init() must be called + * after exec_sysvec_init() which is SI_SUB_EXEC (SI_ORDER_ANY). + */ static void linux_exec_sysvec_init(void *param) { @@ -991,7 +995,7 @@ linux_exec_sysvec_init(void *param) if (bootverbose) printf("Linux i386 vDSO tsc_selector: %u\n", *ktsc_selector); } -SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC + 1, SI_ORDER_ANY, linux_exec_sysvec_init, &elf_linux_sysvec); static void @@ -1013,7 +1017,7 @@ linux_vdso_install(const void *param) linux_vdso_reloc(linux_vdso_mapping, linux_vdso_base); } -SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_FIRST, +SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC + 1, SI_ORDER_FIRST, linux_vdso_install, NULL); static void diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 1d467540fd36..247b6dc9fa3b 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -476,6 +476,10 @@ linux_on_exec_vmspace(struct proc *p, struct image_params *imgp) return (error); } +/* + * linux_vdso_install() and linux_exec_sysvec_init() must be called + * after exec_sysvec_init() which is SI_SUB_EXEC (SI_ORDER_ANY). + */ static void linux_exec_sysvec_init(void *param) { @@ -491,7 +495,7 @@ linux_exec_sysvec_init(void *param) ktimekeep_base = (l_uintptr_t *)(linux_vdso_mapping + tkoff); *ktimekeep_base = sv->sv_timekeep_base; } -SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC + 1, SI_ORDER_ANY, linux_exec_sysvec_init, &elf_linux_sysvec); static void @@ -513,7 +517,7 @@ linux_vdso_install(const void *param) linux_vdso_reloc(linux_vdso_mapping, linux_vdso_base); } -SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_FIRST, +SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC + 1, SI_ORDER_FIRST, linux_vdso_install, NULL); static void diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 833819101ed0..f3101db96d41 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -915,6 +915,10 @@ linux_on_exec_vmspace(struct proc *p, struct image_params *imgp) return (error); } +/* + * linux_vdso_install() and linux_exec_sysvec_init() must be called + * after exec_sysvec_init() which is SI_SUB_EXEC (SI_ORDER_ANY). + */ static void linux_exec_sysvec_init(void *param) { @@ -936,7 +940,7 @@ linux_exec_sysvec_init(void *param) if (bootverbose) printf("Linux i386 vDSO tsc_selector: %u\n", *ktsc_selector); } -SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC + 1, SI_ORDER_ANY, linux_exec_sysvec_init, &elf_linux_sysvec); static void @@ -958,7 +962,7 @@ linux_vdso_install(const void *param) linux_vdso_reloc(linux_vdso_mapping, linux_vdso_base); } -SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_FIRST, +SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC + 1, SI_ORDER_FIRST, linux_vdso_install, NULL); static void @@ -1169,3 +1173,8 @@ static moduledata_t linux_elf_mod = { DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); FEATURE(linux, "Linux 32bit support"); + +/* + * linux_vdso_install() and linux_exec_sysvec_init() must be called + * after exec_sysvec_init() which is SI_SUB_EXEC (SI_ORDER_ANY). + */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107200710.16K7AT9U030356>