diff options
Diffstat (limited to 'sys/amd64/linux32')
-rw-r--r-- | sys/amd64/linux32/Makefile | 1 | ||||
-rw-r--r-- | sys/amd64/linux32/linux.h | 92 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_dummy_machdep.c | 9 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_genassym.c | 5 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_locore.asm | 9 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_machdep.c | 185 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_proto.h | 113 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_support.S (renamed from sys/amd64/linux32/linux32_support.s) | 4 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_syscall.h | 15 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_syscalls.c | 15 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_sysent.c | 23 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_systrace_args.c | 246 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_sysvec.c | 149 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_vdso.lds.s | 2 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_vdso_gtod.c | 10 | ||||
-rw-r--r-- | sys/amd64/linux32/syscalls.conf | 2 | ||||
-rw-r--r-- | sys/amd64/linux32/syscalls.master | 129 |
17 files changed, 491 insertions, 518 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 7909c9c2081b..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; @@ -103,9 +104,9 @@ typedef struct { /* * 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 { @@ -180,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; @@ -199,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; @@ -218,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; @@ -304,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 { @@ -427,32 +392,9 @@ struct l_user_desc { (((desc)->b >> LINUX_ENTRY_B_USEABLE) & 1) #ifdef _KERNEL -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); int linux_copyout_rusage(struct rusage *ru, void *uaddr); #endif /* _KERNEL */ -/* 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; -}; - /* This corresponds to 'struct user_regs_struct32' in Linux. */ struct linux_pt_regset32 { l_uint ebx; @@ -479,6 +421,10 @@ 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 */ diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index f3bd8717524a..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); diff --git a/sys/amd64/linux32/linux32_genassym.c b/sys/amd64/linux32/linux32_genassym.c index 4a87b5a423bc..df3f8ef7b471 100644 --- a/sys/amd64/linux32/linux32_genassym.c +++ b/sys/amd64/linux32/linux32_genassym.c @@ -1,10 +1,7 @@ -#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> diff --git a/sys/amd64/linux32/linux32_locore.asm b/sys/amd64/linux32/linux32_locore.asm index f4cdc5fc1559..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 */ @@ -24,7 +23,11 @@ ENTRY(linux32_vdso_sigcode) .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 @@ -56,7 +59,11 @@ ENTRY(linux32_vdso_rt_sigcode) .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 diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 9746c4bd7cdf..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,123 +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; - - if (!LUSECONVPATH(td)) { - error = freebsd32_exec_copyin_args(&eargs, args->path, UIO_USERSPACE, - args->argp, args->envp); - } else { - LCONVPATHEXIST(args->path, &path); - error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE, - args->argp, args->envp); - LFREEPATH(path); - } - 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); } @@ -445,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; @@ -469,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; @@ -638,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. * @@ -755,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 219f0f09f8c9..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> @@ -34,13 +33,17 @@ 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 { 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 *)]; char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; @@ -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)]; @@ -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 *)]; @@ -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 { @@ -613,7 +616,7 @@ 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 { @@ -713,55 +716,55 @@ struct linux_gettid_args { 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 { @@ -968,10 +971,13 @@ struct linux_keyctl_args { syscallarg_t dummy; }; struct linux_ioprio_set_args { - syscallarg_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 { - syscallarg_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 { syscallarg_t dummy; @@ -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)]; @@ -1669,7 +1675,9 @@ struct linux_clone3_args { char usize_l_[PADL_(l_size_t)]; l_size_t usize; char usize_r_[PADR_(l_size_t)]; }; struct linux_close_range_args { - syscallarg_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 { syscallarg_t dummy; @@ -1697,9 +1705,39 @@ struct linux_epoll_pwait2_64_args { struct linux_mount_setattr_args { syscallarg_t dummy; }; -#define nosys linux_nosys +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; +}; 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 *); @@ -2061,8 +2099,19 @@ int linux_faccessat2(struct thread *, struct linux_faccessat2_args *); int linux_process_madvise(struct thread *, struct linux_process_madvise_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 *); +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 @@ -2277,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 @@ -2417,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_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 c92cb48e2d1a..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 */ diff --git a/sys/amd64/linux32/linux32_syscall.h b/sys/amd64/linux32/linux32_syscall.h index c8b497710470..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 @@ -404,4 +403,14 @@ #define LINUX32_SYS_linux_process_madvise 440 #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 f44eef1f589a..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 */ @@ -450,5 +448,14 @@ const char *linux32_syscallnames[] = { "linux_process_madvise", /* 440 = linux_process_madvise */ "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 54a1c50807f2..024bca613c11 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -2,13 +2,12 @@ * 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> @@ -16,12 +15,11 @@ /* 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 */ @@ -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 = 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 fee5cf2c2e2d..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; @@ -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; } @@ -3210,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 */ @@ -3255,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; @@ -3265,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) { @@ -3295,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: @@ -3305,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; @@ -3396,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; @@ -3477,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; @@ -4083,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; @@ -4727,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"; @@ -4743,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"; @@ -5277,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"; @@ -5691,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"; @@ -5713,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"; @@ -5735,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"; @@ -5757,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"; @@ -5776,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"; @@ -5795,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"; @@ -5811,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"; @@ -5827,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"; @@ -5843,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"; @@ -6445,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: @@ -6509,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; @@ -8457,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: @@ -8514,6 +8608,36 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) /* 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; }; @@ -8525,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) @@ -8538,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"; @@ -9673,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 */ @@ -10274,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 */ @@ -10292,6 +10424,26 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) 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 e9162f04d3f7..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> @@ -113,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); @@ -127,7 +108,6 @@ 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); @@ -151,74 +131,15 @@ LINUX_VDSO_SYM_INTPTR(kern_tsc_selector); LINUX_VDSO_SYM_INTPTR(kern_cpu_selector); LINUX_VDSO_SYM_CHAR(linux_platform); -static int -linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) +void +linux32_arch_copyout_auxargs(struct image_params *imgp, Elf_Auxinfo **pos) { - 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) -{ - 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 @@ -604,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]; @@ -856,7 +777,7 @@ linux32_fixlimit(struct rlimit *rl, int which) struct sysentvec elf_linux_sysvec = { .sv_size = LINUX32_SYS_MAXSYSCALL, .sv_table = linux32_sysent, - .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, @@ -865,7 +786,6 @@ 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, @@ -873,7 +793,7 @@ struct sysentvec elf_linux_sysvec = { .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, @@ -882,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, @@ -903,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); } @@ -924,7 +846,7 @@ 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); @@ -1029,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, @@ -1080,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, @@ -1092,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, @@ -1101,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 6b47a120847e..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 diff --git a/sys/amd64/linux32/linux32_vdso_gtod.c b/sys/amd64/linux32/linux32_vdso_gtod.c index 4f9892af3fa5..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> @@ -45,7 +41,7 @@ __FBSDID("$FreeBSD$"); #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; @@ -64,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); diff --git a/sys/amd64/linux32/syscalls.conf b/sys/amd64/linux32/syscalls.conf index ce9a437e82e3..e1b92f011d21 100644 --- a/sys/amd64/linux32/syscalls.conf +++ b/sys/amd64/linux32/syscalls.conf @@ -1,10 +1,8 @@ -# $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" diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 935f44d5b34f..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 ); } @@ -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 { @@ -2272,6 +2276,7 @@ uint32_t sig ); } +; Linux 5.1: 387-392 AUE_NULL UNIMPL nosys 393 AUE_NULL STD { int linux_semget( @@ -2344,7 +2349,6 @@ struct l_msqid_ds *buf ); } -; Linux 5.0: 403 AUE_NULL STD { int linux_clock_gettime64( clockid_t which, @@ -2497,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); } @@ -2515,6 +2520,7 @@ 433 AUE_NULL STD { int linux_fspick(void); } +; Linux 5.3: 434 AUE_NULL STD { int linux_pidfd_open(void); } @@ -2524,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, @@ -2541,9 +2554,11 @@ 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_64( l_int epfd, @@ -2554,9 +2569,47 @@ 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 |