git: 39f259b1d5a8 - stable/13 - Do not call FreeBSD-ABI specific code for all ABIs
Konstantin Belousov
kib at FreeBSD.org
Wed Jul 21 22:31:10 UTC 2021
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=39f259b1d5a8df8ed821153b48877bf4beb5a4eb
commit 39f259b1d5a8df8ed821153b48877bf4beb5a4eb
Author: Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-07-01 18:00:29 +0000
Commit: Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-07-21 22:11:52 +0000
Do not call FreeBSD-ABI specific code for all ABIs
(cherry picked from commit 28a66fc3da3460850520389971e1194f5327f560)
---
sys/amd64/amd64/elf_machdep.c | 4 ++++
sys/arm/arm/elf_machdep.c | 2 ++
sys/arm64/arm64/elf32_machdep.c | 2 ++
sys/arm64/arm64/elf_machdep.c | 2 ++
sys/compat/ia32/ia32_sysvec.c | 2 ++
sys/i386/i386/elf_machdep.c | 2 ++
sys/kern/imgact_aout.c | 4 ++++
sys/kern/kern_exec.c | 9 +++++++--
sys/kern/kern_exit.c | 8 +++++++-
sys/mips/mips/elf_machdep.c | 2 ++
sys/powerpc/powerpc/elf32_machdep.c | 2 ++
sys/powerpc/powerpc/elf64_machdep.c | 4 ++++
sys/riscv/riscv/elf_machdep.c | 2 ++
sys/sys/sysent.h | 3 +++
14 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c
index a3fb1184bb05..445efa883fd2 100644
--- a/sys/amd64/amd64/elf_machdep.c
+++ b/sys/amd64/amd64/elf_machdep.c
@@ -82,6 +82,8 @@ struct sysentvec elf64_freebsd_sysvec_la48 = {
.sv_thread_detach = NULL,
.sv_trap = NULL,
.sv_stackgap = elf64_stackgap,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
struct sysentvec elf64_freebsd_sysvec_la57 = {
@@ -117,6 +119,8 @@ struct sysentvec elf64_freebsd_sysvec_la57 = {
.sv_thread_detach = NULL,
.sv_trap = NULL,
.sv_stackgap = elf64_stackgap,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
static void
diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c
index d32dbb5baf90..6eaea9b92f2f 100644
--- a/sys/arm/arm/elf_machdep.c
+++ b/sys/arm/arm/elf_machdep.c
@@ -97,6 +97,8 @@ struct sysentvec elf32_freebsd_sysvec = {
.sv_trap = NULL,
.sv_hwcap = &elf_hwcap,
.sv_hwcap2 = &elf_hwcap2,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c
index 6c98f7c839ca..48d6dc189e3a 100644
--- a/sys/arm64/arm64/elf32_machdep.c
+++ b/sys/arm64/arm64/elf32_machdep.c
@@ -109,6 +109,8 @@ static struct sysentvec elf32_freebsd_sysvec = {
.sv_schedtail = NULL,
.sv_thread_detach = NULL,
.sv_trap = NULL,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
diff --git a/sys/arm64/arm64/elf_machdep.c b/sys/arm64/arm64/elf_machdep.c
index cd12d40c37df..102097b2dbb5 100644
--- a/sys/arm64/arm64/elf_machdep.c
+++ b/sys/arm64/arm64/elf_machdep.c
@@ -92,6 +92,8 @@ static struct sysentvec elf64_freebsd_sysvec = {
.sv_trap = NULL,
.sv_hwcap = &elf_hwcap,
.sv_hwcap2 = &elf_hwcap2,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c
index f5a2c1200fc6..3973811ab62b 100644
--- a/sys/compat/ia32/ia32_sysvec.c
+++ b/sys/compat/ia32/ia32_sysvec.c
@@ -128,6 +128,8 @@ struct sysentvec ia32_freebsd_sysvec = {
.sv_thread_detach = NULL,
.sv_trap = NULL,
.sv_stackgap = elf32_stackgap,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
INIT_SYSENTVEC(elf_ia32_sysvec, &ia32_freebsd_sysvec);
diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c
index 0d870748967e..ef808e65fd9a 100644
--- a/sys/i386/i386/elf_machdep.c
+++ b/sys/i386/i386/elf_machdep.c
@@ -83,6 +83,8 @@ struct sysentvec elf32_freebsd_sysvec = {
.sv_schedtail = NULL,
.sv_thread_detach = NULL,
.sv_trap = NULL,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c
index 3255ef169f70..9e7455e14e1d 100644
--- a/sys/kern/imgact_aout.c
+++ b/sys/kern/imgact_aout.c
@@ -101,6 +101,8 @@ struct sysentvec aout_sysvec = {
.sv_schedtail = NULL,
.sv_thread_detach = NULL,
.sv_trap = NULL,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
#elif defined(__amd64__)
@@ -137,6 +139,8 @@ struct sysentvec aout_sysvec = {
.sv_set_syscall_retval = ia32_set_syscall_retval,
.sv_fetch_syscall_args = ia32_fetch_syscall_args,
.sv_syscallnames = freebsd32_syscallnames,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
#else
#error "Port me"
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index de1294ff6954..491e5332c834 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1033,6 +1033,13 @@ exec_unmap_first_page(struct image_params *imgp)
}
}
+void
+exec_onexec_old(struct thread *td)
+{
+ sigfastblock_clear(td);
+ umtx_exec(td->td_proc);
+}
+
/*
* Destroy old address space, and allocate a new stack.
* The new stack is only sgrowsiz large because it is grown
@@ -1055,8 +1062,6 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv)
imgp->vmspace_destroyed = 1;
imgp->sysent = sv;
- sigfastblock_clear(td);
- umtx_exec(p);
if (p->p_sysent->sv_onexec_old != NULL)
p->p_sysent->sv_onexec_old(td);
itimers_exec(p);
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 515c2d4e6397..bfd25366b49c 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -195,6 +195,13 @@ proc_clear_orphan(struct proc *p)
p->p_treeflag &= ~P_TREE_ORPHANED;
}
+void
+exit_onexit(struct proc *p)
+{
+ MPASS(p->p_numthreads == 1);
+ umtx_thread_exit(FIRST_THREAD_IN_PROC(p));
+}
+
/*
* exit -- death of process.
*/
@@ -370,7 +377,6 @@ exit1(struct thread *td, int rval, int signo)
PROC_UNLOCK(p);
- umtx_thread_exit(td);
if (p->p_sysent->sv_onexit != NULL)
p->p_sysent->sv_onexit(p);
seltdfini(td);
diff --git a/sys/mips/mips/elf_machdep.c b/sys/mips/mips/elf_machdep.c
index 9e27e5e7f2a4..8ac07a5b0ac6 100644
--- a/sys/mips/mips/elf_machdep.c
+++ b/sys/mips/mips/elf_machdep.c
@@ -89,6 +89,8 @@ static struct sysentvec elf_freebsd_sysvec = {
.sv_schedtail = NULL,
.sv_thread_detach = NULL,
.sv_trap = NULL,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
static __ElfN(Brandinfo) freebsd_brand_info = {
diff --git a/sys/powerpc/powerpc/elf32_machdep.c b/sys/powerpc/powerpc/elf32_machdep.c
index 04150f02bb9c..e98b4c3f08c2 100644
--- a/sys/powerpc/powerpc/elf32_machdep.c
+++ b/sys/powerpc/powerpc/elf32_machdep.c
@@ -131,6 +131,8 @@ struct sysentvec elf32_freebsd_sysvec = {
.sv_trap = NULL,
.sv_hwcap = &cpu_features,
.sv_hwcap2 = &cpu_features2,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
diff --git a/sys/powerpc/powerpc/elf64_machdep.c b/sys/powerpc/powerpc/elf64_machdep.c
index 1bca857d9ca5..37765381745e 100644
--- a/sys/powerpc/powerpc/elf64_machdep.c
+++ b/sys/powerpc/powerpc/elf64_machdep.c
@@ -93,6 +93,8 @@ struct sysentvec elf64_freebsd_sysvec_v1 = {
.sv_trap = NULL,
.sv_hwcap = &cpu_features,
.sv_hwcap2 = &cpu_features2,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
struct sysentvec elf64_freebsd_sysvec_v2 = {
@@ -129,6 +131,8 @@ struct sysentvec elf64_freebsd_sysvec_v2 = {
.sv_trap = NULL,
.sv_hwcap = &cpu_features,
.sv_hwcap2 = &cpu_features2,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
static boolean_t ppc64_elfv1_header_match(struct image_params *params,
diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c
index 06d117128ef7..cf479ec6d154 100644
--- a/sys/riscv/riscv/elf_machdep.c
+++ b/sys/riscv/riscv/elf_machdep.c
@@ -96,6 +96,8 @@ struct sysentvec elf64_freebsd_sysvec = {
.sv_trap = NULL,
.sv_hwcap = &elf_hwcap,
.sv_machine_arch = riscv_machine_arch,
+ .sv_onexec_old = exec_onexec_old,
+ .sv_onexit = exit_onexit,
};
INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h
index ff37806efd96..a6b4b9fe9378 100644
--- a/sys/sys/sysent.h
+++ b/sys/sys/sysent.h
@@ -317,6 +317,9 @@ void exec_sysvec_init(void *param);
void exec_sysvec_init_secondary(struct sysentvec *sv, struct sysentvec *sv2);
void exec_inittk(void);
+void exit_onexit(struct proc *p);
+void exec_onexec_old(struct thread *td);
+
#define INIT_SYSENTVEC(name, sv) \
SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY, \
(sysinit_cfunc_t)exec_sysvec_init, sv);
More information about the dev-commits-src-all
mailing list