diff options
Diffstat (limited to 'sys/amd64/linux32')
-rw-r--r-- | sys/amd64/linux32/Makefile | 1 | ||||
-rw-r--r-- | sys/amd64/linux32/linux.h | 272 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_dummy_machdep.c | 16 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_genassym.c | 28 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_locore.asm | 204 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_machdep.c | 197 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_proto.h | 360 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_support.S (renamed from sys/amd64/linux32/linux32_support.s) | 6 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_syscall.h | 17 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_syscalls.c | 17 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_sysent.c | 43 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_systrace_args.c | 494 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_sysvec.c | 319 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_vdso.lds.s | 6 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_vdso_gtod.c | 32 | ||||
-rw-r--r-- | sys/amd64/linux32/syscalls.conf | 3 | ||||
-rw-r--r-- | sys/amd64/linux32/syscalls.master | 201 |
17 files changed, 1100 insertions, 1116 deletions
diff --git a/sys/amd64/linux32/Makefile b/sys/amd64/linux32/Makefile index 94ded158923e..0f9bd45ec539 100644 --- a/sys/amd64/linux32/Makefile +++ b/sys/amd64/linux32/Makefile @@ -1,6 +1,5 @@ # Makefile for syscall tables # -# $FreeBSD$ GENERATED_PREFIX= linux32_ diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index f1f877181e47..5542df1b3185 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -28,8 +28,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _AMD64_LINUX_H_ @@ -48,6 +46,10 @@ #define LINUX32_MAXSSIZ (64 * 1024 * 1024) /* 64MB */ #define LINUX32_MAXVMEM 0 /* Unlimited */ +#define LINUX_ARCHWANT_MMAP2PGOFF 1 /* 32-bit off_t want offset + * represented in multiples + * of page size. */ + /* * Provide a separate set of types for the Linux types. */ @@ -63,7 +65,6 @@ typedef unsigned short l_ushort; typedef l_ulong l_uintptr_t; typedef l_long l_clock_t; typedef l_int l_daddr_t; -typedef l_ushort l_dev_t; typedef l_uint l_gid_t; typedef l_ushort l_gid16_t; typedef l_ulong l_ino_t; @@ -82,6 +83,8 @@ typedef l_int l_timer_t; typedef l_int l_mqd_t; typedef l_ulong l_fd_mask; +#include <compat/linux/linux_siginfo.h> + typedef struct { l_int val[2]; } l_fsid_t; @@ -91,14 +94,19 @@ typedef struct { l_suseconds_t tv_usec; } l_timeval; +typedef struct { + l_time64_t tv_sec; + l_time64_t tv_usec; +} l_sock_timeval; + #define l_fd_set fd_set /* * Miscellaneous */ -#define LINUX_AT_COUNT 21 /* Count of used aux entry types. +#define LINUX_AT_COUNT 22 /* Count of used aux entry types. * Keep this synchronized with - * linux_fixup_elf() code. + * linux_copyout_auxargs() code. */ struct l___sysctl_args { @@ -173,15 +181,13 @@ struct l_timespec64 { }; struct l_newstat { - l_ushort st_dev; - l_ushort __pad1; + l_ulong st_dev; l_ulong st_ino; l_ushort st_mode; l_ushort st_nlink; l_ushort st_uid; l_ushort st_gid; - l_ushort st_rdev; - l_ushort __pad2; + l_ulong st_rdev; l_ulong st_size; l_ulong st_blksize; l_ulong st_blocks; @@ -192,7 +198,8 @@ struct l_newstat { l_ulong __unused5; }; -struct l_stat { +/* __old_kernel_stat now */ +struct l_old_stat { l_ushort st_dev; l_ulong st_ino; l_ushort st_mode; @@ -211,19 +218,18 @@ struct l_stat { }; struct l_stat64 { - l_ushort st_dev; - u_char __pad0[10]; + l_ulonglong st_dev; + u_char __pad0[4]; l_ulong __st_ino; l_uint st_mode; l_uint st_nlink; l_ulong st_uid; l_ulong st_gid; - l_ushort st_rdev; - u_char __pad3[10]; + l_ulonglong st_rdev; + u_char __pad3[4]; l_longlong st_size; l_ulong st_blksize; - l_ulong st_blocks; - l_ulong __pad4; + l_ulonglong st_blocks; struct l_timespec st_atim; struct l_timespec st_mtim; struct l_timespec st_ctim; @@ -256,11 +262,6 @@ struct l_statfs64 { #define LINUX_SA_NOMASK 0x40000000 #define LINUX_SA_ONESHOT 0x80000000 -/* sigprocmask actions */ -#define LINUX_SIG_BLOCK 0 -#define LINUX_SIG_UNBLOCK 1 -#define LINUX_SIG_SETMASK 2 - /* sigaltstack */ #define LINUX_MINSIGSTKSZ 2048 @@ -287,168 +288,6 @@ typedef struct { l_size_t ss_size; } l_stack_t; -/* The Linux sigcontext, pretty much a standard 386 trapframe. */ -struct l_sigcontext { - l_uint sc_gs; - l_uint sc_fs; - l_uint sc_es; - l_uint sc_ds; - l_uint sc_edi; - l_uint sc_esi; - l_uint sc_ebp; - l_uint sc_esp; - l_uint sc_ebx; - l_uint sc_edx; - l_uint sc_ecx; - l_uint sc_eax; - l_uint sc_trapno; - l_uint sc_err; - l_uint sc_eip; - l_uint sc_cs; - l_uint sc_eflags; - l_uint sc_esp_at_signal; - l_uint sc_ss; - l_uint sc_387; - l_uint sc_mask; - l_uint sc_cr2; -}; - -struct l_ucontext { - l_ulong uc_flags; - l_uintptr_t uc_link; - l_stack_t uc_stack; - struct l_sigcontext uc_mcontext; - l_sigset_t uc_sigmask; -} __packed; - -#define LINUX_SI_MAX_SIZE 128 -#define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3) - -typedef union l_sigval { - l_int sival_int; - l_uintptr_t sival_ptr; -} l_sigval_t; - -typedef struct l_siginfo { - l_int lsi_signo; - l_int lsi_errno; - l_int lsi_code; - union { - l_int _pad[LINUX_SI_PAD_SIZE]; - - struct { - l_pid_t _pid; - l_uid_t _uid; - } _kill; - - struct { - l_timer_t _tid; - l_int _overrun; - char _pad[sizeof(l_uid_t) - sizeof(l_int)]; - l_sigval_t _sigval; - l_int _sys_private; - } _timer; - - struct { - l_pid_t _pid; /* sender's pid */ - l_uid_t _uid; /* sender's uid */ - l_sigval_t _sigval; - } _rt; - - struct { - l_pid_t _pid; /* which child */ - l_uid_t _uid; /* sender's uid */ - l_int _status; /* exit code */ - l_clock_t _utime; - l_clock_t _stime; - } _sigchld; - - struct { - l_uintptr_t _addr; /* Faulting insn/memory ref. */ - } _sigfault; - - struct { - l_long _band; /* POLL_IN,POLL_OUT,POLL_MSG */ - l_int _fd; - } _sigpoll; - } _sifields; -} l_siginfo_t; - -#define lsi_pid _sifields._kill._pid -#define lsi_uid _sifields._kill._uid -#define lsi_tid _sifields._timer._tid -#define lsi_overrun _sifields._timer._overrun -#define lsi_sys_private _sifields._timer._sys_private -#define lsi_status _sifields._sigchld._status -#define lsi_utime _sifields._sigchld._utime -#define lsi_stime _sifields._sigchld._stime -#define lsi_value _sifields._rt._sigval -#define lsi_int _sifields._rt._sigval.sival_int -#define lsi_ptr _sifields._rt._sigval.sival_ptr -#define lsi_addr _sifields._sigfault._addr -#define lsi_band _sifields._sigpoll._band -#define lsi_fd _sifields._sigpoll._fd - -struct l_fpreg { - u_int16_t significand[4]; - u_int16_t exponent; -}; - -struct l_fpxreg { - u_int16_t significand[4]; - u_int16_t exponent; - u_int16_t padding[3]; -}; - -struct l_xmmreg { - u_int32_t element[4]; -}; - -struct l_fpstate { - /* Regular FPU environment */ - u_int32_t cw; - u_int32_t sw; - u_int32_t tag; - u_int32_t ipoff; - u_int32_t cssel; - u_int32_t dataoff; - u_int32_t datasel; - struct l_fpreg _st[8]; - u_int16_t status; - u_int16_t magic; /* 0xffff = regular FPU data */ - - /* FXSR FPU environment */ - u_int32_t _fxsr_env[6]; /* env is ignored. */ - u_int32_t mxcsr; - u_int32_t reserved; - struct l_fpxreg _fxsr_st[8]; /* reg data is ignored. */ - struct l_xmmreg _xmm[8]; - u_int32_t padding[56]; -}; - -/* - * We make the stack look like Linux expects it when calling a signal - * handler, but use the BSD way of calling the handler and sigreturn(). - * This means that we need to pass the pointer to the handler too. - * It is appended to the frame to not interfere with the rest of it. - */ -struct l_sigframe { - l_int sf_sig; - struct l_sigcontext sf_sc; - struct l_fpstate sf_fpstate; - l_uint sf_extramask[1]; - l_handler_t sf_handler; -}; - -struct l_rt_sigframe { - l_int sf_sig; - l_uintptr_t sf_siginfo; - l_uintptr_t sf_ucontext; - l_siginfo_t sf_si; - struct l_ucontext sf_sc; - l_handler_t sf_handler; -} __packed; - /* * arch specific open/fcntl flags */ @@ -464,40 +303,6 @@ union l_semun { l_uintptr_t __pad; }; -struct l_ifmap { - l_ulong mem_start; - l_ulong mem_end; - l_ushort base_addr; - u_char irq; - u_char dma; - u_char port; - /* 3 bytes spare */ -}; - -struct l_ifreq { - union { - char ifrn_name[LINUX_IFNAMSIZ]; - } ifr_ifrn; - - union { - struct l_sockaddr ifru_addr; - struct l_sockaddr ifru_dstaddr; - struct l_sockaddr ifru_broadaddr; - struct l_sockaddr ifru_netmask; - struct l_sockaddr ifru_hwaddr; - l_short ifru_flags[1]; - l_int ifru_ivalue; - l_int ifru_mtu; - struct l_ifmap ifru_map; - char ifru_slave[LINUX_IFNAMSIZ]; - l_uintptr_t ifru_data; - } ifr_ifru; -}; - -#define ifr_name ifr_ifrn.ifrn_name /* Interface name */ -#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ -#define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */ - struct l_ifconf { int ifc_len; union { @@ -586,30 +391,9 @@ struct l_user_desc { #define LINUX_GET_USEABLE(desc) \ (((desc)->b >> LINUX_ENTRY_B_USEABLE) & 1) -struct iovec; -struct uio; - -struct l_iovec32 { - uint32_t iov_base; - l_size_t iov_len; -}; - -int linux32_copyiniov(struct l_iovec32 *iovp32, l_ulong iovcnt, - struct iovec **iovp, int error); -int linux32_copyinuio(struct l_iovec32 *iovp, l_ulong iovcnt, - struct uio **uiop); +#ifdef _KERNEL int linux_copyout_rusage(struct rusage *ru, void *uaddr); - -/* robust futexes */ -struct linux_robust_list { - l_uintptr_t next; -}; - -struct linux_robust_list_head { - struct linux_robust_list list; - l_long futex_offset; - l_uintptr_t pending_list; -}; +#endif /* _KERNEL */ /* This corresponds to 'struct user_regs_struct32' in Linux. */ struct linux_pt_regset32 { @@ -632,9 +416,17 @@ struct linux_pt_regset32 { l_uint ss; }; +#ifdef _KERNEL struct reg32; void bsd_to_linux_regset32(const struct reg32 *b_reg, struct linux_pt_regset32 *l_regset); +int linux_ptrace_peekuser(struct thread *td, pid_t pid, + void *addr, void *data); +int linux_ptrace_pokeuser(struct thread *td, pid_t pid, + void *addr, void *data); + +extern bool linux32_emulate_i386; +#endif /* _KERNEL */ #endif /* !_AMD64_LINUX_H_ */ diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index fb7c88629af7..c2206c81c528 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 1994-1995 Søren Schmidt * All rights reserved. @@ -26,14 +26,10 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include <sys/param.h> #include <sys/kernel.h> -#include <sys/sdt.h> -#include <sys/systm.h> #include <sys/proc.h> +#include <sys/sdt.h> #include <amd64/linux32/linux.h> #include <amd64/linux32/linux32_proto.h> @@ -45,6 +41,7 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); UNIMPLEMENTED(break); UNIMPLEMENTED(ftime); +UNIMPLEMENTED(fstat); UNIMPLEMENTED(gtty); UNIMPLEMENTED(stty); UNIMPLEMENTED(lock); @@ -68,13 +65,6 @@ DUMMY(mq_getsetattr); DUMMY(arch_prctl); /* Linux 5.0: */ DUMMY(clock_adjtime64); -DUMMY(timer_gettime64); -DUMMY(timer_settime64); -DUMMY(timerfd_gettime64); -DUMMY(timerfd_settime64); DUMMY(io_pgetevents_time64); -DUMMY(recvmmsg_time64); DUMMY(mq_timedsend_time64); DUMMY(mq_timedreceive_time64); -DUMMY(semtimedop_time64); -DUMMY(sched_rr_get_interval_time64); diff --git a/sys/amd64/linux32/linux32_genassym.c b/sys/amd64/linux32/linux32_genassym.c index bc94139c226d..df3f8ef7b471 100644 --- a/sys/amd64/linux32/linux32_genassym.c +++ b/sys/amd64/linux32/linux32_genassym.c @@ -1,18 +1,30 @@ -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include <sys/param.h> +#include <sys/systm.h> #include <sys/assym.h> #include <sys/resource.h> -#include <sys/systm.h> #include <amd64/linux32/linux.h> #include <compat/linux/linux_mib.h> -ASSYM(LINUX_SIGF_HANDLER, offsetof(struct l_sigframe, sf_handler)); +#include <x86/linux/linux_x86_sigframe.h> + ASSYM(LINUX_SIGF_SC, offsetof(struct l_sigframe, sf_sc)); -ASSYM(LINUX_RT_SIGF_HANDLER, offsetof(struct l_rt_sigframe, sf_handler)); -ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc)); +ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_uc)); ASSYM(LINUX_RT_SIGF_SC, offsetof(struct l_ucontext, uc_mcontext)); +ASSYM(L_SC_GS, offsetof(struct l_sigcontext, sc_gs)); +ASSYM(L_SC_FS, offsetof(struct l_sigcontext, sc_fs)); +ASSYM(L_SC_ES, offsetof(struct l_sigcontext, sc_es)); +ASSYM(L_SC_DS, offsetof(struct l_sigcontext, sc_ds)); +ASSYM(L_SC_CS, offsetof(struct l_sigcontext, sc_cs)); +ASSYM(L_SC_SS, offsetof(struct l_sigcontext, sc_ss)); +ASSYM(L_SC_EFLAGS, offsetof(struct l_sigcontext, sc_eflags)); +ASSYM(L_SC_EDI, offsetof(struct l_sigcontext, sc_edi)); +ASSYM(L_SC_ESI, offsetof(struct l_sigcontext, sc_esi)); +ASSYM(L_SC_EBP, offsetof(struct l_sigcontext, sc_ebp)); +ASSYM(L_SC_EBX, offsetof(struct l_sigcontext, sc_ebx)); +ASSYM(L_SC_EDX, offsetof(struct l_sigcontext, sc_edx)); +ASSYM(L_SC_ECX, offsetof(struct l_sigcontext, sc_ecx)); +ASSYM(L_SC_EAX, offsetof(struct l_sigcontext, sc_eax)); +ASSYM(L_SC_EIP, offsetof(struct l_sigcontext, sc_eip)); +ASSYM(L_SC_ESP, offsetof(struct l_sigcontext, sc_esp_at_signal)); ASSYM(LINUX_VERSION_CODE, LINUX_VERSION_CODE); -ASSYM(LINUX_SC_ESP, offsetof(struct l_sigcontext, sc_esp)); diff --git a/sys/amd64/linux32/linux32_locore.asm b/sys/amd64/linux32/linux32_locore.asm index f96b3e730f9f..4b77bd32600e 100644 --- a/sys/amd64/linux32/linux32_locore.asm +++ b/sys/amd64/linux32/linux32_locore.asm @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ #include "linux32_assym.h" /* system definitions */ #include <machine/asmacros.h> /* miscellaneous asm macros */ @@ -14,46 +13,104 @@ linux_platform: .text .code32 -/* - * To avoid excess stack frame the signal trampoline code emulates - * the 'call' instruction. - */ +ENTRY(linux32_vdso_sigcode) + .cfi_startproc + .cfi_signal_frame + .cfi_def_cfa %esp, LINUX_SIGF_SC + .cfi_offset %gs, L_SC_GS + .cfi_offset %fs, L_SC_FS + .cfi_offset %es, L_SC_ES + .cfi_offset %ds, L_SC_DS + .cfi_offset %cs, L_SC_CS + .cfi_offset %ss, L_SC_SS +#ifdef __clang__ + .cfi_offset %flags, L_SC_EFLAGS +#else + .cfi_offset %eflags, L_SC_EFLAGS +#endif + .cfi_offset %edi, L_SC_EDI + .cfi_offset %esi, L_SC_ESI + .cfi_offset %ebp, L_SC_EBP + .cfi_offset %ebx, L_SC_EBX + .cfi_offset %edx, L_SC_EDX + .cfi_offset %ecx, L_SC_ECX + .cfi_offset %eax, L_SC_EAX + .cfi_offset %eip, L_SC_EIP + .cfi_offset %esp, L_SC_ESP + + movl %esp, %ebx /* sigframe for sigreturn */ + call *%edi /* call signal handler */ + popl %eax /* gcc unwind code need this */ + .cfi_def_cfa %esp, LINUX_SIGF_SC-4 + movl $LINUX32_SYS_linux_sigreturn, %eax + int $0x80 +0: jmp 0b + .cfi_endproc +END(linux32_vdso_sigcode) + + +ENTRY(linux32_vdso_rt_sigcode) + .cfi_startproc + .cfi_signal_frame + .cfi_def_cfa %esp, LINUX_RT_SIGF_UC + LINUX_RT_SIGF_SC + .cfi_offset %gs, L_SC_GS + .cfi_offset %fs, L_SC_FS + .cfi_offset %es, L_SC_ES + .cfi_offset %ds, L_SC_DS + .cfi_offset %cs, L_SC_CS + .cfi_offset %ss, L_SC_SS +#ifdef __clang__ + .cfi_offset %flags, L_SC_EFLAGS +#else + .cfi_offset %eflags, L_SC_EFLAGS +#endif + .cfi_offset %edi, L_SC_EDI + .cfi_offset %esi, L_SC_ESI + .cfi_offset %ebp, L_SC_EBP + .cfi_offset %ebx, L_SC_EBX + .cfi_offset %edx, L_SC_EDX + .cfi_offset %ecx, L_SC_ECX + .cfi_offset %eax, L_SC_EAX + .cfi_offset %eip, L_SC_EIP + .cfi_offset %esp, L_SC_ESP + + leal LINUX_RT_SIGF_UC(%esp), %ebx /* linux ucontext for rt_sigreturn */ + call *%edi /* call signal handler */ + movl $LINUX32_SYS_linux_rt_sigreturn, %eax + int $0x80 +0: jmp 0b + .cfi_endproc +END(linux32_vdso_rt_sigcode) + ENTRY(__kernel_sigreturn) - movl %esp, %ebx /* preserve sigframe */ - call .getip0 -.getip0: - popl %eax - add $.startsigcode-.getip0, %eax /* ret address */ - push %eax - jmp *LINUX_SIGF_HANDLER(%ebx) -.startsigcode: - popl %eax - movl $LINUX32_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ - int $0x80 /* enter kernel with args */ -.endsigcode: + .cfi_startproc + .cfi_signal_frame + movl %esp, %ebx /* sigframe for sigreturn */ + call *%edi /* call signal handler */ + popl %eax /* gcc unwind code need this */ + movl $LINUX32_SYS_linux_sigreturn, %eax + int $0x80 0: jmp 0b + .cfi_endproc +END(__kernel_sigreturn) ENTRY(__kernel_rt_sigreturn) - leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ - leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ - movl %esp, %edi - call .getip1 -.getip1: - popl %eax - add $.startrtsigcode-.getip1, %eax /* ret address */ - push %eax - jmp *LINUX_RT_SIGF_HANDLER(%edi) -.startrtsigcode: - movl $LINUX32_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ - int $0x80 /* enter kernel with args */ -.endrtsigcode: + .cfi_startproc + .cfi_signal_frame + leal LINUX_RT_SIGF_UC(%esp), %ebx /* linux ucontext for rt_sigreturn */ + call *%edi /* call signal handler */ + movl $LINUX32_SYS_linux_rt_sigreturn, %eax + int $0x80 0: jmp 0b + .cfi_endproc +END(__kernel_rt_sigreturn) ENTRY(__kernel_vsyscall) -.startvsyscall: + .cfi_startproc int $0x80 ret -.endvsyscall: + .cfi_endproc +END(__kernel_vsyscall) #if 0 .section .note.Linux, "a",@note @@ -71,86 +128,3 @@ ENTRY(__kernel_vsyscall) .balign 4 .previous #endif - -#define do_cfa_expr(offset) \ - .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ - .uleb128 11f-10f; /* length */ \ -10: .byte 0x74; /* DW_OP_breg4 */ \ - .sleb128 offset; /* offset */ \ - .byte 0x06; /* DW_OP_deref */ \ -11: - - - /* CIE */ - .section .eh_frame,"a",@progbits -.LSTARTFRAMEDLSI1: - .long .LENDCIEDLSI1-.LSTARTCIEDLSI1 -.LSTARTCIEDLSI1: - .long 0 /* CIE ID */ - .byte 1 /* Version number */ - .string "zRS" /* NULL-terminated - * augmentation string - */ - .uleb128 1 /* Code alignment factor */ - .sleb128 -4 /* Data alignment factor */ - .byte 8 /* Return address - * register column - */ - .uleb128 1 /* Augmentation value length */ - .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ - .byte 0 /* DW_CFA_nop */ - .align 4 -.LENDCIEDLSI1: - - /* FDE */ - .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */ -.LSTARTFDEDLSI1: - .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */ - .long .startsigcode-. /* PC-relative start address */ - .long .endsigcode-.startsigcode - .uleb128 0 /* Augmentation */ - do_cfa_expr(LINUX_SIGF_SC-8) - .align 4 -.LENDFDEDLSI1: - - .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */ -.LSTARTFDEDLSI2: - .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */ - .long .startrtsigcode-. /* PC-relative start address */ - .long .endrtsigcode-.startrtsigcode - .uleb128 0 /* Augmentation */ - do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP) - .align 4 -.LENDFDEDLSI2: - .previous - - .section .eh_frame,"a",@progbits -.LSTARTFRAMEDLSI2: - .long .LENDCIEDLSI2-.LSTARTCIEDLSI2 -.LSTARTCIEDLSI2: - .long 0 /* CIE ID */ - .byte 1 /* Version number */ - .string "zR" /* NULL-terminated - * augmentation string - */ - .uleb128 1 /* Code alignment factor */ - .sleb128 -4 /* Data alignment factor */ - .byte 8 /* Return address register column */ - .uleb128 1 /* Augmentation value length */ - .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ - .byte 0x0c /* DW_CFA_def_cfa */ - .uleb128 4 - .uleb128 4 - .byte 0x88 /* DW_CFA_offset, column 0x8 */ - .uleb128 1 - .align 4 -.LENDCIEDLSI2: - .long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */ -.LSTARTFDEDLSI3: - .long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */ - .long .startvsyscall-. /* PC-relative start address */ - .long .endvsyscall-.startvsyscall - .uleb128 0 - .align 4 -.LENDFDEDLSI3: - .previous diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 9dd988452a1c..7f1c85cee201 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -30,55 +30,24 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_compat.h" - #include <sys/param.h> -#include <sys/capsicum.h> -#include <sys/clock.h> -#include <sys/fcntl.h> -#include <sys/file.h> -#include <sys/imgact.h> -#include <sys/kernel.h> -#include <sys/limits.h> #include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/mman.h> #include <sys/mutex.h> #include <sys/priv.h> #include <sys/proc.h> #include <sys/reg.h> -#include <sys/resource.h> -#include <sys/resourcevar.h> #include <sys/syscallsubr.h> -#include <sys/sysproto.h> -#include <sys/systm.h> -#include <sys/unistd.h> -#include <sys/wait.h> -#include <machine/frame.h> #include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/psl.h> -#include <machine/segments.h> #include <machine/specialreg.h> #include <x86/ifunc.h> -#include <vm/pmap.h> -#include <vm/vm.h> -#include <vm/vm_map.h> - -#include <security/audit/audit.h> - #include <compat/freebsd32/freebsd32_util.h> #include <amd64/linux32/linux.h> #include <amd64/linux32/linux32_proto.h> #include <compat/linux/linux_emul.h> #include <compat/linux/linux_fork.h> #include <compat/linux/linux_ipc.h> -#include <compat/linux/linux_misc.h> #include <compat/linux/linux_mmap.h> #include <compat/linux/linux_signal.h> #include <compat/linux/linux_util.h> @@ -128,119 +97,16 @@ linux_copyout_rusage(struct rusage *ru, void *uaddr) } int -linux_execve(struct thread *td, struct linux_execve_args *args) -{ - struct image_args eargs; - char *path; - int error; - - LCONVPATHEXIST(args->path, &path); - - error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE, - args->argp, args->envp); - free(path, M_TEMP); - if (error == 0) - error = linux_common_execve(td, &eargs); - AUDIT_SYSCALL_EXIT(error == EJUSTRETURN ? 0 : error, td); - return (error); -} - -CTASSERT(sizeof(struct l_iovec32) == 8); - -int -linux32_copyinuio(struct l_iovec32 *iovp, l_ulong iovcnt, struct uio **uiop) -{ - struct l_iovec32 iov32; - struct iovec *iov; - struct uio *uio; - uint32_t iovlen; - int error, i; - - *uiop = NULL; - if (iovcnt > UIO_MAXIOV) - return (EINVAL); - iovlen = iovcnt * sizeof(struct iovec); - uio = malloc(iovlen + sizeof(*uio), M_IOV, M_WAITOK); - iov = (struct iovec *)(uio + 1); - for (i = 0; i < iovcnt; i++) { - error = copyin(&iovp[i], &iov32, sizeof(struct l_iovec32)); - if (error) { - free(uio, M_IOV); - return (error); - } - iov[i].iov_base = PTRIN(iov32.iov_base); - iov[i].iov_len = iov32.iov_len; - } - uio->uio_iov = iov; - uio->uio_iovcnt = iovcnt; - uio->uio_segflg = UIO_USERSPACE; - uio->uio_offset = -1; - uio->uio_resid = 0; - for (i = 0; i < iovcnt; i++) { - if (iov->iov_len > INT_MAX - uio->uio_resid) { - free(uio, M_IOV); - return (EINVAL); - } - uio->uio_resid += iov->iov_len; - iov++; - } - *uiop = uio; - return (0); -} - -int -linux32_copyiniov(struct l_iovec32 *iovp32, l_ulong iovcnt, struct iovec **iovp, - int error) -{ - struct l_iovec32 iov32; - struct iovec *iov; - uint32_t iovlen; - int i; - - *iovp = NULL; - if (iovcnt > UIO_MAXIOV) - return (error); - iovlen = iovcnt * sizeof(struct iovec); - iov = malloc(iovlen, M_IOV, M_WAITOK); - for (i = 0; i < iovcnt; i++) { - error = copyin(&iovp32[i], &iov32, sizeof(struct l_iovec32)); - if (error) { - free(iov, M_IOV); - return (error); - } - iov[i].iov_base = PTRIN(iov32.iov_base); - iov[i].iov_len = iov32.iov_len; - } - *iovp = iov; - return(0); - -} - -int linux_readv(struct thread *td, struct linux_readv_args *uap) { struct uio *auio; int error; - error = linux32_copyinuio(uap->iovp, uap->iovcnt, &auio); + error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio); if (error) return (error); error = kern_readv(td, uap->fd, auio); - free(auio, M_IOV); - return (error); -} - -int -linux_writev(struct thread *td, struct linux_writev_args *uap) -{ - struct uio *auio; - int error; - - error = linux32_copyinuio(uap->iovp, uap->iovcnt, &auio); - if (error) - return (error); - error = kern_writev(td, uap->fd, auio); - free(auio, M_IOV); + freeuio(auio); return (error); } @@ -255,12 +121,9 @@ linux_ipc(struct thread *td, struct linux_ipc_args *args) switch (args->what & 0xFFFF) { case LINUX_SEMOP: { - struct linux_semop_args a; - a.semid = args->arg1; - a.tsops = PTRIN(args->ptr); - a.nsops = args->arg2; - return (linux_semop(td, &a)); + return (kern_semop(td, args->arg1, PTRIN(args->ptr), + args->arg2, NULL)); } case LINUX_SEMGET: { struct linux_semget_args a; @@ -282,6 +145,15 @@ linux_ipc(struct thread *td, struct linux_ipc_args *args) return (error); return (linux_semctl(td, &a)); } + case LINUX_SEMTIMEDOP: { + struct linux_semtimedop_args a; + + a.semid = args->arg1; + a.tsops = PTRIN(args->ptr); + a.nsops = args->arg2; + a.timeout = PTRIN(args->arg5); + return (linux_semtimedop(td, &a)); + } case LINUX_MSGSND: { struct linux_msgsnd_args a; @@ -435,15 +307,6 @@ linux_set_upcall(struct thread *td, register_t stack) } int -linux_mmap2(struct thread *td, struct linux_mmap2_args *args) -{ - - return (linux_mmap_common(td, PTROUT(args->addr), args->len, args->prot, - args->flags, args->fd, (uint64_t)(uint32_t)args->pgoff * - PAGE_SIZE)); -} - -int linux_mmap(struct thread *td, struct linux_mmap_args *args) { int error; @@ -459,20 +322,6 @@ linux_mmap(struct thread *td, struct linux_mmap_args *args) } int -linux_mprotect(struct thread *td, struct linux_mprotect_args *uap) -{ - - return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len, uap->prot)); -} - -int -linux_madvise(struct thread *td, struct linux_madvise_args *uap) -{ - - return (linux_madvise_common(td, PTROUT(uap->addr), uap->len, uap->behav)); -} - -int linux_iopl(struct thread *td, struct linux_iopl_args *args) { int error; @@ -628,7 +477,7 @@ linux_set_thread_area(struct thread *td, /* * Semantics of Linux version: every thread in the system has array * of three TLS descriptors. 1st is GLIBC TLS, 2nd is WINE, 3rd unknown. - * This syscall loads one of the selected TLS decriptors with a value + * This syscall loads one of the selected TLS descriptors with a value * and also loads GDT descriptors 6, 7 and 8 with the content of * the per-thread descriptors. * @@ -745,3 +594,21 @@ DEFINE_IFUNC(, int, futex_xorl, (int, uint32_t *, int *)) return ((cpu_stdext_feature & CPUID_STDEXT_SMAP) != 0 ? futex_xorl_smap : futex_xorl_nosmap); } + +int +linux_ptrace_peekuser(struct thread *td, pid_t pid, void *addr, void *data) +{ + + LINUX_RATELIMIT_MSG_OPT1("PTRACE_PEEKUSER offset %ld not implemented; " + "returning EINVAL", (uintptr_t)addr); + return (EINVAL); +} + +int +linux_ptrace_pokeuser(struct thread *td, pid_t pid, void *addr, void *data) +{ + + LINUX_RATELIMIT_MSG_OPT1("PTRACE_POKEUSER offset %ld " + "not implemented; returning EINVAL", (uintptr_t)addr); + return (EINVAL); +} diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index 819ec994d0c9..59bb85e742db 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -2,14 +2,13 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically @generated. - * $FreeBSD$ */ #ifndef _LINUX32_SYSPROTO_H_ #define _LINUX32_SYSPROTO_H_ +#include <sys/types.h> #include <sys/signal.h> -#include <sys/acl.h> #include <sys/cpuset.h> #include <sys/domainset.h> #include <sys/_ffcounter.h> @@ -23,8 +22,8 @@ struct proc; struct thread; -#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ - 0 : sizeof(register_t) - sizeof(t)) +#define PAD_(t) (sizeof(syscallarg_t) <= sizeof(t) ? \ + 0 : sizeof(syscallarg_t) - sizeof(t)) #if BYTE_ORDER == LITTLE_ENDIAN #define PADL_(t) 0 @@ -34,12 +33,16 @@ struct thread; #define PADR_(t) 0 #endif -#define nosys linux_nosys struct linux_exit_args { char rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)]; }; struct linux_fork_args { - register_t dummy; + syscallarg_t dummy; +}; +struct linux_write_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)]; + char nbyte_l_[PADL_(l_size_t)]; l_size_t nbyte; char nbyte_r_[PADR_(l_size_t)]; }; struct linux_open_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; @@ -64,8 +67,8 @@ struct linux_unlink_args { }; struct linux_execve_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char argp_l_[PADL_(uint32_t *)]; uint32_t * argp; char argp_r_[PADR_(uint32_t *)]; - char envp_l_[PADL_(uint32_t *)]; uint32_t * envp; char envp_r_[PADR_(uint32_t *)]; + char argp_l_[PADL_(l_uintptr_t *)]; l_uintptr_t * argp; char argp_r_[PADR_(l_uintptr_t *)]; + char envp_l_[PADL_(l_uintptr_t *)]; l_uintptr_t * envp; char envp_r_[PADR_(l_uintptr_t *)]; }; struct linux_chdir_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; @@ -89,7 +92,7 @@ struct linux_lchown16_args { }; struct linux_stat_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char up_l_[PADL_(struct linux_stat *)]; struct linux_stat * up; char up_r_[PADR_(struct linux_stat *)]; + char up_l_[PADL_(struct l_old_stat *)]; struct l_old_stat * up; char up_r_[PADR_(struct l_old_stat *)]; }; struct linux_lseek_args { char fdes_l_[PADL_(l_uint)]; l_uint fdes; char fdes_r_[PADR_(l_uint)]; @@ -97,7 +100,7 @@ struct linux_lseek_args { char whence_l_[PADL_(l_int)]; l_int whence; char whence_r_[PADR_(l_int)]; }; struct linux_getpid_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_mount_args { char specialfile_l_[PADL_(char *)]; char * specialfile; char specialfile_r_[PADR_(char *)]; @@ -113,10 +116,10 @@ struct linux_setuid16_args { char uid_l_[PADL_(l_uid16_t)]; l_uid16_t uid; char uid_r_[PADR_(l_uid16_t)]; }; struct linux_getuid16_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_stime_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_ptrace_args { char req_l_[PADL_(l_long)]; l_long req; char req_r_[PADR_(l_long)]; @@ -128,7 +131,7 @@ struct linux_alarm_args { char secs_l_[PADL_(l_uint)]; l_uint secs; char secs_r_[PADR_(l_uint)]; }; struct linux_pause_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_utime_args { char fname_l_[PADL_(char *)]; char * fname; char fname_r_[PADR_(char *)]; @@ -169,17 +172,17 @@ struct linux_setgid16_args { char gid_l_[PADL_(l_gid16_t)]; l_gid16_t gid; char gid_r_[PADR_(l_gid16_t)]; }; struct linux_getgid16_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_signal_args { char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)]; char handler_l_[PADL_(l_handler_t)]; l_handler_t handler; char handler_r_[PADR_(l_handler_t)]; }; struct linux_geteuid16_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_getegid16_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_umount_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; @@ -196,14 +199,14 @@ struct linux_fcntl_args { char arg_l_[PADL_(uintptr_t)]; uintptr_t arg; char arg_r_[PADR_(uintptr_t)]; }; struct linux_olduname_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_ustat_args { char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)]; char ubuf_l_[PADL_(struct l_ustat *)]; struct l_ustat * ubuf; char ubuf_r_[PADR_(struct l_ustat *)]; }; struct linux_getppid_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_sigaction_args { char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)]; @@ -211,7 +214,7 @@ struct linux_sigaction_args { char osa_l_[PADL_(l_osigaction_t *)]; l_osigaction_t * osa; char osa_r_[PADR_(l_osigaction_t *)]; }; struct linux_sgetmask_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_ssetmask_args { char mask_l_[PADL_(l_osigset_t)]; l_osigset_t mask; char mask_r_[PADR_(l_osigset_t)]; @@ -273,7 +276,7 @@ struct linux_symlink_args { }; struct linux_lstat_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char up_l_[PADL_(struct linux_lstat *)]; struct linux_lstat * up; char up_r_[PADR_(struct linux_lstat *)]; + char up_l_[PADL_(struct l_old_stat *)]; struct l_old_stat * up; char up_r_[PADR_(struct l_old_stat *)]; }; struct linux_readlink_args { char name_l_[PADL_(char *)]; char * name; char name_r_[PADR_(char *)]; @@ -345,13 +348,13 @@ struct linux_newfstat_args { char buf_l_[PADL_(struct l_newstat *)]; struct l_newstat * buf; char buf_r_[PADR_(struct l_newstat *)]; }; struct linux_uname_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_iopl_args { char level_l_[PADL_(l_int)]; l_int level; char level_r_[PADR_(l_int)]; }; struct linux_vhangup_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_wait4_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; @@ -360,7 +363,7 @@ struct linux_wait4_args { char rusage_l_[PADL_(struct l_rusage *)]; struct l_rusage * rusage; char rusage_r_[PADR_(struct l_rusage *)]; }; struct linux_swapoff_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_sysinfo_args { char info_l_[PADL_(struct l_sysinfo *)]; struct l_sysinfo * info; char info_r_[PADR_(struct l_sysinfo *)]; @@ -391,7 +394,7 @@ struct linux_newuname_args { char buf_l_[PADL_(struct l_new_utsname *)]; struct l_new_utsname * buf; char buf_r_[PADR_(struct l_new_utsname *)]; }; struct linux_adjtimex_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_mprotect_args { char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; @@ -404,16 +407,16 @@ struct linux_sigprocmask_args { char omask_l_[PADL_(l_osigset_t *)]; l_osigset_t * omask; char omask_r_[PADR_(l_osigset_t *)]; }; struct linux_init_module_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_delete_module_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_quotactl_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_bdflush_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_sysfs_args { char option_l_[PADL_(l_int)]; l_int option; char option_r_[PADR_(l_int)]; @@ -455,12 +458,12 @@ struct linux_msync_args { }; struct linux_readv_args { char fd_l_[PADL_(l_ulong)]; l_ulong fd; char fd_r_[PADR_(l_ulong)]; - char iovp_l_[PADL_(struct l_iovec32 *)]; struct l_iovec32 * iovp; char iovp_r_[PADR_(struct l_iovec32 *)]; + char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)]; char iovcnt_l_[PADL_(l_ulong)]; l_ulong iovcnt; char iovcnt_r_[PADR_(l_ulong)]; }; struct linux_writev_args { char fd_l_[PADL_(l_ulong)]; l_ulong fd; char fd_r_[PADR_(l_ulong)]; - char iovp_l_[PADL_(struct l_iovec32 *)]; struct l_iovec32 * iovp; char iovp_r_[PADR_(struct l_iovec32 *)]; + char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)]; char iovcnt_l_[PADL_(l_ulong)]; l_ulong iovcnt; char iovcnt_r_[PADR_(l_ulong)]; }; struct linux_getsid_args { @@ -536,10 +539,10 @@ struct linux_getresgid16_args { }; struct linux_prctl_args { char option_l_[PADL_(l_int)]; l_int option; char option_r_[PADR_(l_int)]; - char arg2_l_[PADL_(l_int)]; l_int arg2; char arg2_r_[PADR_(l_int)]; - char arg3_l_[PADL_(l_int)]; l_int arg3; char arg3_r_[PADR_(l_int)]; - char arg4_l_[PADL_(l_int)]; l_int arg4; char arg4_r_[PADR_(l_int)]; - char arg5_l_[PADL_(l_int)]; l_int arg5; char arg5_r_[PADR_(l_int)]; + char arg2_l_[PADL_(l_uintptr_t)]; l_uintptr_t arg2; char arg2_r_[PADR_(l_uintptr_t)]; + char arg3_l_[PADL_(l_uintptr_t)]; l_uintptr_t arg3; char arg3_r_[PADR_(l_uintptr_t)]; + char arg4_l_[PADL_(l_uintptr_t)]; l_uintptr_t arg4; char arg4_r_[PADR_(l_uintptr_t)]; + char arg5_l_[PADL_(l_uintptr_t)]; l_uintptr_t arg5; char arg5_r_[PADR_(l_uintptr_t)]; }; struct linux_rt_sigreturn_args { char ucp_l_[PADL_(struct l_ucontext *)]; struct l_ucontext * ucp; char ucp_r_[PADR_(struct l_ucontext *)]; @@ -613,11 +616,11 @@ struct linux_sigaltstack_args { struct linux_sendfile_args { char out_l_[PADL_(l_int)]; l_int out; char out_r_[PADR_(l_int)]; char in_l_[PADL_(l_int)]; l_int in; char in_r_[PADR_(l_int)]; - char offset_l_[PADL_(l_long *)]; l_long * offset; char offset_r_[PADR_(l_long *)]; + char offset_l_[PADL_(l_off_t *)]; l_off_t * offset; char offset_r_[PADR_(l_off_t *)]; char count_l_[PADL_(l_size_t)]; l_size_t count; char count_r_[PADR_(l_size_t)]; }; struct linux_vfork_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_getrlimit_args { char resource_l_[PADL_(l_uint)]; l_uint resource; char resource_r_[PADR_(l_uint)]; @@ -659,10 +662,10 @@ struct linux_lchown_args { char gid_l_[PADL_(l_gid_t)]; l_gid_t gid; char gid_r_[PADR_(l_gid_t)]; }; struct linux_getuid_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_getgid_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_getgroups_args { char gidsetsize_l_[PADL_(l_int)]; l_int gidsetsize; char gidsetsize_r_[PADR_(l_int)]; @@ -708,60 +711,60 @@ struct linux_fcntl64_args { char arg_l_[PADL_(uintptr_t)]; uintptr_t arg; char arg_r_[PADR_(uintptr_t)]; }; struct linux_gettid_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_setxattr_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; - char value_l_[PADL_(const char *)]; const char * value; char value_r_[PADR_(const char *)]; + char value_l_[PADL_(void *)]; void * value; char value_r_[PADR_(void *)]; char size_l_[PADL_(l_size_t)]; l_size_t size; char size_r_[PADR_(l_size_t)]; char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_lsetxattr_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; - char value_l_[PADL_(const char *)]; const char * value; char value_r_[PADR_(const char *)]; + char value_l_[PADL_(void *)]; void * value; char value_r_[PADR_(void *)]; char size_l_[PADL_(l_size_t)]; l_size_t size; char size_r_[PADR_(l_size_t)]; char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_fsetxattr_args { char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; - char value_l_[PADL_(const char *)]; const char * value; char value_r_[PADR_(const char *)]; + char value_l_[PADL_(void *)]; void * value; char value_r_[PADR_(void *)]; char size_l_[PADL_(l_size_t)]; l_size_t size; char size_r_[PADR_(l_size_t)]; char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_getxattr_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; - char value_l_[PADL_(char *)]; char * value; char value_r_[PADR_(char *)]; + char value_l_[PADL_(void *)]; void * value; char value_r_[PADR_(void *)]; char size_l_[PADL_(l_size_t)]; l_size_t size; char size_r_[PADR_(l_size_t)]; }; struct linux_lgetxattr_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; - char value_l_[PADL_(char *)]; char * value; char value_r_[PADR_(char *)]; + char value_l_[PADL_(void *)]; void * value; char value_r_[PADR_(void *)]; char size_l_[PADL_(l_size_t)]; l_size_t size; char size_r_[PADR_(l_size_t)]; }; struct linux_fgetxattr_args { char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; - char value_l_[PADL_(char *)]; char * value; char value_r_[PADR_(char *)]; + char value_l_[PADL_(void *)]; void * value; char value_r_[PADR_(void *)]; char size_l_[PADL_(l_size_t)]; l_size_t size; char size_r_[PADR_(l_size_t)]; }; struct linux_listxattr_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; - char list_l_[PADL_(const char *)]; const char * list; char list_r_[PADR_(const char *)]; + char list_l_[PADL_(char *)]; char * list; char list_r_[PADR_(char *)]; char size_l_[PADL_(l_size_t)]; l_size_t size; char size_r_[PADR_(l_size_t)]; }; struct linux_llistxattr_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; - char list_l_[PADL_(const char *)]; const char * list; char list_r_[PADR_(const char *)]; + char list_l_[PADL_(char *)]; char * list; char list_r_[PADR_(char *)]; char size_l_[PADL_(l_size_t)]; l_size_t size; char size_r_[PADR_(l_size_t)]; }; struct linux_flistxattr_args { char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; - char list_l_[PADL_(const char *)]; const char * list; char list_r_[PADR_(const char *)]; + char list_l_[PADL_(char *)]; char * list; char list_r_[PADR_(char *)]; char size_l_[PADL_(l_size_t)]; l_size_t size; char size_r_[PADR_(l_size_t)]; }; struct linux_removexattr_args { @@ -818,7 +821,7 @@ struct linux_exit_group_args { char error_code_l_[PADL_(int)]; int error_code; char error_code_r_[PADR_(int)]; }; struct linux_lookup_dcookie_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_epoll_create_args { char size_l_[PADL_(l_int)]; l_int size; char size_r_[PADR_(l_int)]; @@ -836,7 +839,7 @@ struct linux_epoll_wait_args { char timeout_l_[PADL_(l_int)]; l_int timeout; char timeout_r_[PADR_(l_int)]; }; struct linux_remap_file_pages_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_set_tid_address_args { char tidptr_l_[PADL_(int *)]; int * tidptr; char tidptr_r_[PADR_(int *)]; @@ -908,13 +911,13 @@ struct linux_fadvise64_64_args { char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)]; }; struct linux_mbind_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_get_mempolicy_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_set_mempolicy_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_mq_open_args { char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; @@ -949,7 +952,7 @@ struct linux_mq_getsetattr_args { char oattr_l_[PADL_(struct mq_attr *)]; struct mq_attr * oattr; char oattr_r_[PADR_(struct mq_attr *)]; }; struct linux_kexec_load_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_waitid_args { char idtype_l_[PADL_(int)]; int idtype; char idtype_r_[PADR_(int)]; @@ -959,31 +962,34 @@ struct linux_waitid_args { char rusage_l_[PADL_(struct l_rusage *)]; struct l_rusage * rusage; char rusage_r_[PADR_(struct l_rusage *)]; }; struct linux_add_key_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_request_key_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_keyctl_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_ioprio_set_args { - register_t dummy; + char which_l_[PADL_(l_int)]; l_int which; char which_r_[PADR_(l_int)]; + char who_l_[PADL_(l_int)]; l_int who; char who_r_[PADR_(l_int)]; + char ioprio_l_[PADL_(l_int)]; l_int ioprio; char ioprio_r_[PADR_(l_int)]; }; struct linux_ioprio_get_args { - register_t dummy; + char which_l_[PADL_(l_int)]; l_int which; char which_r_[PADR_(l_int)]; + char who_l_[PADL_(l_int)]; l_int who; char who_r_[PADR_(l_int)]; }; struct linux_inotify_init_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_inotify_add_watch_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_inotify_rm_watch_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_migrate_pages_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_openat_args { char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)]; @@ -1000,7 +1006,7 @@ struct linux_mknodat_args { char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)]; char filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)]; char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)]; - char dev_l_[PADL_(l_uint)]; l_uint dev; char dev_r_[PADR_(l_uint)]; + char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)]; }; struct linux_fchownat_args { char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)]; @@ -1075,7 +1081,7 @@ struct linux_ppoll_args { char ssize_l_[PADL_(l_size_t)]; l_size_t ssize; char ssize_r_[PADR_(l_size_t)]; }; struct linux_unshare_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_set_robust_list_args { char head_l_[PADL_(struct linux_robust_list_head *)]; struct linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head *)]; @@ -1103,13 +1109,13 @@ struct linux_sync_file_range_args { char flags_l_[PADL_(unsigned int)]; unsigned int flags; char flags_r_[PADR_(unsigned int)]; }; struct linux_tee_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_vmsplice_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_move_pages_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_getcpu_args { char cpu_l_[PADL_(l_uint *)]; l_uint * cpu; char cpu_r_[PADR_(l_uint *)]; @@ -1131,7 +1137,7 @@ struct linux_utimensat_args { char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_signalfd_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_timerfd_create_args { char clockid_l_[PADL_(l_int)]; l_int clockid; char clockid_r_[PADR_(l_int)]; @@ -1159,7 +1165,7 @@ struct linux_timerfd_gettime_args { char old_value_l_[PADL_(struct l_itimerspec *)]; struct l_itimerspec * old_value; char old_value_r_[PADR_(struct l_itimerspec *)]; }; struct linux_signalfd4_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_eventfd2_args { char initval_l_[PADL_(l_uint)]; l_uint initval; char initval_r_[PADR_(l_uint)]; @@ -1178,7 +1184,7 @@ struct linux_pipe2_args { char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_inotify_init1_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_preadv_args { char fd_l_[PADL_(l_ulong)]; l_ulong fd; char fd_r_[PADR_(l_ulong)]; @@ -1201,7 +1207,7 @@ struct linux_rt_tgsigqueueinfo_args { char uinfo_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * uinfo; char uinfo_r_[PADR_(l_siginfo_t *)]; }; struct linux_perf_event_open_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_recvmmsg_args { char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)]; @@ -1211,10 +1217,10 @@ struct linux_recvmmsg_args { char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)]; }; struct linux_fanotify_init_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_fanotify_mark_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_prlimit64_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; @@ -1235,7 +1241,7 @@ struct linux_open_by_handle_at_args { char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_clock_adjtime_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_syncfs_args { char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; @@ -1247,7 +1253,7 @@ struct linux_sendmmsg_args { char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; }; struct linux_setns_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_process_vm_readv_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; @@ -1467,10 +1473,13 @@ struct linux_arch_prctl_args { char arg2_l_[PADL_(l_ulong)]; l_ulong arg2; char arg2_r_[PADR_(l_ulong)]; }; struct linux_io_pgetevents_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_rseq_args { - register_t dummy; + char rseq_l_[PADL_(struct linux_rseq *)]; struct linux_rseq * rseq; char rseq_r_[PADR_(struct linux_rseq *)]; + char rseq_len_l_[PADL_(uint32_t)]; uint32_t rseq_len; char rseq_len_r_[PADR_(uint32_t)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; + char sig_l_[PADL_(uint32_t)]; uint32_t sig; char sig_r_[PADR_(uint32_t)]; }; struct linux_semget_args { char key_l_[PADL_(l_key_t)]; l_key_t key; char key_r_[PADR_(l_key_t)]; @@ -1532,7 +1541,7 @@ struct linux_clock_settime64_args { char tp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp; char tp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_adjtime64_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_clock_getres_time64_args { char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; @@ -1545,16 +1554,24 @@ struct linux_clock_nanosleep_time64_args { char rmtp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * rmtp; char rmtp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_timer_gettime64_args { - register_t dummy; + char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)]; + char setting_l_[PADL_(struct l_itimerspec64 *)]; struct l_itimerspec64 * setting; char setting_r_[PADR_(struct l_itimerspec64 *)]; }; struct linux_timer_settime64_args { - register_t dummy; + char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; + char new_l_[PADL_(const struct l_itimerspec64 *)]; const struct l_itimerspec64 * new; char new_r_[PADR_(const struct l_itimerspec64 *)]; + char old_l_[PADL_(struct l_itimerspec64 *)]; struct l_itimerspec64 * old; char old_r_[PADR_(struct l_itimerspec64 *)]; }; struct linux_timerfd_gettime64_args { - register_t dummy; + char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; + char old_value_l_[PADL_(struct l_itimerspec64 *)]; struct l_itimerspec64 * old_value; char old_value_r_[PADR_(struct l_itimerspec64 *)]; }; struct linux_timerfd_settime64_args { - register_t dummy; + char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; + char new_value_l_[PADL_(const struct l_itimerspec64 *)]; const struct l_itimerspec64 * new_value; char new_value_r_[PADR_(const struct l_itimerspec64 *)]; + char old_value_l_[PADL_(struct l_itimerspec64 *)]; struct l_itimerspec64 * old_value; char old_value_r_[PADR_(struct l_itimerspec64 *)]; }; struct linux_utimensat_time64_args { char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)]; @@ -1573,24 +1590,31 @@ struct linux_pselect6_time64_args { struct linux_ppoll_time64_args { char fds_l_[PADL_(struct pollfd *)]; struct pollfd * fds; char fds_r_[PADR_(struct pollfd *)]; char nfds_l_[PADL_(uint32_t)]; uint32_t nfds; char nfds_r_[PADR_(uint32_t)]; - char tsp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tsp; char tsp_r_[PADR_(struct l_timespec *)]; + char tsp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tsp; char tsp_r_[PADR_(struct l_timespec64 *)]; char sset_l_[PADL_(l_sigset_t *)]; l_sigset_t * sset; char sset_r_[PADR_(l_sigset_t *)]; char ssize_l_[PADL_(l_size_t)]; l_size_t ssize; char ssize_r_[PADR_(l_size_t)]; }; struct linux_io_pgetevents_time64_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_recvmmsg_time64_args { - register_t dummy; + char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)]; + char msg_l_[PADL_(struct l_mmsghdr *)]; struct l_mmsghdr * msg; char msg_r_[PADR_(struct l_mmsghdr *)]; + char vlen_l_[PADL_(l_uint)]; l_uint vlen; char vlen_r_[PADR_(l_uint)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; + char timeout_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * timeout; char timeout_r_[PADR_(struct l_timespec64 *)]; }; struct linux_mq_timedsend_time64_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_mq_timedreceive_time64_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_semtimedop_time64_args { - register_t dummy; + char semid_l_[PADL_(l_int)]; l_int semid; char semid_r_[PADR_(l_int)]; + char tsops_l_[PADL_(struct sembuf *)]; struct sembuf * tsops; char tsops_r_[PADR_(struct sembuf *)]; + char nsops_l_[PADL_(l_size_t)]; l_size_t nsops; char nsops_r_[PADR_(l_size_t)]; + char timeout_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * timeout; char timeout_r_[PADR_(struct l_timespec64 *)]; }; struct linux_rt_sigtimedwait_time64_args { char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)]; @@ -1607,7 +1631,8 @@ struct linux_sys_futex_time64_args { char val3_l_[PADL_(uint32_t)]; uint32_t val3; char val3_r_[PADR_(uint32_t)]; }; struct linux_sched_rr_get_interval_time64_args { - register_t dummy; + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char interval_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * interval; char interval_r_[PADR_(struct l_timespec64 *)]; }; struct linux_pidfd_send_signal_args { char pidfd_l_[PADL_(l_int)]; l_int pidfd; char pidfd_r_[PADR_(l_int)]; @@ -1616,47 +1641,49 @@ struct linux_pidfd_send_signal_args { char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; }; struct linux_io_uring_setup_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_io_uring_enter_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_io_uring_register_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_open_tree_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_move_mount_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_fsopen_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_fsconfig_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_fsmount_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_fspick_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_pidfd_open_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_clone3_args { char uargs_l_[PADL_(struct l_user_clone_args *)]; struct l_user_clone_args * uargs; char uargs_r_[PADR_(struct l_user_clone_args *)]; char usize_l_[PADL_(l_size_t)]; l_size_t usize; char usize_r_[PADR_(l_size_t)]; }; struct linux_close_range_args { - register_t dummy; + char first_l_[PADL_(l_uint)]; l_uint first; char first_r_[PADR_(l_uint)]; + char last_l_[PADL_(l_uint)]; l_uint last; char last_r_[PADR_(l_uint)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; }; struct linux_openat2_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_pidfd_getfd_args { - register_t dummy; + syscallarg_t dummy; }; struct linux_faccessat2_args { char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)]; @@ -1665,17 +1692,52 @@ struct linux_faccessat2_args { char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_process_madvise_args { - register_t dummy; + syscallarg_t dummy; }; -struct linux_epoll_pwait2_args { - register_t dummy; +struct linux_epoll_pwait2_64_args { + char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)]; + char events_l_[PADL_(struct epoll_event *)]; struct epoll_event * events; char events_r_[PADR_(struct epoll_event *)]; + char maxevents_l_[PADL_(l_int)]; l_int maxevents; char maxevents_r_[PADR_(l_int)]; + char timeout_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * timeout; char timeout_r_[PADR_(struct l_timespec64 *)]; + char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)]; + char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)]; }; struct linux_mount_setattr_args { - register_t dummy; + syscallarg_t dummy; +}; +struct linux_quotactl_fd_args { + syscallarg_t dummy; +}; +struct linux_landlock_create_ruleset_args { + syscallarg_t dummy; +}; +struct linux_landlock_add_rule_args { + syscallarg_t dummy; +}; +struct linux_landlock_restrict_self_args { + syscallarg_t dummy; +}; +struct linux_memfd_secret_args { + syscallarg_t dummy; +}; +struct linux_process_mrelease_args { + syscallarg_t dummy; +}; +struct linux_futex_waitv_args { + syscallarg_t dummy; +}; +struct linux_set_mempolicy_home_node_args { + syscallarg_t dummy; +}; +struct linux_cachestat_args { + syscallarg_t dummy; +}; +struct linux_fchmodat2_args { + syscallarg_t dummy; }; -#define nosys linux_nosys int linux_exit(struct thread *, struct linux_exit_args *); int linux_fork(struct thread *, struct linux_fork_args *); +int linux_write(struct thread *, struct linux_write_args *); int linux_open(struct thread *, struct linux_open_args *); int linux_waitpid(struct thread *, struct linux_waitpid_args *); int linux_creat(struct thread *, struct linux_creat_args *); @@ -2035,59 +2097,21 @@ int linux_openat2(struct thread *, struct linux_openat2_args *); int linux_pidfd_getfd(struct thread *, struct linux_pidfd_getfd_args *); int linux_faccessat2(struct thread *, struct linux_faccessat2_args *); int linux_process_madvise(struct thread *, struct linux_process_madvise_args *); -int linux_epoll_pwait2(struct thread *, struct linux_epoll_pwait2_args *); +int linux_epoll_pwait2_64(struct thread *, struct linux_epoll_pwait2_64_args *); int linux_mount_setattr(struct thread *, struct linux_mount_setattr_args *); - -#ifdef COMPAT_43 - -#define nosys linux_nosys - -#endif /* COMPAT_43 */ - - -#ifdef COMPAT_FREEBSD4 - -#define nosys linux_nosys - -#endif /* COMPAT_FREEBSD4 */ - - -#ifdef COMPAT_FREEBSD6 - -#define nosys linux_nosys - -#endif /* COMPAT_FREEBSD6 */ - - -#ifdef COMPAT_FREEBSD7 - -#define nosys linux_nosys - -#endif /* COMPAT_FREEBSD7 */ - - -#ifdef COMPAT_FREEBSD10 - -#define nosys linux_nosys - -#endif /* COMPAT_FREEBSD10 */ - - -#ifdef COMPAT_FREEBSD11 - -#define nosys linux_nosys - -#endif /* COMPAT_FREEBSD11 */ - - -#ifdef COMPAT_FREEBSD12 - -#define nosys linux_nosys - -#endif /* COMPAT_FREEBSD12 */ - +int linux_quotactl_fd(struct thread *, struct linux_quotactl_fd_args *); +int linux_landlock_create_ruleset(struct thread *, struct linux_landlock_create_ruleset_args *); +int linux_landlock_add_rule(struct thread *, struct linux_landlock_add_rule_args *); +int linux_landlock_restrict_self(struct thread *, struct linux_landlock_restrict_self_args *); +int linux_memfd_secret(struct thread *, struct linux_memfd_secret_args *); +int linux_process_mrelease(struct thread *, struct linux_process_mrelease_args *); +int linux_futex_waitv(struct thread *, struct linux_futex_waitv_args *); +int linux_set_mempolicy_home_node(struct thread *, struct linux_set_mempolicy_home_node_args *); +int linux_cachestat(struct thread *, struct linux_cachestat_args *); +int linux_fchmodat2(struct thread *, struct linux_fchmodat2_args *); #define LINUX32_SYS_AUE_linux_exit AUE_EXIT #define LINUX32_SYS_AUE_linux_fork AUE_FORK +#define LINUX32_SYS_AUE_linux_write AUE_NULL #define LINUX32_SYS_AUE_linux_open AUE_OPEN_RWTC #define LINUX32_SYS_AUE_linux_waitpid AUE_WAIT4 #define LINUX32_SYS_AUE_linux_creat AUE_CREAT @@ -2302,8 +2326,8 @@ int linux_mount_setattr(struct thread *, struct linux_mount_setattr_args *); #define LINUX32_SYS_AUE_linux_add_key AUE_NULL #define LINUX32_SYS_AUE_linux_request_key AUE_NULL #define LINUX32_SYS_AUE_linux_keyctl AUE_NULL -#define LINUX32_SYS_AUE_linux_ioprio_set AUE_NULL -#define LINUX32_SYS_AUE_linux_ioprio_get AUE_NULL +#define LINUX32_SYS_AUE_linux_ioprio_set AUE_SETPRIORITY +#define LINUX32_SYS_AUE_linux_ioprio_get AUE_GETPRIORITY #define LINUX32_SYS_AUE_linux_inotify_init AUE_NULL #define LINUX32_SYS_AUE_linux_inotify_add_watch AUE_NULL #define LINUX32_SYS_AUE_linux_inotify_rm_watch AUE_NULL @@ -2429,7 +2453,7 @@ int linux_mount_setattr(struct thread *, struct linux_mount_setattr_args *); #define LINUX32_SYS_AUE_linux_semtimedop_time64 AUE_NULL #define LINUX32_SYS_AUE_linux_rt_sigtimedwait_time64 AUE_NULL #define LINUX32_SYS_AUE_linux_sys_futex_time64 AUE_NULL -#define LINUX32_SYS_AUE_linux_sched_rr_get_interval_time64 AUE_NULL +#define LINUX32_SYS_AUE_linux_sched_rr_get_interval_time64 AUE_SCHED_RR_GET_INTERVAL #define LINUX32_SYS_AUE_linux_pidfd_send_signal AUE_NULL #define LINUX32_SYS_AUE_linux_io_uring_setup AUE_NULL #define LINUX32_SYS_AUE_linux_io_uring_enter AUE_NULL @@ -2442,13 +2466,23 @@ int linux_mount_setattr(struct thread *, struct linux_mount_setattr_args *); #define LINUX32_SYS_AUE_linux_fspick AUE_NULL #define LINUX32_SYS_AUE_linux_pidfd_open AUE_NULL #define LINUX32_SYS_AUE_linux_clone3 AUE_NULL -#define LINUX32_SYS_AUE_linux_close_range AUE_NULL +#define LINUX32_SYS_AUE_linux_close_range AUE_CLOSERANGE #define LINUX32_SYS_AUE_linux_openat2 AUE_NULL #define LINUX32_SYS_AUE_linux_pidfd_getfd AUE_NULL #define LINUX32_SYS_AUE_linux_faccessat2 AUE_NULL #define LINUX32_SYS_AUE_linux_process_madvise AUE_NULL -#define LINUX32_SYS_AUE_linux_epoll_pwait2 AUE_NULL +#define LINUX32_SYS_AUE_linux_epoll_pwait2_64 AUE_NULL #define LINUX32_SYS_AUE_linux_mount_setattr AUE_NULL +#define LINUX32_SYS_AUE_linux_quotactl_fd AUE_NULL +#define LINUX32_SYS_AUE_linux_landlock_create_ruleset AUE_NULL +#define LINUX32_SYS_AUE_linux_landlock_add_rule AUE_NULL +#define LINUX32_SYS_AUE_linux_landlock_restrict_self AUE_NULL +#define LINUX32_SYS_AUE_linux_memfd_secret AUE_NULL +#define LINUX32_SYS_AUE_linux_process_mrelease AUE_NULL +#define LINUX32_SYS_AUE_linux_futex_waitv AUE_NULL +#define LINUX32_SYS_AUE_linux_set_mempolicy_home_node AUE_NULL +#define LINUX32_SYS_AUE_linux_cachestat AUE_NULL +#define LINUX32_SYS_AUE_linux_fchmodat2 AUE_NULL #undef PAD_ #undef PADL_ diff --git a/sys/amd64/linux32/linux32_support.s b/sys/amd64/linux32/linux32_support.S index 2e2dbca4e24b..a316a9bf066d 100644 --- a/sys/amd64/linux32/linux32_support.s +++ b/sys/amd64/linux32/linux32_support.S @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2007 Konstantin Belousov * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #include "linux32_assym.h" /* system definitions */ @@ -39,7 +37,7 @@ futex_fault: je 1f clac 1: movq $0,PCB_ONFAULT(%r8) - movl $-EFAULT,%eax + movl $EFAULT,%eax ret ENTRY(futex_xchgl_nosmap) diff --git a/sys/amd64/linux32/linux32_syscall.h b/sys/amd64/linux32/linux32_syscall.h index b2724c50d6a0..c7a2e79842af 100644 --- a/sys/amd64/linux32/linux32_syscall.h +++ b/sys/amd64/linux32/linux32_syscall.h @@ -2,13 +2,12 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically @generated. - * $FreeBSD$ */ #define LINUX32_SYS_linux_exit 1 #define LINUX32_SYS_linux_fork 2 #define LINUX32_SYS_read 3 -#define LINUX32_SYS_write 4 +#define LINUX32_SYS_linux_write 4 #define LINUX32_SYS_linux_open 5 #define LINUX32_SYS_close 6 #define LINUX32_SYS_linux_waitpid 7 @@ -402,6 +401,16 @@ #define LINUX32_SYS_linux_pidfd_getfd 438 #define LINUX32_SYS_linux_faccessat2 439 #define LINUX32_SYS_linux_process_madvise 440 -#define LINUX32_SYS_linux_epoll_pwait2 441 +#define LINUX32_SYS_linux_epoll_pwait2_64 441 #define LINUX32_SYS_linux_mount_setattr 442 -#define LINUX32_SYS_MAXSYSCALL 444 +#define LINUX32_SYS_linux_quotactl_fd 443 +#define LINUX32_SYS_linux_landlock_create_ruleset 444 +#define LINUX32_SYS_linux_landlock_add_rule 445 +#define LINUX32_SYS_linux_landlock_restrict_self 446 +#define LINUX32_SYS_linux_memfd_secret 447 +#define LINUX32_SYS_linux_process_mrelease 448 +#define LINUX32_SYS_linux_futex_waitv 449 +#define LINUX32_SYS_linux_set_mempolicy_home_node 450 +#define LINUX32_SYS_linux_cachestat 451 +#define LINUX32_SYS_linux_fchmodat2 452 +#define LINUX32_SYS_MAXSYSCALL 453 diff --git a/sys/amd64/linux32/linux32_syscalls.c b/sys/amd64/linux32/linux32_syscalls.c index 3ee1639b5971..3308ffeb7712 100644 --- a/sys/amd64/linux32/linux32_syscalls.c +++ b/sys/amd64/linux32/linux32_syscalls.c @@ -2,16 +2,14 @@ * System call names. * * DO NOT EDIT-- this file is automatically @generated. - * $FreeBSD$ */ const char *linux32_syscallnames[] = { -#define nosys linux_nosys "#0", /* 0 = setup */ "linux_exit", /* 1 = linux_exit */ "linux_fork", /* 2 = linux_fork */ "read", /* 3 = read */ - "write", /* 4 = write */ + "linux_write", /* 4 = linux_write */ "linux_open", /* 5 = linux_open */ "close", /* 6 = close */ "linux_waitpid", /* 7 = linux_waitpid */ @@ -448,7 +446,16 @@ const char *linux32_syscallnames[] = { "linux_pidfd_getfd", /* 438 = linux_pidfd_getfd */ "linux_faccessat2", /* 439 = linux_faccessat2 */ "linux_process_madvise", /* 440 = linux_process_madvise */ - "linux_epoll_pwait2", /* 441 = linux_epoll_pwait2 */ + "linux_epoll_pwait2_64", /* 441 = linux_epoll_pwait2_64 */ "linux_mount_setattr", /* 442 = linux_mount_setattr */ - "#443", /* 443 = nosys */ + "linux_quotactl_fd", /* 443 = linux_quotactl_fd */ + "linux_landlock_create_ruleset", /* 444 = linux_landlock_create_ruleset */ + "linux_landlock_add_rule", /* 445 = linux_landlock_add_rule */ + "linux_landlock_restrict_self", /* 446 = linux_landlock_restrict_self */ + "linux_memfd_secret", /* 447 = linux_memfd_secret */ + "linux_process_mrelease", /* 448 = linux_process_mrelease */ + "linux_futex_waitv", /* 449 = linux_futex_waitv */ + "linux_set_mempolicy_home_node", /* 450 = linux_set_mempolicy_home_node */ + "linux_cachestat", /* 451 = linux_cachestat */ + "linux_fchmodat2", /* 452 = linux_fchmodat2 */ }; diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index 46b74d6a8139..024bca613c11 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -2,26 +2,24 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically @generated. - * $FreeBSD$ */ #include <sys/param.h> #include <sys/sysent.h> #include <sys/sysproto.h> -#include <compat/linux/linux_sysproto.h> +#include <compat/freebsd32/freebsd32_util.h> #include <amd64/linux32/linux.h> #include <amd64/linux32/linux32_proto.h> -#define AS(name) (sizeof(struct name) / sizeof(register_t)) +#define AS(name) (sizeof(struct name) / sizeof(syscallarg_t)) /* The casts are bogus but will do for now. */ struct sysent linux32_sysent[] = { -#define nosys linux_nosys { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 0 = setup */ { .sy_narg = AS(linux_exit_args), .sy_call = (sy_call_t *)linux_exit, .sy_auevent = AUE_EXIT, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 1 = linux_exit */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fork, .sy_auevent = AUE_FORK, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 2 = linux_fork */ { .sy_narg = AS(read_args), .sy_call = (sy_call_t *)sys_read, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 3 = read */ - { .sy_narg = AS(write_args), .sy_call = (sy_call_t *)sys_write, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 4 = write */ + { .sy_narg = AS(linux_write_args), .sy_call = (sy_call_t *)linux_write, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 4 = linux_write */ { .sy_narg = AS(linux_open_args), .sy_call = (sy_call_t *)linux_open, .sy_auevent = AUE_OPEN_RWTC, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 5 = linux_open */ { .sy_narg = AS(close_args), .sy_call = (sy_call_t *)sys_close, .sy_auevent = AUE_CLOSE, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 6 = close */ { .sy_narg = AS(linux_waitpid_args), .sy_call = (sy_call_t *)linux_waitpid, .sy_auevent = AUE_WAIT4, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 7 = linux_waitpid */ @@ -306,8 +304,8 @@ struct sysent linux32_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_add_key, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 286 = linux_add_key */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_request_key, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 287 = linux_request_key */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_keyctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 288 = linux_keyctl */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_ioprio_set, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 289 = linux_ioprio_set */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_ioprio_get, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 290 = linux_ioprio_get */ + { .sy_narg = AS(linux_ioprio_set_args), .sy_call = (sy_call_t *)linux_ioprio_set, .sy_auevent = AUE_SETPRIORITY, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 289 = linux_ioprio_set */ + { .sy_narg = AS(linux_ioprio_get_args), .sy_call = (sy_call_t *)linux_ioprio_get, .sy_auevent = AUE_GETPRIORITY, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 290 = linux_ioprio_get */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_init, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 291 = linux_inotify_init */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_add_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 292 = linux_inotify_add_watch */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_rm_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 293 = linux_inotify_rm_watch */ @@ -403,7 +401,7 @@ struct sysent linux32_sysent[] = { { .sy_narg = AS(linux_statx_args), .sy_call = (sy_call_t *)linux_statx, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 383 = linux_statx */ { .sy_narg = AS(linux_arch_prctl_args), .sy_call = (sy_call_t *)linux_arch_prctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 384 = linux_arch_prctl */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_io_pgetevents, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 385 = linux_io_pgetevents */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_rseq, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 386 = linux_rseq */ + { .sy_narg = AS(linux_rseq_args), .sy_call = (sy_call_t *)linux_rseq, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 386 = linux_rseq */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 387 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 388 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 389 = nosys */ @@ -425,22 +423,22 @@ struct sysent linux32_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 405 = linux_clock_adjtime64 */ { .sy_narg = AS(linux_clock_getres_time64_args), .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ { .sy_narg = AS(linux_clock_nanosleep_time64_args), .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 408 = linux_timer_gettime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 409 = linux_timer_settime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 410 = linux_timerfd_gettime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 411 = linux_timerfd_settime64 */ + { .sy_narg = AS(linux_timer_gettime64_args), .sy_call = (sy_call_t *)linux_timer_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 408 = linux_timer_gettime64 */ + { .sy_narg = AS(linux_timer_settime64_args), .sy_call = (sy_call_t *)linux_timer_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 409 = linux_timer_settime64 */ + { .sy_narg = AS(linux_timerfd_gettime64_args), .sy_call = (sy_call_t *)linux_timerfd_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 410 = linux_timerfd_gettime64 */ + { .sy_narg = AS(linux_timerfd_settime64_args), .sy_call = (sy_call_t *)linux_timerfd_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 411 = linux_timerfd_settime64 */ { .sy_narg = AS(linux_utimensat_time64_args), .sy_call = (sy_call_t *)linux_utimensat_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 412 = linux_utimensat_time64 */ { .sy_narg = AS(linux_pselect6_time64_args), .sy_call = (sy_call_t *)linux_pselect6_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 413 = linux_pselect6_time64 */ { .sy_narg = AS(linux_ppoll_time64_args), .sy_call = (sy_call_t *)linux_ppoll_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 414 = linux_ppoll_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 415 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_io_pgetevents_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 416 = linux_io_pgetevents_time64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_recvmmsg_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 417 = linux_recvmmsg_time64 */ + { .sy_narg = AS(linux_recvmmsg_time64_args), .sy_call = (sy_call_t *)linux_recvmmsg_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 417 = linux_recvmmsg_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_mq_timedsend_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 418 = linux_mq_timedsend_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_mq_timedreceive_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 419 = linux_mq_timedreceive_time64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_semtimedop_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 420 = linux_semtimedop_time64 */ + { .sy_narg = AS(linux_semtimedop_time64_args), .sy_call = (sy_call_t *)linux_semtimedop_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 420 = linux_semtimedop_time64 */ { .sy_narg = AS(linux_rt_sigtimedwait_time64_args), .sy_call = (sy_call_t *)linux_rt_sigtimedwait_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 421 = linux_rt_sigtimedwait_time64 */ { .sy_narg = AS(linux_sys_futex_time64_args), .sy_call = (sy_call_t *)linux_sys_futex_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 422 = linux_sys_futex_time64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_sched_rr_get_interval_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 423 = linux_sched_rr_get_interval_time64 */ + { .sy_narg = AS(linux_sched_rr_get_interval_time64_args), .sy_call = (sy_call_t *)linux_sched_rr_get_interval_time64, .sy_auevent = AUE_SCHED_RR_GET_INTERVAL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 423 = linux_sched_rr_get_interval_time64 */ { .sy_narg = AS(linux_pidfd_send_signal_args), .sy_call = (sy_call_t *)linux_pidfd_send_signal, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 424 = linux_pidfd_send_signal */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_io_uring_setup, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 425 = linux_io_uring_setup */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_io_uring_enter, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 426 = linux_io_uring_enter */ @@ -453,12 +451,21 @@ struct sysent linux32_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fspick, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 433 = linux_fspick */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_pidfd_open, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 434 = linux_pidfd_open */ { .sy_narg = AS(linux_clone3_args), .sy_call = (sy_call_t *)linux_clone3, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 435 = linux_clone3 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_close_range, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 436 = linux_close_range */ + { .sy_narg = AS(linux_close_range_args), .sy_call = (sy_call_t *)linux_close_range, .sy_auevent = AUE_CLOSERANGE, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 436 = linux_close_range */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_openat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 437 = linux_openat2 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_pidfd_getfd, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 438 = linux_pidfd_getfd */ { .sy_narg = AS(linux_faccessat2_args), .sy_call = (sy_call_t *)linux_faccessat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 439 = linux_faccessat2 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_process_madvise, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 440 = linux_process_madvise */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_epoll_pwait2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 441 = linux_epoll_pwait2 */ + { .sy_narg = AS(linux_epoll_pwait2_64_args), .sy_call = (sy_call_t *)linux_epoll_pwait2_64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 441 = linux_epoll_pwait2_64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_mount_setattr, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 442 = linux_mount_setattr */ - { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 443 = nosys */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_quotactl_fd, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 443 = linux_quotactl_fd */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_landlock_create_ruleset, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 444 = linux_landlock_create_ruleset */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_landlock_add_rule, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 445 = linux_landlock_add_rule */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_landlock_restrict_self, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 446 = linux_landlock_restrict_self */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_memfd_secret, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 447 = linux_memfd_secret */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_process_mrelease, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 448 = linux_process_mrelease */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_futex_waitv, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 449 = linux_futex_waitv */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_set_mempolicy_home_node, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 450 = linux_set_mempolicy_home_node */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_cachestat, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 451 = linux_cachestat */ + { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fchmodat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 452 = linux_fchmodat2 */ }; diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index c9c7914d01be..994f80b92d81 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -2,7 +2,6 @@ * System call argument to DTrace register array converstion. * * DO NOT EDIT-- this file is automatically @generated. - * $FreeBSD$ * This file is part of the DTrace syscall provider. */ @@ -12,7 +11,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) int64_t *iarg = (int64_t *)uarg; int a = 0; switch (sysnum) { -#define nosys linux_nosys /* linux_exit */ case 1: { struct linux_exit_args *p = params; @@ -34,12 +32,12 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } - /* write */ + /* linux_write */ case 4: { - struct write_args *p = params; + struct linux_write_args *p = params; iarg[a++] = p->fd; /* int */ uarg[a++] = (intptr_t)p->buf; /* char * */ - uarg[a++] = p->nbyte; /* u_int */ + iarg[a++] = p->nbyte; /* l_size_t */ *n_args = 3; break; } @@ -95,8 +93,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 11: { struct linux_execve_args *p = params; uarg[a++] = (intptr_t)p->path; /* char * */ - uarg[a++] = (intptr_t)p->argp; /* uint32_t * */ - uarg[a++] = (intptr_t)p->envp; /* uint32_t * */ + uarg[a++] = (intptr_t)p->argp; /* l_uintptr_t * */ + uarg[a++] = (intptr_t)p->envp; /* l_uintptr_t * */ *n_args = 3; break; } @@ -144,7 +142,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 18: { struct linux_stat_args *p = params; uarg[a++] = (intptr_t)p->path; /* char * */ - uarg[a++] = (intptr_t)p->up; /* struct linux_stat * */ + uarg[a++] = (intptr_t)p->up; /* struct l_old_stat * */ *n_args = 2; break; } @@ -563,7 +561,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 84: { struct linux_lstat_args *p = params; uarg[a++] = (intptr_t)p->path; /* char * */ - uarg[a++] = (intptr_t)p->up; /* struct linux_lstat * */ + uarg[a++] = (intptr_t)p->up; /* struct l_old_stat * */ *n_args = 2; break; } @@ -971,7 +969,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 145: { struct linux_readv_args *p = params; iarg[a++] = p->fd; /* l_ulong */ - uarg[a++] = (intptr_t)p->iovp; /* struct l_iovec32 * */ + uarg[a++] = (intptr_t)p->iovp; /* struct iovec32 * */ iarg[a++] = p->iovcnt; /* l_ulong */ *n_args = 3; break; @@ -980,7 +978,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 146: { struct linux_writev_args *p = params; iarg[a++] = p->fd; /* l_ulong */ - uarg[a++] = (intptr_t)p->iovp; /* struct l_iovec32 * */ + uarg[a++] = (intptr_t)p->iovp; /* struct iovec32 * */ iarg[a++] = p->iovcnt; /* l_ulong */ *n_args = 3; break; @@ -1161,10 +1159,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 172: { struct linux_prctl_args *p = params; iarg[a++] = p->option; /* l_int */ - iarg[a++] = p->arg2; /* l_int */ - iarg[a++] = p->arg3; /* l_int */ - iarg[a++] = p->arg4; /* l_int */ - iarg[a++] = p->arg5; /* l_int */ + uarg[a++] = (intptr_t)p->arg2; /* l_uintptr_t */ + uarg[a++] = (intptr_t)p->arg3; /* l_uintptr_t */ + uarg[a++] = (intptr_t)p->arg4; /* l_uintptr_t */ + uarg[a++] = (intptr_t)p->arg5; /* l_uintptr_t */ *n_args = 5; break; } @@ -1298,7 +1296,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_sendfile_args *p = params; iarg[a++] = p->out; /* l_int */ iarg[a++] = p->in; /* l_int */ - uarg[a++] = (intptr_t)p->offset; /* l_long * */ + uarg[a++] = (intptr_t)p->offset; /* l_off_t * */ iarg[a++] = p->count; /* l_size_t */ *n_args = 4; break; @@ -1563,7 +1561,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_setxattr_args *p = params; uarg[a++] = (intptr_t)p->path; /* const char * */ uarg[a++] = (intptr_t)p->name; /* const char * */ - uarg[a++] = (intptr_t)p->value; /* const char * */ + uarg[a++] = (intptr_t)p->value; /* void * */ iarg[a++] = p->size; /* l_size_t */ iarg[a++] = p->flags; /* l_int */ *n_args = 5; @@ -1574,7 +1572,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_lsetxattr_args *p = params; uarg[a++] = (intptr_t)p->path; /* const char * */ uarg[a++] = (intptr_t)p->name; /* const char * */ - uarg[a++] = (intptr_t)p->value; /* const char * */ + uarg[a++] = (intptr_t)p->value; /* void * */ iarg[a++] = p->size; /* l_size_t */ iarg[a++] = p->flags; /* l_int */ *n_args = 5; @@ -1585,7 +1583,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_fsetxattr_args *p = params; iarg[a++] = p->fd; /* l_int */ uarg[a++] = (intptr_t)p->name; /* const char * */ - uarg[a++] = (intptr_t)p->value; /* const char * */ + uarg[a++] = (intptr_t)p->value; /* void * */ iarg[a++] = p->size; /* l_size_t */ iarg[a++] = p->flags; /* l_int */ *n_args = 5; @@ -1596,7 +1594,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_getxattr_args *p = params; uarg[a++] = (intptr_t)p->path; /* const char * */ uarg[a++] = (intptr_t)p->name; /* const char * */ - uarg[a++] = (intptr_t)p->value; /* char * */ + uarg[a++] = (intptr_t)p->value; /* void * */ iarg[a++] = p->size; /* l_size_t */ *n_args = 4; break; @@ -1606,7 +1604,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_lgetxattr_args *p = params; uarg[a++] = (intptr_t)p->path; /* const char * */ uarg[a++] = (intptr_t)p->name; /* const char * */ - uarg[a++] = (intptr_t)p->value; /* char * */ + uarg[a++] = (intptr_t)p->value; /* void * */ iarg[a++] = p->size; /* l_size_t */ *n_args = 4; break; @@ -1616,7 +1614,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_fgetxattr_args *p = params; iarg[a++] = p->fd; /* l_int */ uarg[a++] = (intptr_t)p->name; /* const char * */ - uarg[a++] = (intptr_t)p->value; /* char * */ + uarg[a++] = (intptr_t)p->value; /* void * */ iarg[a++] = p->size; /* l_size_t */ *n_args = 4; break; @@ -1625,7 +1623,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 232: { struct linux_listxattr_args *p = params; uarg[a++] = (intptr_t)p->path; /* const char * */ - uarg[a++] = (intptr_t)p->list; /* const char * */ + uarg[a++] = (intptr_t)p->list; /* char * */ iarg[a++] = p->size; /* l_size_t */ *n_args = 3; break; @@ -1634,7 +1632,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 233: { struct linux_llistxattr_args *p = params; uarg[a++] = (intptr_t)p->path; /* const char * */ - uarg[a++] = (intptr_t)p->list; /* const char * */ + uarg[a++] = (intptr_t)p->list; /* char * */ iarg[a++] = p->size; /* l_size_t */ *n_args = 3; break; @@ -1643,7 +1641,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 234: { struct linux_flistxattr_args *p = params; iarg[a++] = p->fd; /* l_int */ - uarg[a++] = (intptr_t)p->list; /* const char * */ + uarg[a++] = (intptr_t)p->list; /* char * */ iarg[a++] = p->size; /* l_size_t */ *n_args = 3; break; @@ -2015,12 +2013,19 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_ioprio_set */ case 289: { - *n_args = 0; + struct linux_ioprio_set_args *p = params; + iarg[a++] = p->which; /* l_int */ + iarg[a++] = p->who; /* l_int */ + iarg[a++] = p->ioprio; /* l_int */ + *n_args = 3; break; } /* linux_ioprio_get */ case 290: { - *n_args = 0; + struct linux_ioprio_get_args *p = params; + iarg[a++] = p->which; /* l_int */ + iarg[a++] = p->who; /* l_int */ + *n_args = 2; break; } /* linux_inotify_init */ @@ -2068,7 +2073,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) iarg[a++] = p->dfd; /* l_int */ uarg[a++] = (intptr_t)p->filename; /* const char * */ iarg[a++] = p->mode; /* l_int */ - iarg[a++] = p->dev; /* l_uint */ + iarg[a++] = p->dev; /* l_dev_t */ *n_args = 4; break; } @@ -2867,7 +2872,12 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_rseq */ case 386: { - *n_args = 0; + struct linux_rseq_args *p = params; + uarg[a++] = (intptr_t)p->rseq; /* struct linux_rseq * */ + uarg[a++] = p->rseq_len; /* uint32_t */ + iarg[a++] = p->flags; /* l_int */ + uarg[a++] = p->sig; /* uint32_t */ + *n_args = 4; break; } /* linux_semget */ @@ -3002,22 +3012,38 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_timer_gettime64 */ case 408: { - *n_args = 0; + struct linux_timer_gettime64_args *p = params; + iarg[a++] = p->timerid; /* l_timer_t */ + uarg[a++] = (intptr_t)p->setting; /* struct l_itimerspec64 * */ + *n_args = 2; break; } /* linux_timer_settime64 */ case 409: { - *n_args = 0; + struct linux_timer_settime64_args *p = params; + iarg[a++] = p->timerid; /* l_timer_t */ + iarg[a++] = p->flags; /* l_int */ + uarg[a++] = (intptr_t)p->new; /* const struct l_itimerspec64 * */ + uarg[a++] = (intptr_t)p->old; /* struct l_itimerspec64 * */ + *n_args = 4; break; } /* linux_timerfd_gettime64 */ case 410: { - *n_args = 0; + struct linux_timerfd_gettime64_args *p = params; + iarg[a++] = p->fd; /* l_int */ + uarg[a++] = (intptr_t)p->old_value; /* struct l_itimerspec64 * */ + *n_args = 2; break; } /* linux_timerfd_settime64 */ case 411: { - *n_args = 0; + struct linux_timerfd_settime64_args *p = params; + iarg[a++] = p->fd; /* l_int */ + iarg[a++] = p->flags; /* l_int */ + uarg[a++] = (intptr_t)p->new_value; /* const struct l_itimerspec64 * */ + uarg[a++] = (intptr_t)p->old_value; /* struct l_itimerspec64 * */ + *n_args = 4; break; } /* linux_utimensat_time64 */ @@ -3047,7 +3073,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_ppoll_time64_args *p = params; uarg[a++] = (intptr_t)p->fds; /* struct pollfd * */ uarg[a++] = p->nfds; /* uint32_t */ - uarg[a++] = (intptr_t)p->tsp; /* struct l_timespec * */ + uarg[a++] = (intptr_t)p->tsp; /* struct l_timespec64 * */ uarg[a++] = (intptr_t)p->sset; /* l_sigset_t * */ iarg[a++] = p->ssize; /* l_size_t */ *n_args = 5; @@ -3060,7 +3086,13 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_recvmmsg_time64 */ case 417: { - *n_args = 0; + struct linux_recvmmsg_time64_args *p = params; + iarg[a++] = p->s; /* l_int */ + uarg[a++] = (intptr_t)p->msg; /* struct l_mmsghdr * */ + iarg[a++] = p->vlen; /* l_uint */ + iarg[a++] = p->flags; /* l_uint */ + uarg[a++] = (intptr_t)p->timeout; /* struct l_timespec64 * */ + *n_args = 5; break; } /* linux_mq_timedsend_time64 */ @@ -3075,7 +3107,12 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_semtimedop_time64 */ case 420: { - *n_args = 0; + struct linux_semtimedop_time64_args *p = params; + iarg[a++] = p->semid; /* l_int */ + uarg[a++] = (intptr_t)p->tsops; /* struct sembuf * */ + iarg[a++] = p->nsops; /* l_size_t */ + uarg[a++] = (intptr_t)p->timeout; /* struct l_timespec64 * */ + *n_args = 4; break; } /* linux_rt_sigtimedwait_time64 */ @@ -3102,7 +3139,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_sched_rr_get_interval_time64 */ case 423: { - *n_args = 0; + struct linux_sched_rr_get_interval_time64_args *p = params; + iarg[a++] = p->pid; /* l_pid_t */ + uarg[a++] = (intptr_t)p->interval; /* struct l_timespec64 * */ + *n_args = 2; break; } /* linux_pidfd_send_signal */ @@ -3175,7 +3215,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_close_range */ case 436: { - *n_args = 0; + struct linux_close_range_args *p = params; + iarg[a++] = p->first; /* l_uint */ + iarg[a++] = p->last; /* l_uint */ + iarg[a++] = p->flags; /* l_uint */ + *n_args = 3; break; } /* linux_openat2 */ @@ -3203,9 +3247,16 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 0; break; } - /* linux_epoll_pwait2 */ + /* linux_epoll_pwait2_64 */ case 441: { - *n_args = 0; + struct linux_epoll_pwait2_64_args *p = params; + iarg[a++] = p->epfd; /* l_int */ + uarg[a++] = (intptr_t)p->events; /* struct epoll_event * */ + iarg[a++] = p->maxevents; /* l_int */ + uarg[a++] = (intptr_t)p->timeout; /* struct l_timespec64 * */ + uarg[a++] = (intptr_t)p->mask; /* l_sigset_t * */ + iarg[a++] = p->sigsetsize; /* l_size_t */ + *n_args = 6; break; } /* linux_mount_setattr */ @@ -3213,6 +3264,56 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 0; break; } + /* linux_quotactl_fd */ + case 443: { + *n_args = 0; + break; + } + /* linux_landlock_create_ruleset */ + case 444: { + *n_args = 0; + break; + } + /* linux_landlock_add_rule */ + case 445: { + *n_args = 0; + break; + } + /* linux_landlock_restrict_self */ + case 446: { + *n_args = 0; + break; + } + /* linux_memfd_secret */ + case 447: { + *n_args = 0; + break; + } + /* linux_process_mrelease */ + case 448: { + *n_args = 0; + break; + } + /* linux_futex_waitv */ + case 449: { + *n_args = 0; + break; + } + /* linux_set_mempolicy_home_node */ + case 450: { + *n_args = 0; + break; + } + /* linux_cachestat */ + case 451: { + *n_args = 0; + break; + } + /* linux_fchmodat2 */ + case 452: { + *n_args = 0; + break; + } default: *n_args = 0; break; @@ -3223,7 +3324,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { -#define nosys linux_nosys /* linux_exit */ case 1: switch (ndx) { @@ -3253,7 +3353,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* write */ + /* linux_write */ case 4: switch (ndx) { case 0: @@ -3263,7 +3363,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland char *"; break; case 2: - p = "u_int"; + p = "l_size_t"; break; default: break; @@ -3354,10 +3454,10 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland char *"; break; case 1: - p = "userland uint32_t *"; + p = "userland l_uintptr_t *"; break; case 2: - p = "userland uint32_t *"; + p = "userland l_uintptr_t *"; break; default: break; @@ -3435,7 +3535,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland char *"; break; case 1: - p = "userland struct linux_stat *"; + p = "userland struct l_old_stat *"; break; default: break; @@ -4041,7 +4141,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland char *"; break; case 1: - p = "userland struct linux_lstat *"; + p = "userland struct l_old_stat *"; break; default: break; @@ -4685,7 +4785,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "l_ulong"; break; case 1: - p = "userland struct l_iovec32 *"; + p = "userland struct iovec32 *"; break; case 2: p = "l_ulong"; @@ -4701,7 +4801,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "l_ulong"; break; case 1: - p = "userland struct l_iovec32 *"; + p = "userland struct iovec32 *"; break; case 2: p = "l_ulong"; @@ -4989,16 +5089,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "l_int"; break; case 1: - p = "l_int"; + p = "l_uintptr_t"; break; case 2: - p = "l_int"; + p = "l_uintptr_t"; break; case 3: - p = "l_int"; + p = "l_uintptr_t"; break; case 4: - p = "l_int"; + p = "l_uintptr_t"; break; default: break; @@ -5235,7 +5335,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "l_int"; break; case 2: - p = "userland l_long *"; + p = "userland l_off_t *"; break; case 3: p = "l_size_t"; @@ -5649,7 +5749,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland const char *"; break; case 2: - p = "userland const char *"; + p = "userland void *"; break; case 3: p = "l_size_t"; @@ -5671,7 +5771,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland const char *"; break; case 2: - p = "userland const char *"; + p = "userland void *"; break; case 3: p = "l_size_t"; @@ -5693,7 +5793,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland const char *"; break; case 2: - p = "userland const char *"; + p = "userland void *"; break; case 3: p = "l_size_t"; @@ -5715,7 +5815,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland const char *"; break; case 2: - p = "userland char *"; + p = "userland void *"; break; case 3: p = "l_size_t"; @@ -5734,7 +5834,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland const char *"; break; case 2: - p = "userland char *"; + p = "userland void *"; break; case 3: p = "l_size_t"; @@ -5753,7 +5853,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland const char *"; break; case 2: - p = "userland char *"; + p = "userland void *"; break; case 3: p = "l_size_t"; @@ -5769,7 +5869,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland const char *"; break; case 1: - p = "userland const char *"; + p = "userland char *"; break; case 2: p = "l_size_t"; @@ -5785,7 +5885,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland const char *"; break; case 1: - p = "userland const char *"; + p = "userland char *"; break; case 2: p = "l_size_t"; @@ -5801,7 +5901,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "l_int"; break; case 1: - p = "userland const char *"; + p = "userland char *"; break; case 2: p = "l_size_t"; @@ -6403,9 +6503,32 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_ioprio_set */ case 289: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "l_int"; + break; + case 2: + p = "l_int"; + break; + default: + break; + }; break; /* linux_ioprio_get */ case 290: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "l_int"; + break; + default: + break; + }; break; /* linux_inotify_init */ case 291: @@ -6467,7 +6590,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "l_int"; break; case 3: - p = "l_uint"; + p = "l_dev_t"; break; default: break; @@ -7873,6 +7996,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_rseq */ case 386: + switch (ndx) { + case 0: + p = "userland struct linux_rseq *"; + break; + case 1: + p = "uint32_t"; + break; + case 2: + p = "l_int"; + break; + case 3: + p = "uint32_t"; + break; + default: + break; + }; break; /* linux_semget */ case 393: @@ -8100,15 +8239,67 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_timer_gettime64 */ case 408: + switch (ndx) { + case 0: + p = "l_timer_t"; + break; + case 1: + p = "userland struct l_itimerspec64 *"; + break; + default: + break; + }; break; /* linux_timer_settime64 */ case 409: + switch (ndx) { + case 0: + p = "l_timer_t"; + break; + case 1: + p = "l_int"; + break; + case 2: + p = "userland const struct l_itimerspec64 *"; + break; + case 3: + p = "userland struct l_itimerspec64 *"; + break; + default: + break; + }; break; /* linux_timerfd_gettime64 */ case 410: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland struct l_itimerspec64 *"; + break; + default: + break; + }; break; /* linux_timerfd_settime64 */ case 411: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "l_int"; + break; + case 2: + p = "userland const struct l_itimerspec64 *"; + break; + case 3: + p = "userland struct l_itimerspec64 *"; + break; + default: + break; + }; break; /* linux_utimensat_time64 */ case 412: @@ -8164,7 +8355,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "uint32_t"; break; case 2: - p = "userland struct l_timespec *"; + p = "userland struct l_timespec64 *"; break; case 3: p = "userland l_sigset_t *"; @@ -8181,6 +8372,25 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_recvmmsg_time64 */ case 417: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland struct l_mmsghdr *"; + break; + case 2: + p = "l_uint"; + break; + case 3: + p = "l_uint"; + break; + case 4: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_mq_timedsend_time64 */ case 418: @@ -8190,6 +8400,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_semtimedop_time64 */ case 420: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland struct sembuf *"; + break; + case 2: + p = "l_size_t"; + break; + case 3: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_rt_sigtimedwait_time64 */ case 421: @@ -8237,6 +8463,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_sched_rr_get_interval_time64 */ case 423: + switch (ndx) { + case 0: + p = "l_pid_t"; + break; + case 1: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_pidfd_send_signal */ case 424: @@ -8302,6 +8538,19 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_close_range */ case 436: + switch (ndx) { + case 0: + p = "l_uint"; + break; + case 1: + p = "l_uint"; + break; + case 2: + p = "l_uint"; + break; + default: + break; + }; break; /* linux_openat2 */ case 437: @@ -8331,12 +8580,64 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) /* linux_process_madvise */ case 440: break; - /* linux_epoll_pwait2 */ + /* linux_epoll_pwait2_64 */ case 441: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland struct epoll_event *"; + break; + case 2: + p = "l_int"; + break; + case 3: + p = "userland struct l_timespec64 *"; + break; + case 4: + p = "userland l_sigset_t *"; + break; + case 5: + p = "l_size_t"; + break; + default: + break; + }; break; /* linux_mount_setattr */ case 442: break; + /* linux_quotactl_fd */ + case 443: + break; + /* linux_landlock_create_ruleset */ + case 444: + break; + /* linux_landlock_add_rule */ + case 445: + break; + /* linux_landlock_restrict_self */ + case 446: + break; + /* linux_memfd_secret */ + case 447: + break; + /* linux_process_mrelease */ + case 448: + break; + /* linux_futex_waitv */ + case 449: + break; + /* linux_set_mempolicy_home_node */ + case 450: + break; + /* linux_cachestat */ + case 451: + break; + /* linux_fchmodat2 */ + case 452: + break; default: break; }; @@ -8348,7 +8649,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { -#define nosys linux_nosys /* linux_exit */ case 1: if (ndx == 0 || ndx == 1) @@ -8361,7 +8661,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; - /* write */ + /* linux_write */ case 4: if (ndx == 0 || ndx == 1) p = "int"; @@ -9496,8 +9796,14 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 288: /* linux_ioprio_set */ case 289: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_ioprio_get */ case 290: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_inotify_init */ case 291: /* linux_inotify_add_watch */ @@ -9924,6 +10230,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 385: /* linux_rseq */ case 386: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_semget */ case 393: if (ndx == 0 || ndx == 1) @@ -9998,12 +10307,24 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_timer_gettime64 */ case 408: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_timer_settime64 */ case 409: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_timerfd_gettime64 */ case 410: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_timerfd_settime64 */ case 411: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_utimensat_time64 */ case 412: if (ndx == 0 || ndx == 1) @@ -10023,12 +10344,18 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 416: /* linux_recvmmsg_time64 */ case 417: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_mq_timedsend_time64 */ case 418: /* linux_mq_timedreceive_time64 */ case 419: /* linux_semtimedop_time64 */ case 420: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_rt_sigtimedwait_time64 */ case 421: if (ndx == 0 || ndx == 1) @@ -10041,6 +10368,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_sched_rr_get_interval_time64 */ case 423: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_pidfd_send_signal */ case 424: if (ndx == 0 || ndx == 1) @@ -10073,6 +10403,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_close_range */ case 436: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_openat2 */ case 437: /* linux_pidfd_getfd */ @@ -10084,10 +10417,33 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_process_madvise */ case 440: - /* linux_epoll_pwait2 */ + /* linux_epoll_pwait2_64 */ case 441: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_mount_setattr */ case 442: + /* linux_quotactl_fd */ + case 443: + /* linux_landlock_create_ruleset */ + case 444: + /* linux_landlock_add_rule */ + case 445: + /* linux_landlock_restrict_self */ + case 446: + /* linux_memfd_secret */ + case 447: + /* linux_process_mrelease */ + case 448: + /* linux_futex_waitv */ + case 449: + /* linux_set_mempolicy_home_node */ + case 450: + /* linux_cachestat */ + case 451: + /* linux_fchmodat2 */ + case 452: default: break; }; diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index b9d2d7aaf7cd..19b4af7661f0 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -32,11 +32,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "opt_compat.h" - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #ifndef COMPAT_FREEBSD32 #error "Unable to compile Linux-emulator due to missing COMPAT_FREEBSD32 option!" #endif @@ -44,44 +39,31 @@ __FBSDID("$FreeBSD$"); #define __ELF_WORD_SIZE 32 #include <sys/param.h> -#include <sys/systm.h> #include <sys/exec.h> -#include <sys/fcntl.h> #include <sys/imgact.h> #include <sys/imgact_elf.h> #include <sys/kernel.h> #include <sys/lock.h> -#include <sys/malloc.h> #include <sys/module.h> #include <sys/mutex.h> #include <sys/proc.h> -#include <sys/resourcevar.h> #include <sys/stddef.h> -#include <sys/signalvar.h> #include <sys/syscallsubr.h> #include <sys/sysctl.h> #include <sys/sysent.h> -#include <sys/sysproto.h> -#include <sys/vnode.h> -#include <sys/eventhandler.h> -#include <vm/vm.h> #include <vm/pmap.h> -#include <vm/vm_extern.h> +#include <vm/vm.h> #include <vm/vm_map.h> -#include <vm/vm_object.h> -#include <vm/vm_page.h> #include <vm/vm_param.h> -#include <machine/cpu.h> #include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/specialreg.h> #include <machine/trap.h> #include <x86/linux/linux_x86.h> #include <amd64/linux32/linux.h> #include <amd64/linux32/linux32_proto.h> +#include <compat/linux/linux_elf.h> #include <compat/linux/linux_emul.h> #include <compat/linux/linux_fork.h> #include <compat/linux/linux_ioctl.h> @@ -91,6 +73,8 @@ __FBSDID("$FreeBSD$"); #include <compat/linux/linux_util.h> #include <compat/linux/linux_vdso.h> +#include <x86/linux/linux_x86_sigframe.h> + MODULE_VERSION(linux, 1); #define LINUX32_MAXUSER ((1ul << 32) - PAGE_SIZE) @@ -111,11 +95,10 @@ extern char _binary_linux32_vdso_so_o_end; static vm_offset_t linux_vdso_base; extern struct sysent linux32_sysent[LINUX32_SYS_MAXSYSCALL]; +extern const char *linux32_syscallnames[]; SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); -static int linux_fixup_elf(uintptr_t *stack_base, - struct image_params *iparams); static int linux_copyout_strings(struct image_params *imgp, uintptr_t *stack_base); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); @@ -125,52 +108,12 @@ static void linux_exec_sysvec_init(void *param); static int linux_on_exec_vmspace(struct proc *p, struct image_params *imgp); static void linux32_fixlimit(struct rlimit *rl, int which); -static bool linux32_trans_osrel(const Elf_Note *note, int32_t *osrel); static void linux_vdso_install(const void *param); static void linux_vdso_deinstall(const void *param); static void linux_vdso_reloc(char *mapping, Elf_Addr offset); static void linux32_set_fork_retval(struct thread *td); static void linux32_set_syscall_retval(struct thread *td, int error); -#define LINUX_T_UNKNOWN 255 -static int _bsd_to_linux_trapcode[] = { - LINUX_T_UNKNOWN, /* 0 */ - 6, /* 1 T_PRIVINFLT */ - LINUX_T_UNKNOWN, /* 2 */ - 3, /* 3 T_BPTFLT */ - LINUX_T_UNKNOWN, /* 4 */ - LINUX_T_UNKNOWN, /* 5 */ - 16, /* 6 T_ARITHTRAP */ - 254, /* 7 T_ASTFLT */ - LINUX_T_UNKNOWN, /* 8 */ - 13, /* 9 T_PROTFLT */ - 1, /* 10 T_TRCTRAP */ - LINUX_T_UNKNOWN, /* 11 */ - 14, /* 12 T_PAGEFLT */ - LINUX_T_UNKNOWN, /* 13 */ - 17, /* 14 T_ALIGNFLT */ - LINUX_T_UNKNOWN, /* 15 */ - LINUX_T_UNKNOWN, /* 16 */ - LINUX_T_UNKNOWN, /* 17 */ - 0, /* 18 T_DIVIDE */ - 2, /* 19 T_NMI */ - 4, /* 20 T_OFLOW */ - 5, /* 21 T_BOUND */ - 7, /* 22 T_DNA */ - 8, /* 23 T_DOUBLEFLT */ - 9, /* 24 T_FPOPFLT */ - 10, /* 25 T_TSSFLT */ - 11, /* 26 T_SEGNPFLT */ - 12, /* 27 T_STKFLT */ - 18, /* 28 T_MCHK */ - 19, /* 29 T_XMMFLT */ - 15 /* 30 T_RESERVED */ -}; -#define bsd_to_linux_trapcode(code) \ - ((code)<nitems(_bsd_to_linux_trapcode)? \ - _bsd_to_linux_trapcode[(code)]: \ - LINUX_T_UNKNOWN) - struct linux32_ps_strings { u_int32_t ps_argvstr; /* first of 0 or more argument strings */ u_int ps_nargvstr; /* the number of argument strings */ @@ -181,102 +124,22 @@ struct linux32_ps_strings { sizeof(struct linux32_ps_strings)) LINUX_VDSO_SYM_INTPTR(__kernel_vsyscall); -LINUX_VDSO_SYM_INTPTR(__kernel_sigreturn); -LINUX_VDSO_SYM_INTPTR(__kernel_rt_sigreturn); +LINUX_VDSO_SYM_INTPTR(linux32_vdso_sigcode); +LINUX_VDSO_SYM_INTPTR(linux32_vdso_rt_sigcode); LINUX_VDSO_SYM_INTPTR(kern_timekeep_base); LINUX_VDSO_SYM_INTPTR(kern_tsc_selector); +LINUX_VDSO_SYM_INTPTR(kern_cpu_selector); LINUX_VDSO_SYM_CHAR(linux_platform); -/* - * If FreeBSD & Linux have a difference of opinion about what a trap - * means, deal with it here. - * - * MPSAFE - */ -static int -linux_translate_traps(int signal, int trap_code) -{ - if (signal != SIGBUS) - return (signal); - switch (trap_code) { - case T_PROTFLT: - case T_TSSFLT: - case T_DOUBLEFLT: - case T_PAGEFLT: - return (SIGSEGV); - default: - return (signal); - } -} - -static int -linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) -{ - Elf32_Auxargs *args; - Elf32_Auxinfo *argarray, *pos; - int error, issetugid; - - args = (Elf32_Auxargs *)imgp->auxargs; - argarray = pos = malloc(LINUX_AT_COUNT * sizeof(*pos), M_TEMP, - M_WAITOK | M_ZERO); - - issetugid = imgp->proc->p_flag & P_SUGID ? 1 : 0; - AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO, __kernel_vsyscall); - AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO_EHDR, linux_vdso_base); - AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature); - AUXARGS_ENTRY(pos, AT_PAGESZ, args->pagesz); - - /* - * Do not export AT_CLKTCK when emulating Linux kernel prior to 2.4.0, - * as it has appeared in the 2.4.0-rc7 first time. - * Being exported, AT_CLKTCK is returned by sysconf(_SC_CLK_TCK), - * glibc falls back to the hard-coded CLK_TCK value when aux entry - * is not present. - * Also see linux_times() implementation. - */ - if (linux_kernver(curthread) >= LINUX_KERNVER_2004000) - AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, stclohz); - AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); - AUXARGS_ENTRY(pos, AT_PHENT, args->phent); - AUXARGS_ENTRY(pos, AT_PHNUM, args->phnum); - AUXARGS_ENTRY(pos, AT_BASE, args->base); - AUXARGS_ENTRY(pos, AT_FLAGS, args->flags); - AUXARGS_ENTRY(pos, AT_ENTRY, args->entry); - AUXARGS_ENTRY(pos, AT_UID, imgp->proc->p_ucred->cr_ruid); - AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); - AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); - AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); - AUXARGS_ENTRY(pos, LINUX_AT_SECURE, issetugid); - AUXARGS_ENTRY(pos, LINUX_AT_RANDOM, PTROUT(imgp->canary)); - AUXARGS_ENTRY(pos, LINUX_AT_HWCAP2, 0); - if (imgp->execpathp != 0) - AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, PTROUT(imgp->execpathp)); - if (args->execfd != -1) - AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); - AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform)); - AUXARGS_ENTRY(pos, AT_NULL, 0); - - free(imgp->auxargs, M_TEMP); - imgp->auxargs = NULL; - KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs")); - - error = copyout(argarray, (void *)base, - sizeof(*argarray) * LINUX_AT_COUNT); - free(argarray, M_TEMP); - return (error); -} - -static int -linux_fixup_elf(uintptr_t *stack_base, struct image_params *imgp) +void +linux32_arch_copyout_auxargs(struct image_params *imgp, Elf_Auxinfo **pos) { - Elf32_Addr *base; - base = (Elf32_Addr *)*stack_base; - base--; - if (suword32(base, (uint32_t)imgp->args->argc) == -1) - return (EFAULT); - *stack_base = (uintptr_t)base; - return (0); + AUXARGS_ENTRY((*pos), LINUX_AT_SYSINFO, __kernel_vsyscall); + AUXARGS_ENTRY((*pos), LINUX_AT_SYSINFO_EHDR, linux_vdso_base); + AUXARGS_ENTRY((*pos), LINUX_AT_HWCAP, cpu_feature); + AUXARGS_ENTRY((*pos), LINUX_AT_HWCAP2, linux_x86_elf_hwcap2()); + AUXARGS_ENTRY((*pos), LINUX_AT_PLATFORM, PTROUT(linux_platform)); } static void @@ -291,7 +154,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) int sig; int code; - sig = ksi->ksi_signo; + sig = linux_translate_traps(ksi->ksi_signo, ksi->ksi_trapno); code = ksi->ksi_code; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; @@ -313,10 +176,9 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) bzero(&frame, sizeof(frame)); - frame.sf_handler = PTROUT(catcher); frame.sf_sig = sig; frame.sf_siginfo = PTROUT(&fp->sf_si); - frame.sf_ucontext = PTROUT(&fp->sf_sc); + frame.sf_ucontext = PTROUT(&fp->sf_uc); /* Fill in POSIX parts. */ siginfo_to_lsiginfo(&ksi->ksi_info, &frame.sf_si, sig); @@ -324,38 +186,35 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) /* * Build the signal context to be used by sigreturn and libgcc unwind. */ - frame.sf_sc.uc_flags = 0; /* XXX ??? */ - frame.sf_sc.uc_link = 0; /* XXX ??? */ - - frame.sf_sc.uc_stack.ss_sp = PTROUT(td->td_sigstk.ss_sp); - frame.sf_sc.uc_stack.ss_size = td->td_sigstk.ss_size; - frame.sf_sc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) + frame.sf_uc.uc_stack.ss_sp = PTROUT(td->td_sigstk.ss_sp); + frame.sf_uc.uc_stack.ss_size = td->td_sigstk.ss_size; + frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) ? ((oonstack) ? LINUX_SS_ONSTACK : 0) : LINUX_SS_DISABLE; PROC_UNLOCK(p); - bsd_to_linux_sigset(mask, &frame.sf_sc.uc_sigmask); - - frame.sf_sc.uc_mcontext.sc_mask = frame.sf_sc.uc_sigmask.__mask; - frame.sf_sc.uc_mcontext.sc_edi = regs->tf_rdi; - frame.sf_sc.uc_mcontext.sc_esi = regs->tf_rsi; - frame.sf_sc.uc_mcontext.sc_ebp = regs->tf_rbp; - frame.sf_sc.uc_mcontext.sc_ebx = regs->tf_rbx; - frame.sf_sc.uc_mcontext.sc_esp = regs->tf_rsp; - frame.sf_sc.uc_mcontext.sc_edx = regs->tf_rdx; - frame.sf_sc.uc_mcontext.sc_ecx = regs->tf_rcx; - frame.sf_sc.uc_mcontext.sc_eax = regs->tf_rax; - frame.sf_sc.uc_mcontext.sc_eip = regs->tf_rip; - frame.sf_sc.uc_mcontext.sc_cs = regs->tf_cs; - frame.sf_sc.uc_mcontext.sc_gs = regs->tf_gs; - frame.sf_sc.uc_mcontext.sc_fs = regs->tf_fs; - frame.sf_sc.uc_mcontext.sc_es = regs->tf_es; - frame.sf_sc.uc_mcontext.sc_ds = regs->tf_ds; - frame.sf_sc.uc_mcontext.sc_eflags = regs->tf_rflags; - frame.sf_sc.uc_mcontext.sc_esp_at_signal = regs->tf_rsp; - frame.sf_sc.uc_mcontext.sc_ss = regs->tf_ss; - frame.sf_sc.uc_mcontext.sc_err = regs->tf_err; - frame.sf_sc.uc_mcontext.sc_cr2 = (u_int32_t)(uintptr_t)ksi->ksi_addr; - frame.sf_sc.uc_mcontext.sc_trapno = bsd_to_linux_trapcode(code); + bsd_to_linux_sigset(mask, &frame.sf_uc.uc_sigmask); + + frame.sf_uc.uc_mcontext.sc_mask = frame.sf_uc.uc_sigmask.__mask; + frame.sf_uc.uc_mcontext.sc_edi = regs->tf_rdi; + frame.sf_uc.uc_mcontext.sc_esi = regs->tf_rsi; + frame.sf_uc.uc_mcontext.sc_ebp = regs->tf_rbp; + frame.sf_uc.uc_mcontext.sc_ebx = regs->tf_rbx; + frame.sf_uc.uc_mcontext.sc_esp = regs->tf_rsp; + frame.sf_uc.uc_mcontext.sc_edx = regs->tf_rdx; + frame.sf_uc.uc_mcontext.sc_ecx = regs->tf_rcx; + frame.sf_uc.uc_mcontext.sc_eax = regs->tf_rax; + frame.sf_uc.uc_mcontext.sc_eip = regs->tf_rip; + frame.sf_uc.uc_mcontext.sc_cs = regs->tf_cs; + frame.sf_uc.uc_mcontext.sc_gs = regs->tf_gs; + frame.sf_uc.uc_mcontext.sc_fs = regs->tf_fs; + frame.sf_uc.uc_mcontext.sc_es = regs->tf_es; + frame.sf_uc.uc_mcontext.sc_ds = regs->tf_ds; + frame.sf_uc.uc_mcontext.sc_eflags = regs->tf_rflags; + frame.sf_uc.uc_mcontext.sc_esp_at_signal = regs->tf_rsp; + frame.sf_uc.uc_mcontext.sc_ss = regs->tf_ss; + frame.sf_uc.uc_mcontext.sc_err = regs->tf_err; + frame.sf_uc.uc_mcontext.sc_cr2 = (u_int32_t)(uintptr_t)ksi->ksi_addr; + frame.sf_uc.uc_mcontext.sc_trapno = bsd_to_linux_trapcode(code); if (copyout(&frame, fp, sizeof(frame)) != 0) { /* @@ -368,7 +227,8 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) /* Build context to run handler in. */ regs->tf_rsp = PTROUT(fp); - regs->tf_rip = __kernel_rt_sigreturn; + regs->tf_rip = linux32_vdso_rt_sigcode; + regs->tf_rdi = PTROUT(catcher); regs->tf_rflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucode32sel; regs->tf_ss = _udatasel; @@ -404,7 +264,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) int oonstack; int sig, code; - sig = ksi->ksi_signo; + sig = linux_translate_traps(ksi->ksi_signo, ksi->ksi_trapno); code = ksi->ksi_code; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; @@ -433,9 +293,8 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) bzero(&frame, sizeof(frame)); - frame.sf_handler = PTROUT(catcher); frame.sf_sig = sig; - + frame.sf_sigmask = *mask; bsd_to_linux_sigset(mask, &lmask); /* Build the signal context to be used by sigreturn. */ @@ -461,8 +320,6 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) frame.sf_sc.sc_cr2 = (u_int32_t)(uintptr_t)ksi->ksi_addr; frame.sf_sc.sc_trapno = bsd_to_linux_trapcode(code); - frame.sf_extramask[0] = lmask.__mask; - if (copyout(&frame, fp, sizeof(frame)) != 0) { /* * Process has trashed its stack; give it an illegal @@ -474,7 +331,8 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) /* Build context to run handler in. */ regs->tf_rsp = PTROUT(fp); - regs->tf_rip = __kernel_sigreturn; + regs->tf_rip = linux32_vdso_sigcode; + regs->tf_rdi = PTROUT(catcher); regs->tf_rflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucode32sel; regs->tf_ss = _udatasel; @@ -503,8 +361,6 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args) { struct l_sigframe frame; struct trapframe *regs; - sigset_t bmask; - l_sigset_t lmask; int eflags; ksiginfo_t ksi; @@ -538,10 +394,7 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args) return(EINVAL); } - lmask.__mask = frame.sf_sc.sc_mask; - lmask.__mask = frame.sf_extramask[0]; - linux_to_bsd_sigset(&lmask, &bmask); - kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0); + kern_sigprocmask(td, SIG_SETMASK, &frame.sf_sigmask, NULL, 0); /* Restore signal context. */ regs->tf_rdi = frame.sf_sc.sc_edi; @@ -672,13 +525,13 @@ linux32_fetch_syscall_args(struct thread *td) sa->args[2] = frame->tf_rdx; sa->args[3] = frame->tf_rsi; sa->args[4] = frame->tf_rdi; - sa->args[5] = frame->tf_rbp; /* Unconfirmed */ + sa->args[5] = frame->tf_rbp; sa->code = frame->tf_rax; sa->original_code = sa->code; if (sa->code >= p->p_sysent->sv_size) /* nosys */ - sa->callp = &p->p_sysent->sv_table[p->p_sysent->sv_size - 1]; + sa->callp = &nosys_sysent; else sa->callp = &p->p_sysent->sv_table[sa->code]; @@ -771,16 +624,11 @@ linux_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) char canary[LINUX_AT_RANDOM_LEN]; size_t execpath_len; - /* Calculate string base and vector table pointers. */ - if (imgp->execpath != NULL && imgp->auxargs != NULL) - execpath_len = strlen(imgp->execpath) + 1; - else - execpath_len = 0; - - arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; + arginfo = (struct linux32_ps_strings *)PROC_PS_STRINGS(imgp->proc); destp = (uintptr_t)arginfo; - if (execpath_len != 0) { + if (imgp->execpath != NULL && imgp->auxargs != NULL) { + execpath_len = strlen(imgp->execpath) + 1; destp -= execpath_len; destp = rounddown2(destp, sizeof(uint32_t)); imgp->execpathp = (void *)destp; @@ -890,6 +738,9 @@ SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxssiz, CTLFLAG_RW, static u_long linux32_maxvmem = LINUX32_MAXVMEM; SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxvmem, CTLFLAG_RW, &linux32_maxvmem, 0, ""); +bool linux32_emulate_i386 = false; +SYSCTL_BOOL(_compat_linux32, OID_AUTO, emulate_i386, CTLFLAG_RWTUN, + &linux32_emulate_i386, 0, "Emulate the real i386"); static void linux32_fixlimit(struct rlimit *rl, int which) @@ -926,8 +777,7 @@ linux32_fixlimit(struct rlimit *rl, int which) struct sysentvec elf_linux_sysvec = { .sv_size = LINUX32_SYS_MAXSYSCALL, .sv_table = linux32_sysent, - .sv_transtrap = linux_translate_traps, - .sv_fixup = linux_fixup_elf, + .sv_fixup = elf32_freebsd_fixup, .sv_sendsig = linux_sendsig, .sv_sigcode = &_binary_linux32_vdso_so_o_start, .sv_szsigcode = &linux_szsigcode, @@ -936,14 +786,14 @@ struct sysentvec elf_linux_sysvec = { .sv_elf_core_osabi = ELFOSABI_NONE, .sv_elf_core_abi_vendor = LINUX_ABI_VENDOR, .sv_elf_core_prepare_notes = linux32_prepare_notes, - .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = LINUX32_MAXUSER, .sv_usrstack = LINUX32_USRSTACK, .sv_psstrings = LINUX32_PS_STRINGS, + .sv_psstringssz = sizeof(struct linux32_ps_strings), .sv_stackprot = VM_PROT_ALL, - .sv_copyout_auxargs = linux_copyout_auxargs, + .sv_copyout_auxargs = __linuxN(copyout_auxargs), .sv_copyout_strings = linux_copyout_strings, .sv_setregs = linux_exec_setregs, .sv_fixlimit = linux32_fixlimit, @@ -952,12 +802,14 @@ struct sysentvec elf_linux_sysvec = { SV_SIG_DISCIGN | SV_SIG_WAITNDQ | SV_TIMEKEEP, .sv_set_syscall_retval = linux32_set_syscall_retval, .sv_fetch_syscall_args = linux32_fetch_syscall_args, - .sv_syscallnames = NULL, + .sv_syscallnames = linux32_syscallnames, .sv_shared_page_base = LINUX32_SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = linux_schedtail, .sv_thread_detach = linux_thread_detach, .sv_trap = NULL, + .sv_hwcap = NULL, + .sv_hwcap2 = NULL, .sv_onexec = linux_on_exec_vmspace, .sv_onexit = linux_on_exit, .sv_ontdexit = linux_thread_dtor, @@ -973,7 +825,7 @@ linux_on_exec_vmspace(struct proc *p, struct image_params *imgp) error = linux_map_vdso(p, linux_vdso_obj, linux_vdso_base, LINUX32_VDSOPAGE_SIZE, imgp); if (error == 0) - linux_on_exec(p, imgp); + error = linux_on_exec(p, imgp); return (error); } @@ -994,13 +846,19 @@ linux_exec_sysvec_init(void *param) tkoff = kern_timekeep_base - linux_vdso_base; ktimekeep_base = (l_uintptr_t *)(linux_vdso_mapping + tkoff); - *ktimekeep_base = sv->sv_timekeep_base; + *ktimekeep_base = sv->sv_shared_page_base + sv->sv_timekeep_offset; tkoff = kern_tsc_selector - linux_vdso_base; ktsc_selector = (l_uintptr_t *)(linux_vdso_mapping + tkoff); *ktsc_selector = linux_vdso_tsc_selector_idx(); if (bootverbose) printf("Linux i386 vDSO tsc_selector: %u\n", *ktsc_selector); + + tkoff = kern_cpu_selector - linux_vdso_base; + ktsc_selector = (l_uintptr_t *)(linux_vdso_mapping + tkoff); + *ktsc_selector = linux_vdso_cpu_selector_idx(); + if (bootverbose) + printf("Linux i386 vDSO cpu_selector: %u\n", *ktsc_selector); } SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC + 1, SI_ORDER_ANY, linux_exec_sysvec_init, &elf_linux_sysvec); @@ -1093,46 +951,19 @@ linux_vdso_reloc(char *mapping, Elf_Addr offset) } } -static char GNU_ABI_VENDOR[] = "GNU"; -static int GNULINUX_ABI_DESC = 0; - -static bool -linux32_trans_osrel(const Elf_Note *note, int32_t *osrel) -{ - const Elf32_Word *desc; - uintptr_t p; - - p = (uintptr_t)(note + 1); - p += roundup2(note->n_namesz, sizeof(Elf32_Addr)); - - desc = (const Elf32_Word *)p; - if (desc[0] != GNULINUX_ABI_DESC) - return (false); - - /* - * For Linux we encode osrel using the Linux convention of - * (version << 16) | (major << 8) | (minor) - * See macro in linux_mib.h - */ - *osrel = LINUX_KERNVER(desc[1], desc[2], desc[3]); - - return (true); -} - static Elf_Brandnote linux32_brandnote = { .hdr.n_namesz = sizeof(GNU_ABI_VENDOR), .hdr.n_descsz = 16, /* XXX at least 16 */ .hdr.n_type = 1, .vendor = GNU_ABI_VENDOR, .flags = BN_TRANSLATE_OSREL, - .trans_osrel = linux32_trans_osrel + .trans_osrel = linux_trans_osrel }; static Elf32_Brandinfo linux_brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = linux_emul_path, .interp_path = "/lib/ld-linux.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -1144,7 +975,6 @@ static Elf32_Brandinfo linux_glibc2brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = linux_emul_path, .interp_path = "/lib/ld-linux.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -1156,7 +986,6 @@ static Elf32_Brandinfo linux_muslbrand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = linux_emul_path, .interp_path = "/lib/ld-musl-i386.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -1165,7 +994,7 @@ static Elf32_Brandinfo linux_muslbrand = { LINUX_BI_FUTEX_REQUEUE }; -Elf32_Brandinfo *linux_brandlist[] = { +static Elf32_Brandinfo *linux_brandlist[] = { &linux_brand, &linux_glibc2brand, &linux_muslbrand, diff --git a/sys/amd64/linux32/linux32_vdso.lds.s b/sys/amd64/linux32/linux32_vdso.lds.s index 0a392e6380b6..90fb3f0670a3 100644 --- a/sys/amd64/linux32/linux32_vdso.lds.s +++ b/sys/amd64/linux32/linux32_vdso.lds.s @@ -2,8 +2,6 @@ * Linker script for 32-bit vDSO. * Copied from Linux kernel arch/x86/vdso/vdso-layout.lds.S * and arch/x86/vdso/vdso32/vdso32.lds.S - * - * $FreeBSD$ */ SECTIONS @@ -58,6 +56,7 @@ VERSION __vdso_clock_gettime; __vdso_gettimeofday; __vdso_time; + __vdso_getcpu; __vdso_clock_getres; __vdso_clock_gettime64; }; @@ -75,6 +74,9 @@ VERSION linux_platform; kern_timekeep_base; kern_tsc_selector; + kern_cpu_selector; + linux32_vdso_sigcode; + linux32_vdso_rt_sigcode; local: *; }; } diff --git a/sys/amd64/linux32/linux32_vdso_gtod.c b/sys/amd64/linux32/linux32_vdso_gtod.c index 0caf787c9503..ec5851c45c28 100644 --- a/sys/amd64/linux32/linux32_vdso_gtod.c +++ b/sys/amd64/linux32/linux32_vdso_gtod.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2021 Dmitry Chagin <dchagin@FreeBSD.org> * @@ -25,10 +25,6 @@ * SUCH DAMAGE. */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include <sys/elf.h> #include <sys/errno.h> #include <sys/proc.h> @@ -38,19 +34,22 @@ __FBSDID("$FreeBSD$"); #undef _KERNEL #include <stdbool.h> -#include <machine/atomic.h> -#include <machine/stdarg.h> +#include <i386/include/atomic.h> +#include <i386/include/cpufunc.h> +#include <i386/include/stdarg.h> #include <amd64/linux32/linux.h> #include <amd64/linux32/linux32_syscall.h> #include <compat/linux/linux_errno.h> -#include <compat/linux/linux_timer.h> +#include <compat/linux/linux_time.h> /* The kernel fixup this at vDSO install */ uintptr_t *kern_timekeep_base = NULL; uint32_t kern_tsc_selector = 0; +uint32_t kern_cpu_selector = 0; #include <x86/linux/linux_vdso_gettc_x86.inc> +#include <x86/linux/linux_vdso_getcpu_x86.inc> static int write(int fd, const void *buf, size_t size) @@ -61,7 +60,7 @@ write(int fd, const void *buf, size_t size) ( "int $0x80" : "=a"(res) - : "a"(LINUX32_SYS_write), "b"(fd), "c"(buf), "d"(size) + : "a"(LINUX32_SYS_linux_write), "b"(fd), "c"(buf), "d"(size) : "cc", "memory" ); return (res); @@ -128,6 +127,21 @@ __vdso_clock_getres_fallback(clockid_t clock_id, struct l_timespec *ts) } static int +__vdso_getcpu_fallback(uint32_t *cpu, uint32_t *node, void *cache) +{ + int res; + + __asm__ __volatile__ + ( + "int $0x80" + : "=a"(res) + : "a"(LINUX32_SYS_linux_getcpu), "D"(cpu), "S"(node), "d"(cache) + : "cc", "memory" + ); + return (res); +} + +static int __vdso_time_fallback(long *tm) { int res; diff --git a/sys/amd64/linux32/syscalls.conf b/sys/amd64/linux32/syscalls.conf index 7d096b5a9c64..e1b92f011d21 100644 --- a/sys/amd64/linux32/syscalls.conf +++ b/sys/amd64/linux32/syscalls.conf @@ -1,11 +1,10 @@ -# $FreeBSD$ sysnames="linux32_syscalls.c" sysproto="linux32_proto.h" sysproto_h=_LINUX32_SYSPROTO_H_ syshdr="linux32_syscall.h" syssw="linux32_sysent.c" -sysmk="/dev/null" syscallprefix="LINUX32_SYS_" switchname="linux32_sysent" namesname="linux32_syscallnames" systrace="linux32_systrace_args.c" +compat_set="" diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 9d55fb1ade48..6b40a89db66d 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -1,6 +1,4 @@ - $FreeBSD$ -; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 ; System call name/number master file (or rather, slave, from LINUX). ; Processed to create linux32_sysent.c, linux32_proto.h and linux32_syscall.h. @@ -26,18 +24,17 @@ ; function prototype in sys/sysproto.h. Does add a ; definition to syscall.h besides adding a sysent. +; #include's, #defines's, etc. may be included, and are copied to the output +; files. However, #ifdef, etc will be copied, but any lines that don't start +; with # will not. Caveat Emptor. + #include <sys/param.h> #include <sys/sysent.h> #include <sys/sysproto.h> -#include <compat/linux/linux_sysproto.h> +#include <compat/freebsd32/freebsd32_util.h> #include <amd64/linux32/linux.h> #include <amd64/linux32/linux32_proto.h> -; Isn't pretty, but there seems to be no other way to trap nosys -#define nosys linux_nosys - -; #ifdef's, etc. may be included, and are copied to the output files. - 0 AUE_NULL UNIMPL setup 1 AUE_EXIT STD { void linux_exit( @@ -54,11 +51,11 @@ u_int nbyte ); } -4 AUE_NULL NOPROTO { - int write( +4 AUE_NULL STD { + int linux_write( int fd, char *buf, - u_int nbyte + l_size_t nbyte ); } 5 AUE_OPEN_RWTC STD { @@ -100,8 +97,8 @@ 11 AUE_EXECVE STD { int linux_execve( char *path, - uint32_t *argp, - uint32_t *envp + l_uintptr_t *argp, + l_uintptr_t *envp ); } 12 AUE_CHDIR STD { @@ -138,7 +135,7 @@ 18 AUE_STAT STD { int linux_stat( char *path, - struct linux_stat *up + struct l_old_stat *up ); } 19 AUE_LSEEK STD { @@ -450,7 +447,7 @@ 84 AUE_LSTAT STD { int linux_lstat( char *path, - struct linux_lstat *up + struct l_old_stat *up ); } 85 AUE_READLINK STD { @@ -767,14 +764,14 @@ 145 AUE_READV STD { int linux_readv( l_ulong fd, - struct l_iovec32 *iovp, + struct iovec32 *iovp, l_ulong iovcnt ); } 146 AUE_WRITEV STD { int linux_writev( l_ulong fd, - struct l_iovec32 *iovp, + struct iovec32 *iovp, l_ulong iovcnt ); } @@ -912,10 +909,10 @@ 172 AUE_PRCTL STD { int linux_prctl( l_int option, - l_int arg2, - l_int arg3, - l_int arg4, - l_int arg5 + l_uintptr_t arg2, + l_uintptr_t arg3, + l_uintptr_t arg4, + l_uintptr_t arg5 ); } 173 AUE_NULL STD { @@ -1019,7 +1016,7 @@ int linux_sendfile( l_int out, l_int in, - l_long *offset, + l_off_t *offset, l_size_t count ); } @@ -1220,7 +1217,7 @@ int linux_setxattr( const char *path, const char *name, - const char *value, + void *value, l_size_t size, l_int flags ); @@ -1229,7 +1226,7 @@ int linux_lsetxattr( const char *path, const char *name, - const char *value, + void *value, l_size_t size, l_int flags ); @@ -1238,7 +1235,7 @@ int linux_fsetxattr( l_int fd, const char *name, - const char *value, + void *value, l_size_t size, l_int flags ); @@ -1247,7 +1244,7 @@ int linux_getxattr( const char *path, const char *name, - char *value, + void *value, l_size_t size ); } @@ -1255,7 +1252,7 @@ int linux_lgetxattr( const char *path, const char *name, - char *value, + void *value, l_size_t size ); } @@ -1263,28 +1260,28 @@ int linux_fgetxattr( l_int fd, const char *name, - char *value, + void *value, l_size_t size ); } 232 AUE_NULL STD { int linux_listxattr( const char *path, - const char *list, + char *list, l_size_t size ); } 233 AUE_NULL STD { int linux_llistxattr( const char *path, - const char *list, + char *list, l_size_t size ); } 234 AUE_NULL STD { int linux_flistxattr( l_int fd, - const char *list, + char *list, l_size_t size ); } @@ -1575,11 +1572,18 @@ int linux_keyctl(void); } ; Linux 2.6.13: -289 AUE_NULL STD { - int linux_ioprio_set(void); +289 AUE_SETPRIORITY STD { + int linux_ioprio_set( + l_int which, + l_int who, + l_int ioprio + ); } -290 AUE_NULL STD { - int linux_ioprio_get(void); +290 AUE_GETPRIORITY STD { + int linux_ioprio_get( + l_int which, + l_int who + ); } 291 AUE_NULL STD { int linux_inotify_init(void); @@ -1614,7 +1618,7 @@ l_int dfd, const char *filename, l_int mode, - l_uint dev + l_dev_t dev ); } 298 AUE_FCHOWNAT STD { @@ -2265,8 +2269,14 @@ int linux_io_pgetevents(void); } 386 AUE_NULL STD { - int linux_rseq(void); + int linux_rseq( + struct linux_rseq *rseq, + uint32_t rseq_len, + l_int flags, + uint32_t sig + ); } +; Linux 5.1: 387-392 AUE_NULL UNIMPL nosys 393 AUE_NULL STD { int linux_semget( @@ -2339,7 +2349,6 @@ struct l_msqid_ds *buf ); } -; Linux 5.0: 403 AUE_NULL STD { int linux_clock_gettime64( clockid_t which, @@ -2370,16 +2379,32 @@ ); } 408 AUE_NULL STD { - int linux_timer_gettime64(void); + int linux_timer_gettime64( + l_timer_t timerid, + struct l_itimerspec64 *setting + ); } 409 AUE_NULL STD { - int linux_timer_settime64(void); + int linux_timer_settime64( + l_timer_t timerid, + l_int flags, + const struct l_itimerspec64 *new, + struct l_itimerspec64 *old + ); } 410 AUE_NULL STD { - int linux_timerfd_gettime64(void); + int linux_timerfd_gettime64( + l_int fd, + struct l_itimerspec64 *old_value + ); } 411 AUE_NULL STD { - int linux_timerfd_settime64(void); + int linux_timerfd_settime64( + l_int fd, + l_int flags, + const struct l_itimerspec64 *new_value, + struct l_itimerspec64 *old_value + ); } 412 AUE_NULL STD { int linux_utimensat_time64( @@ -2403,7 +2428,7 @@ int linux_ppoll_time64( struct pollfd *fds, uint32_t nfds, - struct l_timespec *tsp, + struct l_timespec64 *tsp, l_sigset_t *sset, l_size_t ssize ); @@ -2413,7 +2438,13 @@ int linux_io_pgetevents_time64(void); } 417 AUE_NULL STD { - int linux_recvmmsg_time64(void); + int linux_recvmmsg_time64( + l_int s, + struct l_mmsghdr *msg, + l_uint vlen, + l_uint flags, + struct l_timespec64 *timeout + ); } 418 AUE_NULL STD { int linux_mq_timedsend_time64(void); @@ -2422,7 +2453,12 @@ int linux_mq_timedreceive_time64(void); } 420 AUE_NULL STD { - int linux_semtimedop_time64(void); + int linux_semtimedop_time64( + l_int semid, + struct sembuf *tsops, + l_size_t nsops, + struct l_timespec64 *timeout + ); } 421 AUE_NULL STD { int linux_rt_sigtimedwait_time64( @@ -2442,8 +2478,11 @@ uint32_t val3 ); } -423 AUE_NULL STD { - int linux_sched_rr_get_interval_time64(void); +423 AUE_SCHED_RR_GET_INTERVAL STD { + int linux_sched_rr_get_interval_time64( + l_pid_t pid, + struct l_timespec64 *interval + ); } 424 AUE_NULL STD { int linux_pidfd_send_signal( @@ -2462,6 +2501,7 @@ 427 AUE_NULL STD { int linux_io_uring_register(void); } +; Linux 5.2: 428 AUE_NULL STD { int linux_open_tree(void); } @@ -2480,6 +2520,7 @@ 433 AUE_NULL STD { int linux_fspick(void); } +; Linux 5.3: 434 AUE_NULL STD { int linux_pidfd_open(void); } @@ -2489,15 +2530,22 @@ l_size_t usize ); } -436 AUE_NULL STD { - int linux_close_range(void); +; Linux 5.9: +436 AUE_CLOSERANGE STD { + int linux_close_range( + l_uint first, + l_uint last, + l_uint flags + ); } +; Linux 5.6: 437 AUE_NULL STD { int linux_openat2(void); } 438 AUE_NULL STD { int linux_pidfd_getfd(void); } +; Linux 5.8: 439 AUE_NULL STD { int linux_faccessat2( l_int dfd, @@ -2506,15 +2554,62 @@ l_int flags ); } +; Linux 5.10: 440 AUE_NULL STD { int linux_process_madvise(void); } +; Linux 5.11: 441 AUE_NULL STD { - int linux_epoll_pwait2(void); + int linux_epoll_pwait2_64( + l_int epfd, + struct epoll_event *events, + l_int maxevents, + struct l_timespec64 *timeout, + l_sigset_t *mask, + l_size_t sigsetsize + ); } +; Linux 5.12: 442 AUE_NULL STD { int linux_mount_setattr(void); } -; please, keep this line at the end. -443 AUE_NULL UNIMPL nosys -; vim: syntax=off +; Linux 5.14: +443 AUE_NULL STD { + int linux_quotactl_fd(void); + } +; Linux 5.13: +444 AUE_NULL STD { + int linux_landlock_create_ruleset(void); + } +445 AUE_NULL STD { + int linux_landlock_add_rule(void); + } +446 AUE_NULL STD { + int linux_landlock_restrict_self(void); + } +; Linux 5.14: +447 AUE_NULL STD { + int linux_memfd_secret(void); + } +; Linux 5.15: +448 AUE_NULL STD { + int linux_process_mrelease(void); + } +; Linux 5.16: +449 AUE_NULL STD { + int linux_futex_waitv(void); + } +; Linux 5.17: +450 AUE_NULL STD { + int linux_set_mempolicy_home_node(void); + } +; Linux 6.5: +451 AUE_NULL STD { + int linux_cachestat(void); + } +; Linux 6.6: +452 AUE_NULL STD { + int linux_fchmodat2(void); + } + + ; vim: syntax=off |