13911ee2cSEd Maste /*-
24d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause
33911ee2cSEd Maste *
43911ee2cSEd Maste * Copyright (c) 1994-1996 Søren Schmidt
53911ee2cSEd Maste * Copyright (c) 2018 Turing Robotic Industries Inc.
63911ee2cSEd Maste *
73911ee2cSEd Maste * Redistribution and use in source and binary forms, with or without
83911ee2cSEd Maste * modification, are permitted provided that the following conditions
93911ee2cSEd Maste * are met:
103911ee2cSEd Maste * 1. Redistributions of source code must retain the above copyright
113911ee2cSEd Maste * notice, this list of conditions and the following disclaimer.
123911ee2cSEd Maste * 2. Redistributions in binary form must reproduce the above copyright
133911ee2cSEd Maste * notice, this list of conditions and the following disclaimer in the
143911ee2cSEd Maste * documentation and/or other materials provided with the distribution.
153911ee2cSEd Maste *
163911ee2cSEd Maste * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
173911ee2cSEd Maste * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
183911ee2cSEd Maste * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
193911ee2cSEd Maste * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
203911ee2cSEd Maste * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
213911ee2cSEd Maste * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
223911ee2cSEd Maste * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
233911ee2cSEd Maste * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
243911ee2cSEd Maste * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
253911ee2cSEd Maste * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
263911ee2cSEd Maste * SUCH DAMAGE.
273911ee2cSEd Maste */
283911ee2cSEd Maste
2974465145SDmitry Chagin #define __ELF_WORD_SIZE 64
3074465145SDmitry Chagin
313911ee2cSEd Maste #include <sys/param.h>
323911ee2cSEd Maste #include <sys/elf.h>
333911ee2cSEd Maste #include <sys/exec.h>
343911ee2cSEd Maste #include <sys/imgact.h>
353911ee2cSEd Maste #include <sys/imgact_elf.h>
363911ee2cSEd Maste #include <sys/kernel.h>
37ccc510b4SEdward Tomasz Napierala #include <sys/ktr.h>
383911ee2cSEd Maste #include <sys/lock.h>
393911ee2cSEd Maste #include <sys/module.h>
403911ee2cSEd Maste #include <sys/mutex.h>
413911ee2cSEd Maste #include <sys/proc.h>
429931033bSDmitry Chagin #include <sys/stddef.h>
43ccc510b4SEdward Tomasz Napierala #include <sys/syscallsubr.h>
443911ee2cSEd Maste #include <sys/sysctl.h>
453911ee2cSEd Maste #include <sys/sysent.h>
463911ee2cSEd Maste
4755d3e181SDmitry Chagin #include <vm/vm.h>
48027d727dSDmitry Chagin #include <vm/vm_param.h>
493911ee2cSEd Maste
503911ee2cSEd Maste #include <arm64/linux/linux.h>
513911ee2cSEd Maste #include <arm64/linux/linux_proto.h>
5274465145SDmitry Chagin #include <compat/linux/linux_elf.h>
533911ee2cSEd Maste #include <compat/linux/linux_emul.h>
540a4b664aSDmitry Chagin #include <compat/linux/linux_fork.h>
553911ee2cSEd Maste #include <compat/linux/linux_ioctl.h>
563911ee2cSEd Maste #include <compat/linux/linux_mib.h>
573911ee2cSEd Maste #include <compat/linux/linux_misc.h>
58ccc510b4SEdward Tomasz Napierala #include <compat/linux/linux_signal.h>
59b5f20658SEdward Tomasz Napierala #include <compat/linux/linux_util.h>
603911ee2cSEd Maste #include <compat/linux/linux_vdso.h>
613911ee2cSEd Maste
6221f24617SDmitry Chagin #include <arm64/linux/linux_sigframe.h>
6321f24617SDmitry Chagin
64b501b2aeSEdward Tomasz Napierala #include <machine/md_var.h>
652555f175SKonstantin Belousov #include <machine/pcb.h>
66953a7d7cSAlex Richardson #ifdef VFP
67953a7d7cSAlex Richardson #include <machine/vfp.h>
68953a7d7cSAlex Richardson #endif
69953a7d7cSAlex Richardson
703911ee2cSEd Maste MODULE_VERSION(linux64elf, 1);
713911ee2cSEd Maste
729931033bSDmitry Chagin #define LINUX_VDSOPAGE_SIZE PAGE_SIZE * 2
739931033bSDmitry Chagin #define LINUX_VDSOPAGE (VM_MAXUSER_ADDRESS - \
749931033bSDmitry Chagin LINUX_VDSOPAGE_SIZE)
759931033bSDmitry Chagin #define LINUX_SHAREDPAGE (LINUX_VDSOPAGE - PAGE_SIZE)
769931033bSDmitry Chagin /*
779931033bSDmitry Chagin * PAGE_SIZE - the size
789931033bSDmitry Chagin * of the native SHAREDPAGE
799931033bSDmitry Chagin */
809931033bSDmitry Chagin #define LINUX_USRSTACK LINUX_SHAREDPAGE
819931033bSDmitry Chagin #define LINUX_PS_STRINGS (LINUX_USRSTACK - \
829931033bSDmitry Chagin sizeof(struct ps_strings))
839931033bSDmitry Chagin
843911ee2cSEd Maste static int linux_szsigcode;
859931033bSDmitry Chagin static vm_object_t linux_vdso_obj;
869931033bSDmitry Chagin static char *linux_vdso_mapping;
879931033bSDmitry Chagin extern char _binary_linux_vdso_so_o_start;
889931033bSDmitry Chagin extern char _binary_linux_vdso_so_o_end;
899931033bSDmitry Chagin static vm_offset_t linux_vdso_base;
903911ee2cSEd Maste
913911ee2cSEd Maste extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
921da65dcbSMitchell Horne extern const char *linux_syscallnames[];
933911ee2cSEd Maste
943911ee2cSEd Maste SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
953911ee2cSEd Maste
963911ee2cSEd Maste static void linux_vdso_install(const void *param);
973911ee2cSEd Maste static void linux_vdso_deinstall(const void *param);
989931033bSDmitry Chagin static void linux_vdso_reloc(char *mapping, Elf_Addr offset);
993911ee2cSEd Maste static void linux_set_syscall_retval(struct thread *td, int error);
1003911ee2cSEd Maste static int linux_fetch_syscall_args(struct thread *td);
1013911ee2cSEd Maste static void linux_exec_setregs(struct thread *td, struct image_params *imgp,
10231174518SJohn Baldwin uintptr_t stack);
1039931033bSDmitry Chagin static void linux_exec_sysvec_init(void *param);
1045fd9cd53SDmitry Chagin static int linux_on_exec_vmspace(struct proc *p,
1055fd9cd53SDmitry Chagin struct image_params *imgp);
1063911ee2cSEd Maste
1079931033bSDmitry Chagin LINUX_VDSO_SYM_CHAR(linux_platform);
1089931033bSDmitry Chagin LINUX_VDSO_SYM_INTPTR(kern_timekeep_base);
109d957343fSDmitry Chagin LINUX_VDSO_SYM_INTPTR(__user_rt_sigreturn);
1109931033bSDmitry Chagin
1113911ee2cSEd Maste static int
linux_fetch_syscall_args(struct thread * td)1123911ee2cSEd Maste linux_fetch_syscall_args(struct thread *td)
1133911ee2cSEd Maste {
1143911ee2cSEd Maste struct proc *p;
1153911ee2cSEd Maste struct syscall_args *sa;
1163911ee2cSEd Maste register_t *ap;
1173911ee2cSEd Maste
1183911ee2cSEd Maste p = td->td_proc;
1193911ee2cSEd Maste ap = td->td_frame->tf_x;
1203911ee2cSEd Maste sa = &td->td_sa;
1213911ee2cSEd Maste
1223911ee2cSEd Maste sa->code = td->td_frame->tf_x[8];
123cf98bc28SDavid Chisnall sa->original_code = sa->code;
12403f5bd1eSDmitry Chagin
1253911ee2cSEd Maste if (sa->code >= p->p_sysent->sv_size)
12639024a89SKonstantin Belousov sa->callp = &nosys_sysent;
1273911ee2cSEd Maste else
1283911ee2cSEd Maste sa->callp = &p->p_sysent->sv_table[sa->code];
1293911ee2cSEd Maste
130adb12675SBrooks Davis if (sa->callp->sy_narg > nitems(sa->args))
131adb12675SBrooks Davis panic("ARM64TODO: Could we have more than %zu args?",
132adb12675SBrooks Davis nitems(sa->args));
133adb12675SBrooks Davis memcpy(sa->args, ap, nitems(sa->args) * sizeof(register_t));
1343911ee2cSEd Maste
1353911ee2cSEd Maste td->td_retval[0] = 0;
1363911ee2cSEd Maste return (0);
1373911ee2cSEd Maste }
1383911ee2cSEd Maste
1393911ee2cSEd Maste static void
linux_set_syscall_retval(struct thread * td,int error)1403911ee2cSEd Maste linux_set_syscall_retval(struct thread *td, int error)
1413911ee2cSEd Maste {
1423911ee2cSEd Maste
1438e5d76e6SAndrew Turner td->td_retval[1] = td->td_frame->tf_x[1];
1448e5d76e6SAndrew Turner cpu_set_syscall_retval(td, error);
145c26391f4SEdward Tomasz Napierala
146c26391f4SEdward Tomasz Napierala if (__predict_false(error != 0)) {
147866b1f51SEdward Tomasz Napierala if (error != ERESTART && error != EJUSTRETURN)
148866b1f51SEdward Tomasz Napierala td->td_frame->tf_x[0] = bsd_to_linux_errno(error);
149c26391f4SEdward Tomasz Napierala }
1503911ee2cSEd Maste }
1513911ee2cSEd Maste
1527d8c9839SDmitry Chagin void
linux64_arch_copyout_auxargs(struct image_params * imgp,Elf_Auxinfo ** pos)1537d8c9839SDmitry Chagin linux64_arch_copyout_auxargs(struct image_params *imgp, Elf_Auxinfo **pos)
1543911ee2cSEd Maste {
1553911ee2cSEd Maste
1567d8c9839SDmitry Chagin AUXARGS_ENTRY((*pos), LINUX_AT_SYSINFO_EHDR, linux_vdso_base);
1577d8c9839SDmitry Chagin AUXARGS_ENTRY((*pos), LINUX_AT_HWCAP, *imgp->sysent->sv_hwcap);
1587d8c9839SDmitry Chagin AUXARGS_ENTRY((*pos), LINUX_AT_HWCAP2, *imgp->sysent->sv_hwcap2);
159fc04d822SAndrew Turner AUXARGS_ENTRY((*pos), LINUX_AT_HWCAP3, *imgp->sysent->sv_hwcap3);
160fc04d822SAndrew Turner AUXARGS_ENTRY((*pos), LINUX_AT_HWCAP4, *imgp->sysent->sv_hwcap4);
1617d8c9839SDmitry Chagin AUXARGS_ENTRY((*pos), LINUX_AT_PLATFORM, PTROUT(linux_platform));
1625caa67faSJohn Baldwin }
1635caa67faSJohn Baldwin
1643911ee2cSEd Maste /*
1653911ee2cSEd Maste * Reset registers to default values on exec.
1663911ee2cSEd Maste */
1673911ee2cSEd Maste static void
linux_exec_setregs(struct thread * td,struct image_params * imgp,uintptr_t stack)16831174518SJohn Baldwin linux_exec_setregs(struct thread *td, struct image_params *imgp,
16931174518SJohn Baldwin uintptr_t stack)
1703911ee2cSEd Maste {
1713911ee2cSEd Maste struct trapframe *regs = td->td_frame;
172a2a8b582SMitchell Horne struct pcb *pcb = td->td_pcb;
1733911ee2cSEd Maste
1743911ee2cSEd Maste memset(regs, 0, sizeof(*regs));
1753911ee2cSEd Maste regs->tf_sp = stack;
1763911ee2cSEd Maste regs->tf_elr = imgp->entry_addr;
177a2a8b582SMitchell Horne pcb->pcb_tpidr_el0 = 0;
178a2a8b582SMitchell Horne pcb->pcb_tpidrro_el0 = 0;
1790723b409SJohn Baldwin WRITE_SPECIALREG(tpidrro_el0, 0);
1800723b409SJohn Baldwin WRITE_SPECIALREG(tpidr_el0, 0);
1810723b409SJohn Baldwin
182953a7d7cSAlex Richardson #ifdef VFP
183a2a8b582SMitchell Horne vfp_reset_state(td, pcb);
184953a7d7cSAlex Richardson #endif
185a2a8b582SMitchell Horne
186a2a8b582SMitchell Horne /*
187a2a8b582SMitchell Horne * Clear debug register state. It is not applicable to the new process.
188a2a8b582SMitchell Horne */
189a2a8b582SMitchell Horne bzero(&pcb->pcb_dbg_regs, sizeof(pcb->pcb_dbg_regs));
1903911ee2cSEd Maste }
1913911ee2cSEd Maste
192070a4ff8SAndrew Turner static bool
linux_parse_sigreturn_ctx(struct thread * td,struct l_sigcontext * sc)193070a4ff8SAndrew Turner linux_parse_sigreturn_ctx(struct thread *td, struct l_sigcontext *sc)
194070a4ff8SAndrew Turner {
195070a4ff8SAndrew Turner struct l_fpsimd_context *fpsimd;
196070a4ff8SAndrew Turner struct _l_aarch64_ctx *ctx;
197070a4ff8SAndrew Turner int offset;
198070a4ff8SAndrew Turner
199070a4ff8SAndrew Turner offset = 0;
200070a4ff8SAndrew Turner while (1) {
201070a4ff8SAndrew Turner /* The offset must be 16 byte aligned */
202070a4ff8SAndrew Turner if ((offset & 15) != 0)
203070a4ff8SAndrew Turner return (false);
204070a4ff8SAndrew Turner
205070a4ff8SAndrew Turner /* Check for buffer overflow of the ctx */
206070a4ff8SAndrew Turner if ((offset + sizeof(*ctx)) >
207070a4ff8SAndrew Turner sizeof(sc->__reserved))
208070a4ff8SAndrew Turner return (false);
209070a4ff8SAndrew Turner
210070a4ff8SAndrew Turner ctx = (struct _l_aarch64_ctx *)&sc->__reserved[offset];
211070a4ff8SAndrew Turner
212070a4ff8SAndrew Turner /* Check for buffer overflow of the data */
213070a4ff8SAndrew Turner if ((offset + ctx->size) > sizeof(sc->__reserved))
214070a4ff8SAndrew Turner return (false);
215070a4ff8SAndrew Turner
216070a4ff8SAndrew Turner switch(ctx->magic) {
217070a4ff8SAndrew Turner case 0:
218070a4ff8SAndrew Turner if (ctx->size != 0)
219070a4ff8SAndrew Turner return (false);
220070a4ff8SAndrew Turner return (true);
221070a4ff8SAndrew Turner case L_ESR_MAGIC:
222070a4ff8SAndrew Turner /* Ignore */
223070a4ff8SAndrew Turner break;
224070a4ff8SAndrew Turner #ifdef VFP
225070a4ff8SAndrew Turner case L_FPSIMD_MAGIC:
226070a4ff8SAndrew Turner fpsimd = (struct l_fpsimd_context *)ctx;
227070a4ff8SAndrew Turner
228070a4ff8SAndrew Turner /*
229070a4ff8SAndrew Turner * Discard any vfp state for the current thread, we
230070a4ff8SAndrew Turner * are about to override it.
231070a4ff8SAndrew Turner */
232070a4ff8SAndrew Turner critical_enter();
233070a4ff8SAndrew Turner vfp_discard(td);
234070a4ff8SAndrew Turner critical_exit();
235070a4ff8SAndrew Turner
236070a4ff8SAndrew Turner td->td_pcb->pcb_fpustate.vfp_fpcr = fpsimd->fpcr;
237070a4ff8SAndrew Turner td->td_pcb->pcb_fpustate.vfp_fpsr = fpsimd->fpsr;
238070a4ff8SAndrew Turner memcpy(td->td_pcb->pcb_fpustate.vfp_regs,
239070a4ff8SAndrew Turner fpsimd->vregs, sizeof(fpsimd->vregs));
240070a4ff8SAndrew Turner
241070a4ff8SAndrew Turner break;
242070a4ff8SAndrew Turner #endif
243070a4ff8SAndrew Turner default:
244070a4ff8SAndrew Turner return (false);
245070a4ff8SAndrew Turner }
246070a4ff8SAndrew Turner
247070a4ff8SAndrew Turner offset += ctx->size;
248070a4ff8SAndrew Turner }
249070a4ff8SAndrew Turner
250070a4ff8SAndrew Turner }
251070a4ff8SAndrew Turner
2523911ee2cSEd Maste int
linux_rt_sigreturn(struct thread * td,struct linux_rt_sigreturn_args * args)2533911ee2cSEd Maste linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args)
2543911ee2cSEd Maste {
255070a4ff8SAndrew Turner struct l_rt_sigframe *sf;
256c56480a8SDmitry Chagin struct l_sigframe *frame;
257ccc510b4SEdward Tomasz Napierala struct trapframe *tf;
258070a4ff8SAndrew Turner sigset_t bmask;
259ccc510b4SEdward Tomasz Napierala int error;
2603911ee2cSEd Maste
261070a4ff8SAndrew Turner sf = malloc(sizeof(*sf), M_LINUX, M_WAITOK | M_ZERO);
262070a4ff8SAndrew Turner
263ccc510b4SEdward Tomasz Napierala tf = td->td_frame;
264c56480a8SDmitry Chagin frame = (struct l_sigframe *)tf->tf_sp;
265070a4ff8SAndrew Turner error = copyin((void *)&frame->sf, sf, sizeof(*sf));
266070a4ff8SAndrew Turner if (error != 0) {
267070a4ff8SAndrew Turner free(sf, M_LINUX);
268ccc510b4SEdward Tomasz Napierala return (error);
269070a4ff8SAndrew Turner }
270070a4ff8SAndrew Turner
271070a4ff8SAndrew Turner memcpy(tf->tf_x, sf->sf_uc.uc_sc.regs, sizeof(tf->tf_x));
272070a4ff8SAndrew Turner tf->tf_lr = sf->sf_uc.uc_sc.regs[30];
273070a4ff8SAndrew Turner tf->tf_sp = sf->sf_uc.uc_sc.sp;
274070a4ff8SAndrew Turner tf->tf_elr = sf->sf_uc.uc_sc.pc;
275070a4ff8SAndrew Turner
276070a4ff8SAndrew Turner if ((sf->sf_uc.uc_sc.pstate & PSR_M_MASK) != PSR_M_EL0t ||
277070a4ff8SAndrew Turner (sf->sf_uc.uc_sc.pstate & PSR_AARCH32) != 0 ||
278070a4ff8SAndrew Turner (sf->sf_uc.uc_sc.pstate & PSR_DAIF) !=
279070a4ff8SAndrew Turner (td->td_frame->tf_spsr & PSR_DAIF))
280070a4ff8SAndrew Turner goto einval;
281070a4ff8SAndrew Turner tf->tf_spsr = sf->sf_uc.uc_sc.pstate;
282070a4ff8SAndrew Turner
283070a4ff8SAndrew Turner if (!linux_parse_sigreturn_ctx(td, &sf->sf_uc.uc_sc))
284070a4ff8SAndrew Turner goto einval;
285ccc510b4SEdward Tomasz Napierala
286ccc510b4SEdward Tomasz Napierala /* Restore signal mask. */
287070a4ff8SAndrew Turner linux_to_bsd_sigset(&sf->sf_uc.uc_sigmask, &bmask);
288070a4ff8SAndrew Turner kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0);
289070a4ff8SAndrew Turner free(sf, M_LINUX);
290ccc510b4SEdward Tomasz Napierala
291ccc510b4SEdward Tomasz Napierala return (EJUSTRETURN);
292070a4ff8SAndrew Turner einval:
293070a4ff8SAndrew Turner free(sf, M_LINUX);
294070a4ff8SAndrew Turner return (EINVAL);
2953911ee2cSEd Maste }
2963911ee2cSEd Maste
2973911ee2cSEd Maste static void
linux_rt_sendsig(sig_t catcher,ksiginfo_t * ksi,sigset_t * mask)2983911ee2cSEd Maste linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
2993911ee2cSEd Maste {
300ccc510b4SEdward Tomasz Napierala struct thread *td;
301ccc510b4SEdward Tomasz Napierala struct proc *p;
302ccc510b4SEdward Tomasz Napierala struct trapframe *tf;
303c56480a8SDmitry Chagin struct l_sigframe *fp, *frame;
304c56480a8SDmitry Chagin struct l_fpsimd_context *fpsimd;
305c56480a8SDmitry Chagin struct l_esr_context *esr;
306c56480a8SDmitry Chagin l_stack_t uc_stack;
307c56480a8SDmitry Chagin ucontext_t uc;
308c56480a8SDmitry Chagin uint8_t *scr;
309ccc510b4SEdward Tomasz Napierala struct sigacts *psp;
310109fd18aSDmitry Chagin int onstack, sig, issiginfo;
3113911ee2cSEd Maste
312ccc510b4SEdward Tomasz Napierala td = curthread;
313ccc510b4SEdward Tomasz Napierala p = td->td_proc;
314ccc510b4SEdward Tomasz Napierala PROC_LOCK_ASSERT(p, MA_OWNED);
315ccc510b4SEdward Tomasz Napierala
316ccc510b4SEdward Tomasz Napierala sig = ksi->ksi_signo;
317ccc510b4SEdward Tomasz Napierala psp = p->p_sigacts;
318ccc510b4SEdward Tomasz Napierala mtx_assert(&psp->ps_mtx, MA_OWNED);
319ccc510b4SEdward Tomasz Napierala
320ccc510b4SEdward Tomasz Napierala tf = td->td_frame;
321ccc510b4SEdward Tomasz Napierala onstack = sigonstack(tf->tf_sp);
322109fd18aSDmitry Chagin issiginfo = SIGISMEMBER(psp->ps_siginfo, sig);
323ccc510b4SEdward Tomasz Napierala
324ccc510b4SEdward Tomasz Napierala CTR4(KTR_SIG, "sendsig: td=%p (%s) catcher=%p sig=%d", td, p->p_comm,
325ccc510b4SEdward Tomasz Napierala catcher, sig);
326ccc510b4SEdward Tomasz Napierala
327ccc510b4SEdward Tomasz Napierala /* Allocate and validate space for the signal handler context. */
328ccc510b4SEdward Tomasz Napierala if ((td->td_pflags & TDP_ALTSTACK) != 0 && !onstack &&
329ccc510b4SEdward Tomasz Napierala SIGISMEMBER(psp->ps_sigonstack, sig)) {
330ccc510b4SEdward Tomasz Napierala fp = (struct l_sigframe *)((uintptr_t)td->td_sigstk.ss_sp +
331ccc510b4SEdward Tomasz Napierala td->td_sigstk.ss_size);
332ccc510b4SEdward Tomasz Napierala #if defined(COMPAT_43)
333ccc510b4SEdward Tomasz Napierala td->td_sigstk.ss_flags |= SS_ONSTACK;
334ccc510b4SEdward Tomasz Napierala #endif
335ccc510b4SEdward Tomasz Napierala } else {
336ccc510b4SEdward Tomasz Napierala fp = (struct l_sigframe *)td->td_frame->tf_sp;
337ccc510b4SEdward Tomasz Napierala }
338ccc510b4SEdward Tomasz Napierala
339ccc510b4SEdward Tomasz Napierala /* Make room, keeping the stack aligned */
340ccc510b4SEdward Tomasz Napierala fp--;
341*e9a697bfSJohn Baldwin fp = STACKALIGN(fp);
342ccc510b4SEdward Tomasz Napierala
343c56480a8SDmitry Chagin get_mcontext(td, &uc.uc_mcontext, 0);
344c56480a8SDmitry Chagin uc.uc_sigmask = *mask;
345ccc510b4SEdward Tomasz Napierala
346c56480a8SDmitry Chagin uc_stack.ss_sp = PTROUT(td->td_sigstk.ss_sp);
347c56480a8SDmitry Chagin uc_stack.ss_size = td->td_sigstk.ss_size;
348c56480a8SDmitry Chagin uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) != 0 ?
349c56480a8SDmitry Chagin (onstack ? LINUX_SS_ONSTACK : 0) : LINUX_SS_DISABLE;
350ccc510b4SEdward Tomasz Napierala mtx_unlock(&psp->ps_mtx);
351ccc510b4SEdward Tomasz Napierala PROC_UNLOCK(td->td_proc);
352ccc510b4SEdward Tomasz Napierala
353c56480a8SDmitry Chagin /* Fill in the frame to copy out */
354c56480a8SDmitry Chagin frame = malloc(sizeof(*frame), M_LINUX, M_WAITOK | M_ZERO);
355c56480a8SDmitry Chagin
356c56480a8SDmitry Chagin memcpy(&frame->sf.sf_uc.uc_sc.regs, tf->tf_x, sizeof(tf->tf_x));
357c56480a8SDmitry Chagin frame->sf.sf_uc.uc_sc.regs[30] = tf->tf_lr;
358c56480a8SDmitry Chagin frame->sf.sf_uc.uc_sc.sp = tf->tf_sp;
359bf3a14b4SDmitry Chagin frame->sf.sf_uc.uc_sc.pc = tf->tf_elr;
360c56480a8SDmitry Chagin frame->sf.sf_uc.uc_sc.pstate = tf->tf_spsr;
361c56480a8SDmitry Chagin frame->sf.sf_uc.uc_sc.fault_address = (register_t)ksi->ksi_addr;
362c56480a8SDmitry Chagin
363c56480a8SDmitry Chagin /* Stack frame for unwinding */
364c56480a8SDmitry Chagin frame->fp = tf->tf_x[29];
3652cdeb89eSDmitry Chagin frame->lr = tf->tf_elr;
366c56480a8SDmitry Chagin
367c56480a8SDmitry Chagin /* Translate the signal. */
368c56480a8SDmitry Chagin sig = bsd_to_linux_signal(sig);
369c56480a8SDmitry Chagin siginfo_to_lsiginfo(&ksi->ksi_info, &frame->sf.sf_si, sig);
370c56480a8SDmitry Chagin bsd_to_linux_sigset(mask, &frame->sf.sf_uc.uc_sigmask);
371c56480a8SDmitry Chagin
372c56480a8SDmitry Chagin /*
373c56480a8SDmitry Chagin * Prepare fpsimd & esr. Does not check sizes, as
374c56480a8SDmitry Chagin * __reserved is big enougth.
375c56480a8SDmitry Chagin */
376c56480a8SDmitry Chagin scr = (uint8_t *)&frame->sf.sf_uc.uc_sc.__reserved;
377c56480a8SDmitry Chagin #ifdef VFP
378c56480a8SDmitry Chagin fpsimd = (struct l_fpsimd_context *) scr;
379c56480a8SDmitry Chagin fpsimd->head.magic = L_FPSIMD_MAGIC;
380c56480a8SDmitry Chagin fpsimd->head.size = sizeof(struct l_fpsimd_context);
381c56480a8SDmitry Chagin fpsimd->fpsr = uc.uc_mcontext.mc_fpregs.fp_sr;
382c56480a8SDmitry Chagin fpsimd->fpcr = uc.uc_mcontext.mc_fpregs.fp_cr;
383c56480a8SDmitry Chagin
384c56480a8SDmitry Chagin memcpy(fpsimd->vregs, &uc.uc_mcontext.mc_fpregs.fp_q,
385c56480a8SDmitry Chagin sizeof(uc.uc_mcontext.mc_fpregs.fp_q));
386c56480a8SDmitry Chagin scr += roundup(sizeof(struct l_fpsimd_context), 16);
387c56480a8SDmitry Chagin #endif
388c56480a8SDmitry Chagin if (ksi->ksi_addr != 0) {
389c56480a8SDmitry Chagin esr = (struct l_esr_context *) scr;
390c56480a8SDmitry Chagin esr->head.magic = L_ESR_MAGIC;
391c56480a8SDmitry Chagin esr->head.size = sizeof(struct l_esr_context);
392c56480a8SDmitry Chagin esr->esr = tf->tf_esr;
393c56480a8SDmitry Chagin }
394c56480a8SDmitry Chagin
395c56480a8SDmitry Chagin memcpy(&frame->sf.sf_uc.uc_stack, &uc_stack, sizeof(uc_stack));
396c56480a8SDmitry Chagin
397ccc510b4SEdward Tomasz Napierala /* Copy the sigframe out to the user's stack. */
398c56480a8SDmitry Chagin if (copyout(frame, fp, sizeof(*fp)) != 0) {
399ccc510b4SEdward Tomasz Napierala /* Process has trashed its stack. Kill it. */
400c56480a8SDmitry Chagin free(frame, M_LINUX);
401ccc510b4SEdward Tomasz Napierala CTR2(KTR_SIG, "sendsig: sigexit td=%p fp=%p", td, fp);
402ccc510b4SEdward Tomasz Napierala PROC_LOCK(p);
403ccc510b4SEdward Tomasz Napierala sigexit(td, SIGILL);
404ccc510b4SEdward Tomasz Napierala }
405c56480a8SDmitry Chagin free(frame, M_LINUX);
406ccc510b4SEdward Tomasz Napierala
407ccc510b4SEdward Tomasz Napierala tf->tf_x[0]= sig;
408109fd18aSDmitry Chagin if (issiginfo) {
409c56480a8SDmitry Chagin tf->tf_x[1] = (register_t)&fp->sf.sf_si;
410c56480a8SDmitry Chagin tf->tf_x[2] = (register_t)&fp->sf.sf_uc;
411109fd18aSDmitry Chagin } else {
412109fd18aSDmitry Chagin tf->tf_x[1] = 0;
413109fd18aSDmitry Chagin tf->tf_x[2] = 0;
414109fd18aSDmitry Chagin }
4152cdeb89eSDmitry Chagin tf->tf_x[29] = (register_t)&fp->fp;
416d957343fSDmitry Chagin tf->tf_elr = (register_t)catcher;
417ccc510b4SEdward Tomasz Napierala tf->tf_sp = (register_t)fp;
418d957343fSDmitry Chagin tf->tf_lr = (register_t)__user_rt_sigreturn;
419ccc510b4SEdward Tomasz Napierala
420ccc510b4SEdward Tomasz Napierala CTR3(KTR_SIG, "sendsig: return td=%p pc=%#x sp=%#x", td, tf->tf_elr,
421ccc510b4SEdward Tomasz Napierala tf->tf_sp);
422ccc510b4SEdward Tomasz Napierala
423ccc510b4SEdward Tomasz Napierala PROC_LOCK(p);
424ccc510b4SEdward Tomasz Napierala mtx_lock(&psp->ps_mtx);
4253911ee2cSEd Maste }
4263911ee2cSEd Maste
4273911ee2cSEd Maste struct sysentvec elf_linux_sysvec = {
4283911ee2cSEd Maste .sv_size = LINUX_SYS_MAXSYSCALL,
4293911ee2cSEd Maste .sv_table = linux_sysent,
4306039e966SDmitry Chagin .sv_fixup = __elfN(freebsd_fixup),
4313911ee2cSEd Maste .sv_sendsig = linux_rt_sendsig,
4329931033bSDmitry Chagin .sv_sigcode = &_binary_linux_vdso_so_o_start,
4333911ee2cSEd Maste .sv_szsigcode = &linux_szsigcode,
4343911ee2cSEd Maste .sv_name = "Linux ELF64",
4353911ee2cSEd Maste .sv_coredump = elf64_coredump,
436435754a5SEdward Tomasz Napierala .sv_elf_core_osabi = ELFOSABI_NONE,
43745d99014SEdward Tomasz Napierala .sv_elf_core_abi_vendor = LINUX_ABI_VENDOR,
43845d99014SEdward Tomasz Napierala .sv_elf_core_prepare_notes = linux64_prepare_notes,
4393911ee2cSEd Maste .sv_minsigstksz = LINUX_MINSIGSTKSZ,
4403911ee2cSEd Maste .sv_minuser = VM_MIN_ADDRESS,
4413911ee2cSEd Maste .sv_maxuser = VM_MAXUSER_ADDRESS,
4429931033bSDmitry Chagin .sv_usrstack = LINUX_USRSTACK,
4439931033bSDmitry Chagin .sv_psstrings = LINUX_PS_STRINGS,
4443fc21fddSMark Johnston .sv_psstringssz = sizeof(struct ps_strings),
445d4f55cc8SEd Maste .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE,
4467d8c9839SDmitry Chagin .sv_copyout_auxargs = __linuxN(copyout_auxargs),
4476039e966SDmitry Chagin .sv_copyout_strings = __linuxN(copyout_strings),
4483911ee2cSEd Maste .sv_setregs = linux_exec_setregs,
4493911ee2cSEd Maste .sv_fixlimit = NULL,
4503911ee2cSEd Maste .sv_maxssiz = NULL,
451870e197dSKonstantin Belousov .sv_flags = SV_ABI_LINUX | SV_LP64 | SV_SHP | SV_SIG_DISCIGN |
4529931033bSDmitry Chagin SV_SIG_WAITNDQ | SV_TIMEKEEP,
4533911ee2cSEd Maste .sv_set_syscall_retval = linux_set_syscall_retval,
4543911ee2cSEd Maste .sv_fetch_syscall_args = linux_fetch_syscall_args,
4551da65dcbSMitchell Horne .sv_syscallnames = linux_syscallnames,
4569931033bSDmitry Chagin .sv_shared_page_base = LINUX_SHAREDPAGE,
4573911ee2cSEd Maste .sv_shared_page_len = PAGE_SIZE,
4583911ee2cSEd Maste .sv_schedtail = linux_schedtail,
4593911ee2cSEd Maste .sv_thread_detach = linux_thread_detach,
46084a3963dSEdward Tomasz Napierala .sv_trap = NULL,
461e6dbc99dSAndrew Turner .sv_hwcap = &linux_elf_hwcap,
462e6dbc99dSAndrew Turner .sv_hwcap2 = &linux_elf_hwcap2,
463fc04d822SAndrew Turner .sv_hwcap3 = &linux_elf_hwcap3,
464fc04d822SAndrew Turner .sv_hwcap4 = &linux_elf_hwcap4,
4655fd9cd53SDmitry Chagin .sv_onexec = linux_on_exec_vmspace,
4664815f175SKonstantin Belousov .sv_onexit = linux_on_exit,
4674815f175SKonstantin Belousov .sv_ontdexit = linux_thread_dtor,
468598f6fb4SKonstantin Belousov .sv_setid_allowed = &linux_setid_allowed_query,
4693911ee2cSEd Maste };
4703911ee2cSEd Maste
4715fd9cd53SDmitry Chagin static int
linux_on_exec_vmspace(struct proc * p,struct image_params * imgp)4725fd9cd53SDmitry Chagin linux_on_exec_vmspace(struct proc *p, struct image_params *imgp)
4735fd9cd53SDmitry Chagin {
4749931033bSDmitry Chagin int error;
4755fd9cd53SDmitry Chagin
4769931033bSDmitry Chagin error = linux_map_vdso(p, linux_vdso_obj, linux_vdso_base,
4779931033bSDmitry Chagin LINUX_VDSOPAGE_SIZE, imgp);
4789931033bSDmitry Chagin if (error == 0)
479fd745e1dSDmitry Chagin error = linux_on_exec(p, imgp);
4809931033bSDmitry Chagin return (error);
4815fd9cd53SDmitry Chagin }
4825fd9cd53SDmitry Chagin
48309cffde9SDmitry Chagin /*
48409cffde9SDmitry Chagin * linux_vdso_install() and linux_exec_sysvec_init() must be called
48509cffde9SDmitry Chagin * after exec_sysvec_init() which is SI_SUB_EXEC (SI_ORDER_ANY).
48609cffde9SDmitry Chagin */
4873911ee2cSEd Maste static void
linux_exec_sysvec_init(void * param)4889931033bSDmitry Chagin linux_exec_sysvec_init(void *param)
4899931033bSDmitry Chagin {
4909931033bSDmitry Chagin l_uintptr_t *ktimekeep_base;
4919931033bSDmitry Chagin struct sysentvec *sv;
4929931033bSDmitry Chagin ptrdiff_t tkoff;
4939931033bSDmitry Chagin
4949931033bSDmitry Chagin sv = param;
4959931033bSDmitry Chagin /* Fill timekeep_base */
4969931033bSDmitry Chagin exec_sysvec_init(sv);
4979931033bSDmitry Chagin
4989931033bSDmitry Chagin tkoff = kern_timekeep_base - linux_vdso_base;
4999931033bSDmitry Chagin ktimekeep_base = (l_uintptr_t *)(linux_vdso_mapping + tkoff);
500361971fbSKornel Dulęba *ktimekeep_base = sv->sv_shared_page_base + sv->sv_timekeep_offset;
5019931033bSDmitry Chagin }
50209cffde9SDmitry Chagin SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC + 1, SI_ORDER_ANY,
5039931033bSDmitry Chagin linux_exec_sysvec_init, &elf_linux_sysvec);
5049931033bSDmitry Chagin
5059931033bSDmitry Chagin static void
linux_vdso_install(const void * param)5063911ee2cSEd Maste linux_vdso_install(const void *param)
5073911ee2cSEd Maste {
5089931033bSDmitry Chagin char *vdso_start = &_binary_linux_vdso_so_o_start;
5099931033bSDmitry Chagin char *vdso_end = &_binary_linux_vdso_so_o_end;
5103911ee2cSEd Maste
5119931033bSDmitry Chagin linux_szsigcode = vdso_end - vdso_start;
5129931033bSDmitry Chagin MPASS(linux_szsigcode <= LINUX_VDSOPAGE_SIZE);
5133911ee2cSEd Maste
5149931033bSDmitry Chagin linux_vdso_base = LINUX_VDSOPAGE;
5153911ee2cSEd Maste
5169931033bSDmitry Chagin __elfN(linux_vdso_fixup)(vdso_start, linux_vdso_base);
5173911ee2cSEd Maste
5189931033bSDmitry Chagin linux_vdso_obj = __elfN(linux_shared_page_init)
5199931033bSDmitry Chagin (&linux_vdso_mapping, LINUX_VDSOPAGE_SIZE);
5209931033bSDmitry Chagin bcopy(vdso_start, linux_vdso_mapping, linux_szsigcode);
5213911ee2cSEd Maste
5229931033bSDmitry Chagin linux_vdso_reloc(linux_vdso_mapping, linux_vdso_base);
5233911ee2cSEd Maste }
52409cffde9SDmitry Chagin SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC + 1, SI_ORDER_FIRST,
5253911ee2cSEd Maste linux_vdso_install, NULL);
5263911ee2cSEd Maste
5273911ee2cSEd Maste static void
linux_vdso_deinstall(const void * param)5283911ee2cSEd Maste linux_vdso_deinstall(const void *param)
5293911ee2cSEd Maste {
5303911ee2cSEd Maste
5319931033bSDmitry Chagin __elfN(linux_shared_page_fini)(linux_vdso_obj,
5329931033bSDmitry Chagin linux_vdso_mapping, LINUX_VDSOPAGE_SIZE);
5333911ee2cSEd Maste }
5343911ee2cSEd Maste SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST,
5353911ee2cSEd Maste linux_vdso_deinstall, NULL);
5363911ee2cSEd Maste
5379931033bSDmitry Chagin static void
linux_vdso_reloc(char * mapping,Elf_Addr offset)5389931033bSDmitry Chagin linux_vdso_reloc(char *mapping, Elf_Addr offset)
5399931033bSDmitry Chagin {
5409931033bSDmitry Chagin Elf_Size rtype, symidx;
5419931033bSDmitry Chagin const Elf_Rela *rela;
5429931033bSDmitry Chagin const Elf_Shdr *shdr;
5439931033bSDmitry Chagin const Elf_Ehdr *ehdr;
5449931033bSDmitry Chagin Elf_Addr *where;
5459931033bSDmitry Chagin Elf_Addr addr, addend;
5469931033bSDmitry Chagin int i, relacnt;
5479931033bSDmitry Chagin
5489931033bSDmitry Chagin MPASS(offset != 0);
5499931033bSDmitry Chagin
5509931033bSDmitry Chagin relacnt = 0;
5519931033bSDmitry Chagin ehdr = (const Elf_Ehdr *)mapping;
5529931033bSDmitry Chagin shdr = (const Elf_Shdr *)(mapping + ehdr->e_shoff);
5539931033bSDmitry Chagin for (i = 0; i < ehdr->e_shnum; i++)
5549931033bSDmitry Chagin {
5559931033bSDmitry Chagin switch (shdr[i].sh_type) {
5569931033bSDmitry Chagin case SHT_REL:
5579931033bSDmitry Chagin printf("Linux Aarch64 vDSO: unexpected Rel section\n");
5589931033bSDmitry Chagin break;
5599931033bSDmitry Chagin case SHT_RELA:
5609931033bSDmitry Chagin rela = (const Elf_Rela *)(mapping + shdr[i].sh_offset);
5619931033bSDmitry Chagin relacnt = shdr[i].sh_size / sizeof(*rela);
5629931033bSDmitry Chagin }
5639931033bSDmitry Chagin }
5649931033bSDmitry Chagin
5659931033bSDmitry Chagin for (i = 0; i < relacnt; i++, rela++) {
5669931033bSDmitry Chagin where = (Elf_Addr *)(mapping + rela->r_offset);
5679931033bSDmitry Chagin addend = rela->r_addend;
5689931033bSDmitry Chagin rtype = ELF_R_TYPE(rela->r_info);
5699931033bSDmitry Chagin symidx = ELF_R_SYM(rela->r_info);
5709931033bSDmitry Chagin
5719931033bSDmitry Chagin switch (rtype) {
5729931033bSDmitry Chagin case R_AARCH64_NONE: /* none */
5739931033bSDmitry Chagin break;
5749931033bSDmitry Chagin
5759931033bSDmitry Chagin case R_AARCH64_RELATIVE: /* B + A */
5769931033bSDmitry Chagin addr = (Elf_Addr)(mapping + addend);
5779931033bSDmitry Chagin if (*where != addr)
5789931033bSDmitry Chagin *where = addr;
5799931033bSDmitry Chagin break;
5809931033bSDmitry Chagin default:
5819931033bSDmitry Chagin printf("Linux Aarch64 vDSO: unexpected relocation type %ld, "
5829931033bSDmitry Chagin "symbol index %ld\n", rtype, symidx);
5839931033bSDmitry Chagin }
5849931033bSDmitry Chagin }
5859931033bSDmitry Chagin }
5869931033bSDmitry Chagin
58780336636SMark Johnston static const Elf_Brandnote linux64_brandnote = {
5883911ee2cSEd Maste .hdr.n_namesz = sizeof(GNU_ABI_VENDOR),
5893911ee2cSEd Maste .hdr.n_descsz = 16,
5903911ee2cSEd Maste .hdr.n_type = 1,
5913911ee2cSEd Maste .vendor = GNU_ABI_VENDOR,
5923911ee2cSEd Maste .flags = BN_TRANSLATE_OSREL,
5933911ee2cSEd Maste .trans_osrel = linux_trans_osrel
5943911ee2cSEd Maste };
5953911ee2cSEd Maste
59680336636SMark Johnston static const Elf64_Brandinfo linux_glibc2brand = {
5973911ee2cSEd Maste .brand = ELFOSABI_LINUX,
5983911ee2cSEd Maste .machine = EM_AARCH64,
5993911ee2cSEd Maste .compat_3_brand = "Linux",
6003911ee2cSEd Maste .interp_path = "/lib64/ld-linux-x86-64.so.2",
6013911ee2cSEd Maste .sysvec = &elf_linux_sysvec,
6023911ee2cSEd Maste .interp_newpath = NULL,
6033911ee2cSEd Maste .brand_note = &linux64_brandnote,
6043911ee2cSEd Maste .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
6053911ee2cSEd Maste };
6063911ee2cSEd Maste
60780336636SMark Johnston const Elf64_Brandinfo *linux_brandlist[] = {
6083911ee2cSEd Maste &linux_glibc2brand,
6093911ee2cSEd Maste NULL
6103911ee2cSEd Maste };
6113911ee2cSEd Maste
6123911ee2cSEd Maste static int
linux64_elf_modevent(module_t mod,int type,void * data)6133911ee2cSEd Maste linux64_elf_modevent(module_t mod, int type, void *data)
6143911ee2cSEd Maste {
61580336636SMark Johnston const Elf64_Brandinfo **brandinfo;
6163911ee2cSEd Maste struct linux_ioctl_handler **lihp;
6173911ee2cSEd Maste int error;
6183911ee2cSEd Maste
6193911ee2cSEd Maste error = 0;
6203911ee2cSEd Maste switch(type) {
6213911ee2cSEd Maste case MOD_LOAD:
6223911ee2cSEd Maste for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;
6233911ee2cSEd Maste ++brandinfo)
6243911ee2cSEd Maste if (elf64_insert_brand_entry(*brandinfo) < 0)
6253911ee2cSEd Maste error = EINVAL;
6263911ee2cSEd Maste if (error == 0) {
6273911ee2cSEd Maste SET_FOREACH(lihp, linux_ioctl_handler_set)
6283911ee2cSEd Maste linux_ioctl_register_handler(*lihp);
6293911ee2cSEd Maste stclohz = (stathz ? stathz : hz);
6303911ee2cSEd Maste if (bootverbose)
6313911ee2cSEd Maste printf("Linux arm64 ELF exec handler installed\n");
6323911ee2cSEd Maste }
6333911ee2cSEd Maste break;
6343911ee2cSEd Maste case MOD_UNLOAD:
6353911ee2cSEd Maste for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;
6363911ee2cSEd Maste ++brandinfo)
6373911ee2cSEd Maste if (elf64_brand_inuse(*brandinfo))
6383911ee2cSEd Maste error = EBUSY;
6393911ee2cSEd Maste if (error == 0) {
6403911ee2cSEd Maste for (brandinfo = &linux_brandlist[0];
6413911ee2cSEd Maste *brandinfo != NULL; ++brandinfo)
6423911ee2cSEd Maste if (elf64_remove_brand_entry(*brandinfo) < 0)
6433911ee2cSEd Maste error = EINVAL;
6443911ee2cSEd Maste }
6453911ee2cSEd Maste if (error == 0) {
6463911ee2cSEd Maste SET_FOREACH(lihp, linux_ioctl_handler_set)
6473911ee2cSEd Maste linux_ioctl_unregister_handler(*lihp);
6483911ee2cSEd Maste if (bootverbose)
649ae8330b4SDmitry Chagin printf("Linux arm64 ELF exec handler removed\n");
6503911ee2cSEd Maste } else
651ae8330b4SDmitry Chagin printf("Could not deinstall Linux arm64 ELF interpreter entry\n");
6523911ee2cSEd Maste break;
6533911ee2cSEd Maste default:
6543911ee2cSEd Maste return (EOPNOTSUPP);
6553911ee2cSEd Maste }
6563911ee2cSEd Maste return (error);
6573911ee2cSEd Maste }
6583911ee2cSEd Maste
6593911ee2cSEd Maste static moduledata_t linux64_elf_mod = {
6603911ee2cSEd Maste "linux64elf",
6613911ee2cSEd Maste linux64_elf_modevent,
6623911ee2cSEd Maste 0
6633911ee2cSEd Maste };
6643911ee2cSEd Maste
6653911ee2cSEd Maste DECLARE_MODULE_TIED(linux64elf, linux64_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY);
6663911ee2cSEd Maste MODULE_DEPEND(linux64elf, linux_common, 1, 1, 1);
6673911ee2cSEd Maste FEATURE(linux64, "AArch64 Linux 64bit support");
668