Date: Mon, 24 Aug 2020 17:06:35 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364712 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux modules/linux modules/linux64 modules/linux_common Message-ID: <202008241706.07OH6ZUq099611@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Mon Aug 24 17:06:34 2020 New Revision: 364712 URL: https://svnweb.freebsd.org/changeset/base/364712 Log: MFC r347538 by dchagin: Linuxulator depends on a fundamental kernel settings such as SMP. Many of them listed in opt_global.h which is not generated while building modules outside of a kernel and such modules never match real cofigured kernel. So, we should prevent our users from building obviously defective modules. Therefore, remove the root cause of the building of modules outside of a kernel - the possibility of building modules with DEBUG or KTR flags. And remove all of DEBUG printfs as it is incomplete and in threaded programms not informative, also a half of system call does not have DEBUG printf. For debuging Linux programms we have dtrace, ktr and ktrace ability. PR: 222861 Modified: stable/12/sys/amd64/linux/linux.h stable/12/sys/amd64/linux/linux_sysvec.c stable/12/sys/amd64/linux32/linux.h stable/12/sys/amd64/linux32/linux32_machdep.c stable/12/sys/amd64/linux32/linux32_sysvec.c stable/12/sys/arm64/linux/linux.h stable/12/sys/arm64/linux/linux_sysvec.c stable/12/sys/compat/linux/linux_file.c stable/12/sys/compat/linux/linux_fork.c stable/12/sys/compat/linux/linux_getcwd.c stable/12/sys/compat/linux/linux_ioctl.c stable/12/sys/compat/linux/linux_misc.c stable/12/sys/compat/linux/linux_misc.h stable/12/sys/compat/linux/linux_signal.c stable/12/sys/compat/linux/linux_stats.c stable/12/sys/i386/linux/linux.h stable/12/sys/i386/linux/linux_machdep.c stable/12/sys/i386/linux/linux_sysvec.c stable/12/sys/modules/linux/Makefile stable/12/sys/modules/linux64/Makefile stable/12/sys/modules/linux_common/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux.h ============================================================================== --- stable/12/sys/amd64/linux/linux.h Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/amd64/linux/linux.h Mon Aug 24 17:06:34 2020 (r364712) @@ -39,15 +39,6 @@ #define LINUX_LEGACY_SYSCALLS -/* - * debugging support - */ -extern u_char linux_debug_map[]; -#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name) -#define ARGS(nm, fmt) "linux(%ld/%ld): "#nm"("fmt")\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid -#define LMSG(fmt) "linux(%ld/%ld): "fmt"\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid #define LINUX_DTRACE linuxulator /* Modified: stable/12/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux/linux_sysvec.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/amd64/linux/linux_sysvec.c Mon Aug 24 17:06:34 2020 (r364712) @@ -85,20 +85,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux64, 1); -#if defined(DEBUG) -SYSCTL_PROC(_compat_linux, OID_AUTO, debug, - CTLTYPE_STRING | CTLFLAG_RW, - 0, 0, linux_sysctl_debug, "A", - "Linux 64 debugging control"); -#endif - -/* - * Allow the sendsig functions to use the ldebug() facility even though they - * are not syscalls themselves. Map them to syscall 0. This is slightly less - * bogus than using ldebug(sigreturn). - */ -#define LINUX_SYS_linux_rt_sendsig 0 - const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; @@ -650,9 +636,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse /* Copy the sigframe out to the user's stack. */ if (copyout(&sf, sfp, sizeof(*sfp)) != 0) { -#ifdef DEBUG - printf("process %ld has trashed its stack\n", (long)p->p_pid); -#endif PROC_LOCK(p); sigexit(td, SIGILL); } Modified: stable/12/sys/amd64/linux32/linux.h ============================================================================== --- stable/12/sys/amd64/linux32/linux.h Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/amd64/linux32/linux.h Mon Aug 24 17:06:34 2020 (r364712) @@ -42,15 +42,6 @@ #define LINUX_LEGACY_SYSCALLS -/* - * debugging support - */ -extern u_char linux_debug_map[]; -#define ldebug(name) isclr(linux_debug_map, LINUX32_SYS_linux_ ## name) -#define ARGS(nm, fmt) "linux(%ld/%ld): "#nm"("fmt")\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid -#define LMSG(fmt) "linux(%ld/%ld): "fmt"\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid #define LINUX_DTRACE linuxulator32 #define LINUX32_MAXUSER ((1ul << 32) - PAGE_SIZE) Modified: stable/12/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_machdep.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/amd64/linux32/linux32_machdep.c Mon Aug 24 17:06:34 2020 (r364712) @@ -133,11 +133,6 @@ linux_execve(struct thread *td, struct linux_execve_ar LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(execve)) - printf(ARGS(execve, "%s"), path); -#endif - error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE, args->argp, args->envp); free(path, M_TEMP); @@ -382,11 +377,6 @@ linux_old_select(struct thread *td, struct linux_old_s struct linux_select_args newsel; int error; -#ifdef DEBUG - if (ldebug(old_select)) - printf(ARGS(old_select, "%p"), args->ptr); -#endif - error = copyin(args->ptr, &linux_args, sizeof(linux_args)); if (error) return (error); @@ -410,29 +400,19 @@ linux_set_cloned_tls(struct thread *td, void *desc) error = copyin(desc, &info, sizeof(struct l_user_desc)); if (error) { - printf(LMSG("copyin failed!")); + linux_msg(td, "set_cloned_tls copyin info failed!"); } else { + /* We might copy out the entry_number as GUGS32_SEL. */ info.entry_number = GUGS32_SEL; error = copyout(&info, desc, sizeof(struct l_user_desc)); if (error) - printf(LMSG("copyout failed!")); + linux_msg(td, "set_cloned_tls copyout info failed!"); a[0] = LINUX_LDT_entry_a(&info); a[1] = LINUX_LDT_entry_b(&info); memcpy(&sd, &a, sizeof(a)); -#ifdef DEBUG - if (ldebug(clone)) - printf("Segment created in clone with " - "CLONE_SETTLS: lobase: %x, hibase: %x, " - "lolimit: %x, hilimit: %x, type: %i, " - "dpl: %i, p: %i, xx: %i, long: %i, " - "def32: %i, gran: %i\n", sd.sd_lobase, - sd.sd_hibase, sd.sd_lolimit, sd.sd_hilimit, - sd.sd_type, sd.sd_dpl, sd.sd_p, sd.sd_xx, - sd.sd_long, sd.sd_def32, sd.sd_gran); -#endif pcb = td->td_pcb; pcb->pcb_gsbase = (register_t)info.base_addr; td->td_frame->tf_gs = GSEL(GUGS32_SEL, SEL_UPL); @@ -461,13 +441,6 @@ int linux_mmap2(struct thread *td, struct linux_mmap2_args *args) { -#ifdef DEBUG - if (ldebug(mmap2)) - printf(ARGS(mmap2, "0x%08x, %d, %d, 0x%08x, %d, %d"), - args->addr, args->len, args->prot, - args->flags, args->fd, args->pgoff); -#endif - return (linux_mmap_common(td, PTROUT(args->addr), args->len, args->prot, args->flags, args->fd, (uint64_t)(uint32_t)args->pgoff * PAGE_SIZE)); @@ -483,13 +456,6 @@ linux_mmap(struct thread *td, struct linux_mmap_args * if (error) return (error); -#ifdef DEBUG - if (ldebug(mmap)) - printf(ARGS(mmap, "0x%08x, %d, %d, 0x%08x, %d, %d"), - linux_args.addr, linux_args.len, linux_args.prot, - linux_args.flags, linux_args.fd, linux_args.pgoff); -#endif - return (linux_mmap_common(td, linux_args.addr, linux_args.len, linux_args.prot, linux_args.flags, linux_args.fd, (uint32_t)linux_args.pgoff)); @@ -526,12 +492,6 @@ linux_sigaction(struct thread *td, struct linux_sigact l_sigaction_t act, oact; int error; -#ifdef DEBUG - if (ldebug(sigaction)) - printf(ARGS(sigaction, "%d, %p, %p"), - args->sig, (void *)args->nsa, (void *)args->osa); -#endif - if (args->nsa != NULL) { error = copyin(args->nsa, &osa, sizeof(l_osigaction_t)); if (error) @@ -568,11 +528,6 @@ linux_sigsuspend(struct thread *td, struct linux_sigsu sigset_t sigmask; l_sigset_t mask; -#ifdef DEBUG - if (ldebug(sigsuspend)) - printf(ARGS(sigsuspend, "%08lx"), (unsigned long)args->mask); -#endif - LINUX_SIGEMPTYSET(mask); mask.__mask = args->mask; linux_to_bsd_sigset(&mask, &sigmask); @@ -586,12 +541,6 @@ linux_rt_sigsuspend(struct thread *td, struct linux_rt sigset_t sigmask; int error; -#ifdef DEBUG - if (ldebug(rt_sigsuspend)) - printf(ARGS(rt_sigsuspend, "%p, %d"), - (void *)uap->newset, uap->sigsetsize); -#endif - if (uap->sigsetsize != sizeof(l_sigset_t)) return (EINVAL); @@ -609,11 +558,6 @@ linux_pause(struct thread *td, struct linux_pause_args struct proc *p = td->td_proc; sigset_t sigmask; -#ifdef DEBUG - if (ldebug(pause)) - printf(ARGS(pause, "")); -#endif - PROC_LOCK(p); sigmask = td->td_sigmask; PROC_UNLOCK(p); @@ -627,11 +571,6 @@ linux_sigaltstack(struct thread *td, struct linux_siga l_stack_t lss; int error; -#ifdef DEBUG - if (ldebug(sigaltstack)) - printf(ARGS(sigaltstack, "%p, %p"), uap->uss, uap->uoss); -#endif - if (uap->uss != NULL) { error = copyin(uap->uss, &lss, sizeof(l_stack_t)); if (error) @@ -730,15 +669,6 @@ linux_set_thread_area(struct thread *td, if (error) return (error); -#ifdef DEBUG - if (ldebug(set_thread_area)) - printf(ARGS(set_thread_area, "%i, %x, %x, %i, %i, %i, " - "%i, %i, %i"), info.entry_number, info.base_addr, - info.limit, info.seg_32bit, info.contents, - info.read_exec_only, info.limit_in_pages, - info.seg_not_present, info.useable); -#endif - /* * Semantics of Linux version: every thread in the system has array * of three TLS descriptors. 1st is GLIBC TLS, 2nd is WINE, 3rd unknown. @@ -792,25 +722,6 @@ linux_set_thread_area(struct thread *td, } memcpy(&sd, &a, sizeof(a)); -#ifdef DEBUG - if (ldebug(set_thread_area)) - printf("Segment created in set_thread_area: " - "lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, " - "type: %i, dpl: %i, p: %i, xx: %i, long: %i, " - "def32: %i, gran: %i\n", - sd.sd_lobase, - sd.sd_hibase, - sd.sd_lolimit, - sd.sd_hilimit, - sd.sd_type, - sd.sd_dpl, - sd.sd_p, - sd.sd_xx, - sd.sd_long, - sd.sd_def32, - sd.sd_gran); -#endif - pcb = td->td_pcb; pcb->pcb_gsbase = (register_t)info.base_addr; set_pcb_flags(pcb, PCB_32BIT); Modified: stable/12/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_sysvec.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/amd64/linux32/linux32_sysvec.c Mon Aug 24 17:06:34 2020 (r364712) @@ -90,14 +90,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux, 1); -/* - * Allow the sendsig functions to use the ldebug() facility even though they - * are not syscalls themselves. Map them to syscall 0. This is slightly less - * bogus than using ldebug(sigreturn). - */ -#define LINUX32_SYS_linux_rt_sendsig 0 -#define LINUX32_SYS_linux_sendsig 0 - const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; @@ -285,11 +277,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse regs = td->td_frame; oonstack = sigonstack(regs->tf_rsp); -#ifdef DEBUG - if (ldebug(rt_sendsig)) - printf(ARGS(rt_sendsig, "%p, %d, %p, %u"), - catcher, sig, (void*)mask, code); -#endif /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) && !oonstack && SIGISMEMBER(psp->ps_sigonstack, sig)) { @@ -348,23 +335,11 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse 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); -#ifdef DEBUG - if (ldebug(rt_sendsig)) - printf(LMSG("rt_sendsig flags: 0x%x, sp: %p, ss: 0x%lx, mask: 0x%x"), - frame.sf_sc.uc_stack.ss_flags, td->td_sigstk.ss_sp, - td->td_sigstk.ss_size, frame.sf_sc.uc_mcontext.sc_mask); -#endif - if (copyout(&frame, fp, sizeof(frame)) != 0) { /* * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ -#ifdef DEBUG - if (ldebug(rt_sendsig)) - printf(LMSG("rt_sendsig: bad stack %p, oonstack=%x"), - fp, oonstack); -#endif PROC_LOCK(p); sigexit(td, SIGILL); } @@ -422,12 +397,6 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t regs = td->td_frame; oonstack = sigonstack(regs->tf_rsp); -#ifdef DEBUG - if (ldebug(sendsig)) - printf(ARGS(sendsig, "%p, %d, %p, %u"), - catcher, sig, (void*)mask, code); -#endif - /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) && !oonstack && SIGISMEMBER(psp->ps_sigonstack, sig)) { @@ -520,10 +489,6 @@ linux_sigreturn(struct thread *td, struct linux_sigret regs = td->td_frame; -#ifdef DEBUG - if (ldebug(sigreturn)) - printf(ARGS(sigreturn, "%p"), (void *)args->sfp); -#endif /* * The trampoline code hands us the sigframe. * It is unsafe to keep track of it ourselves, in the event that a @@ -605,10 +570,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_ regs = td->td_frame; -#ifdef DEBUG - if (ldebug(rt_sigreturn)) - printf(ARGS(rt_sigreturn, "%p"), (void *)args->ucp); -#endif /* * The trampoline code hands us the ucontext. * It is unsafe to keep track of it ourselves, in the event that a @@ -673,11 +634,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_ ss.ss_size = lss->ss_size; ss.ss_flags = linux_to_bsd_sigaltstack(lss->ss_flags); -#ifdef DEBUG - if (ldebug(rt_sigreturn)) - printf(LMSG("rt_sigret flags: 0x%x, sp: %p, ss: 0x%lx, mask: 0x%x"), - ss.ss_flags, ss.ss_sp, ss.ss_size, context->sc_mask); -#endif (void)kern_sigaltstack(td, &ss, NULL); return (EJUSTRETURN); @@ -867,11 +823,6 @@ SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxssiz, CTLFL static u_long linux32_maxvmem = LINUX32_MAXVMEM; SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxvmem, CTLFLAG_RW, &linux32_maxvmem, 0, ""); - -#if defined(DEBUG) -SYSCTL_PROC(_compat_linux32, OID_AUTO, debug, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, - linux_sysctl_debug, "A", "Linux debugging control"); -#endif static void linux32_fixlimit(struct rlimit *rl, int which) Modified: stable/12/sys/arm64/linux/linux.h ============================================================================== --- stable/12/sys/arm64/linux/linux.h Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/arm64/linux/linux.h Mon Aug 24 17:06:34 2020 (r364712) @@ -36,14 +36,6 @@ #include <compat/linux/linux.h> #include <arm64/linux/linux_syscall.h> -/* Debugging support */ -#define DEBUG -extern u_char linux_debug_map[]; -#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name) -#define ARGS(nm, fmt) "linux(%ld/%ld): "#nm"("fmt")\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid -#define LMSG(fmt) "linux(%ld/%ld): "fmt"\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid #define LINUX_DTRACE linuxulator /* Provide a separate set of types for the Linux types */ Modified: stable/12/sys/arm64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/arm64/linux/linux_sysvec.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/arm64/linux/linux_sysvec.c Mon Aug 24 17:06:34 2020 (r364712) @@ -59,11 +59,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux64elf, 1); -#if defined(DEBUG) -SYSCTL_PROC(_compat_linux, OID_AUTO, debug, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, - linux_sysctl_debug, "A", "64-bit Linux debugging control"); -#endif - const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; Modified: stable/12/sys/compat/linux/linux_file.c ============================================================================== --- stable/12/sys/compat/linux/linux_file.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/compat/linux/linux_file.c Mon Aug 24 17:06:34 2020 (r364712) @@ -76,10 +76,7 @@ linux_creat(struct thread *td, struct linux_creat_args int error; LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(creat)) - printf(ARGS(creat, "%s, %d"), path, args->mode); -#endif + error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE, O_WRONLY | O_CREAT | O_TRUNC, args->mode); LFREEPATH(path); @@ -170,14 +167,6 @@ linux_common_open(struct thread *td, int dirfd, char * } done: -#ifdef DEBUG -#ifdef LINUX_LEGACY_SYSCALLS - if (ldebug(open)) -#else - if (ldebug(openat)) -#endif - printf(LMSG("open returns error %d"), error); -#endif LFREEPATH(path); return (error); } @@ -193,11 +182,7 @@ linux_openat(struct thread *td, struct linux_openat_ar LCONVPATH_AT(td, args->filename, &path, 1, dfd); else LCONVPATH_AT(td, args->filename, &path, 0, dfd); -#ifdef DEBUG - if (ldebug(openat)) - printf(ARGS(openat, "%i, %s, 0x%x, 0x%x"), args->dfd, - path, args->flags, args->mode); -#endif + return (linux_common_open(td, dfd, path, args->flags, args->mode)); } @@ -211,11 +196,7 @@ linux_open(struct thread *td, struct linux_open_args * LCONVPATHCREAT(td, args->path, &path); else LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(open)) - printf(ARGS(open, "%s, 0x%x, 0x%x"), - path, args->flags, args->mode); -#endif + return (linux_common_open(td, AT_FDCWD, path, args->flags, args->mode)); } #endif @@ -224,11 +205,6 @@ int linux_lseek(struct thread *td, struct linux_lseek_args *args) { -#ifdef DEBUG - if (ldebug(lseek)) - printf(ARGS(lseek, "%d, %ld, %d"), - args->fdes, (long)args->off, args->whence); -#endif return (kern_lseek(td, args->fdes, args->off, args->whence)); } @@ -239,11 +215,6 @@ linux_llseek(struct thread *td, struct linux_llseek_ar int error; off_t off; -#ifdef DEBUG - if (ldebug(llseek)) - printf(ARGS(llseek, "%d, %d:%d, %d"), - args->fd, args->ohigh, args->olow, args->whence); -#endif off = (args->olow) | (((off_t) args->ohigh) << 32); error = kern_lseek(td, args->fd, off, args->whence); @@ -332,10 +303,6 @@ linux_getdents(struct thread *td, struct linux_getdent int buflen, error; size_t retval; -#ifdef DEBUG - if (ldebug(getdents)) - printf(ARGS(getdents, "%d, *, %d"), args->fd, args->count); -#endif buflen = min(args->count, MAXBSIZE); buf = malloc(buflen, M_TEMP, M_WAITOK); @@ -413,10 +380,6 @@ linux_getdents64(struct thread *td, struct linux_getde int buflen, error; size_t retval; -#ifdef DEBUG - if (ldebug(getdents64)) - uprintf(ARGS(getdents64, "%d, *, %d"), args->fd, args->count); -#endif buflen = min(args->count, MAXBSIZE); buf = malloc(buflen, M_TEMP, M_WAITOK); @@ -488,10 +451,6 @@ linux_readdir(struct thread *td, struct linux_readdir_ struct l_dirent *linux_dirent; int buflen, error; -#ifdef DEBUG - if (ldebug(readdir)) - printf(ARGS(readdir, "%d, *"), args->fd); -#endif buflen = LINUX_RECLEN(LINUX_NAME_MAX); buf = malloc(buflen, M_TEMP, M_WAITOK); @@ -544,10 +503,6 @@ linux_access(struct thread *td, struct linux_access_ar LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(access)) - printf(ARGS(access, "%s, %d"), path, args->amode); -#endif error = kern_accessat(td, AT_FDCWD, path, UIO_SYSSPACE, 0, args->amode); LFREEPATH(path); @@ -569,11 +524,6 @@ linux_faccessat(struct thread *td, struct linux_facces dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHEXIST_AT(td, args->filename, &path, dfd); -#ifdef DEBUG - if (ldebug(faccessat)) - printf(ARGS(access, "%s, %d"), path, args->amode); -#endif - error = kern_accessat(td, dfd, path, UIO_SYSSPACE, 0, args->amode); LFREEPATH(path); @@ -590,11 +540,6 @@ linux_unlink(struct thread *td, struct linux_unlink_ar LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(unlink)) - printf(ARGS(unlink, "%s"), path); -#endif - error = kern_unlinkat(td, AT_FDCWD, path, UIO_SYSSPACE, 0); if (error == EPERM) { /* Introduce POSIX noncompliant behaviour of Linux */ @@ -622,11 +567,6 @@ linux_unlinkat(struct thread *td, struct linux_unlinka dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHEXIST_AT(td, args->pathname, &path, dfd); -#ifdef DEBUG - if (ldebug(unlinkat)) - printf(ARGS(unlinkat, "%s"), path); -#endif - if (args->flag & LINUX_AT_REMOVEDIR) error = kern_rmdirat(td, dfd, path, UIO_SYSSPACE); else @@ -648,10 +588,6 @@ linux_chdir(struct thread *td, struct linux_chdir_args LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(chdir)) - printf(ARGS(chdir, "%s"), path); -#endif error = kern_chdir(td, path, UIO_SYSSPACE); LFREEPATH(path); return (error); @@ -666,10 +602,6 @@ linux_chmod(struct thread *td, struct linux_chmod_args LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(chmod)) - printf(ARGS(chmod, "%s, %d"), path, args->mode); -#endif error = kern_fchmodat(td, AT_FDCWD, path, UIO_SYSSPACE, args->mode, 0); LFREEPATH(path); @@ -686,11 +618,6 @@ linux_fchmodat(struct thread *td, struct linux_fchmoda dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHEXIST_AT(td, args->filename, &path, dfd); -#ifdef DEBUG - if (ldebug(fchmodat)) - printf(ARGS(fchmodat, "%s, %d"), path, args->mode); -#endif - error = kern_fchmodat(td, dfd, path, UIO_SYSSPACE, args->mode, 0); LFREEPATH(path); return (error); @@ -705,10 +632,6 @@ linux_mkdir(struct thread *td, struct linux_mkdir_args LCONVPATHCREAT(td, args->path, &path); -#ifdef DEBUG - if (ldebug(mkdir)) - printf(ARGS(mkdir, "%s, %d"), path, args->mode); -#endif error = kern_mkdirat(td, AT_FDCWD, path, UIO_SYSSPACE, args->mode); LFREEPATH(path); return (error); @@ -724,10 +647,6 @@ linux_mkdirat(struct thread *td, struct linux_mkdirat_ dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHCREAT_AT(td, args->pathname, &path, dfd); -#ifdef DEBUG - if (ldebug(mkdirat)) - printf(ARGS(mkdirat, "%s, %d"), path, args->mode); -#endif error = kern_mkdirat(td, dfd, path, UIO_SYSSPACE, args->mode); LFREEPATH(path); return (error); @@ -742,10 +661,6 @@ linux_rmdir(struct thread *td, struct linux_rmdir_args LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(rmdir)) - printf(ARGS(rmdir, "%s"), path); -#endif error = kern_rmdirat(td, AT_FDCWD, path, UIO_SYSSPACE); LFREEPATH(path); return (error); @@ -765,10 +680,6 @@ linux_rename(struct thread *td, struct linux_rename_ar return (error); } -#ifdef DEBUG - if (ldebug(rename)) - printf(ARGS(rename, "%s, %s"), from, to); -#endif error = kern_renameat(td, AT_FDCWD, from, AT_FDCWD, to, UIO_SYSSPACE); LFREEPATH(from); LFREEPATH(to); @@ -812,10 +723,6 @@ linux_renameat2(struct thread *td, struct linux_rename return (error); } -#ifdef DEBUG - if (ldebug(renameat)) - printf(ARGS(renameat, "%s, %s"), from, to); -#endif error = kern_renameat(td, olddfd, from, newdfd, to, UIO_SYSSPACE); LFREEPATH(from); LFREEPATH(to); @@ -837,10 +744,6 @@ linux_symlink(struct thread *td, struct linux_symlink_ return (error); } -#ifdef DEBUG - if (ldebug(symlink)) - printf(ARGS(symlink, "%s, %s"), path, to); -#endif error = kern_symlinkat(td, path, AT_FDCWD, to, UIO_SYSSPACE); LFREEPATH(path); LFREEPATH(to); @@ -863,11 +766,6 @@ linux_symlinkat(struct thread *td, struct linux_symlin return (error); } -#ifdef DEBUG - if (ldebug(symlinkat)) - printf(ARGS(symlinkat, "%s, %s"), path, to); -#endif - error = kern_symlinkat(td, path, dfd, to, UIO_SYSSPACE); LFREEPATH(path); LFREEPATH(to); @@ -883,11 +781,6 @@ linux_readlink(struct thread *td, struct linux_readlin LCONVPATHEXIST(td, args->name, &name); -#ifdef DEBUG - if (ldebug(readlink)) - printf(ARGS(readlink, "%s, %p, %d"), name, (void *)args->buf, - args->count); -#endif error = kern_readlinkat(td, AT_FDCWD, name, UIO_SYSSPACE, args->buf, UIO_USERSPACE, args->count); LFREEPATH(name); @@ -904,12 +797,6 @@ linux_readlinkat(struct thread *td, struct linux_readl dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHEXIST_AT(td, args->path, &name, dfd); -#ifdef DEBUG - if (ldebug(readlinkat)) - printf(ARGS(readlinkat, "%s, %p, %d"), name, (void *)args->buf, - args->bufsiz); -#endif - error = kern_readlinkat(td, dfd, name, UIO_SYSSPACE, args->buf, UIO_USERSPACE, args->bufsiz); LFREEPATH(name); @@ -923,11 +810,6 @@ linux_truncate(struct thread *td, struct linux_truncat int error; LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(truncate)) - printf(ARGS(truncate, "%s, %ld"), path, (long)args->length); -#endif - error = kern_truncate(td, path, UIO_SYSSPACE, args->length); LFREEPATH(path); return (error); @@ -949,11 +831,6 @@ linux_truncate64(struct thread *td, struct linux_trunc LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(truncate64)) - printf(ARGS(truncate64, "%s, %jd"), path, length); -#endif - error = kern_truncate(td, path, UIO_SYSSPACE, length); LFREEPATH(path); return (error); @@ -998,10 +875,6 @@ linux_link(struct thread *td, struct linux_link_args * return (error); } -#ifdef DEBUG - if (ldebug(link)) - printf(ARGS(link, "%s, %s"), path, to); -#endif error = kern_linkat(td, AT_FDCWD, AT_FDCWD, path, to, UIO_SYSSPACE, FOLLOW); LFREEPATH(path); @@ -1029,12 +902,6 @@ linux_linkat(struct thread *td, struct linux_linkat_ar return (error); } -#ifdef DEBUG - if (ldebug(linkat)) - printf(ARGS(linkat, "%i, %s, %i, %s, %i"), args->olddfd, path, - args->newdfd, to, args->flag); -#endif - follow = (args->flag & LINUX_AT_SYMLINK_FOLLOW) == 0 ? NOFOLLOW : FOLLOW; error = kern_linkat(td, olddfd, newdfd, path, to, UIO_SYSSPACE, follow); @@ -1189,12 +1056,6 @@ linux_mount(struct thread *td, struct linux_mount_args if (error != 0) goto out; -#ifdef DEBUG - if (ldebug(mount)) - printf(ARGS(mount, "%s, %s, %s"), - fstypename, mntfromname, mntonname); -#endif - if (strcmp(fstypename, "ext2") == 0) { strcpy(fstypename, "ext2fs"); } else if (strcmp(fstypename, "proc") == 0) { @@ -1503,11 +1364,6 @@ int linux_fcntl(struct thread *td, struct linux_fcntl_args *args) { -#ifdef DEBUG - if (ldebug(fcntl)) - printf(ARGS(fcntl, "%d, %08x, *"), args->fd, args->cmd); -#endif - return (fcntl_common(td, args)); } @@ -1520,11 +1376,6 @@ linux_fcntl64(struct thread *td, struct linux_fcntl64_ struct linux_fcntl_args fcntl_args; int error; -#ifdef DEBUG - if (ldebug(fcntl64)) - printf(ARGS(fcntl64, "%d, %08x, *"), args->fd, args->cmd); -#endif - switch (args->cmd) { case LINUX_F_GETLK64: error = copyin((void *)args->arg, &linux_flock, @@ -1574,10 +1425,6 @@ linux_chown(struct thread *td, struct linux_chown_args LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(chown)) - printf(ARGS(chown, "%s, %d, %d"), path, args->uid, args->gid); -#endif error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, args->uid, args->gid, 0); LFREEPATH(path); @@ -1597,11 +1444,6 @@ linux_fchownat(struct thread *td, struct linux_fchowna dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHEXIST_AT(td, args->filename, &path, dfd); -#ifdef DEBUG - if (ldebug(fchownat)) - printf(ARGS(fchownat, "%s, %d, %d"), path, args->uid, args->gid); -#endif - flag = (args->flag & LINUX_AT_SYMLINK_NOFOLLOW) == 0 ? 0 : AT_SYMLINK_NOFOLLOW; error = kern_fchownat(td, dfd, path, UIO_SYSSPACE, args->uid, args->gid, @@ -1619,10 +1461,6 @@ linux_lchown(struct thread *td, struct linux_lchown_ar LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(lchown)) - printf(ARGS(lchown, "%s, %d, %d"), path, args->uid, args->gid); -#endif error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, args->uid, args->gid, AT_SYMLINK_NOFOLLOW); LFREEPATH(path); @@ -1698,11 +1536,6 @@ linux_pipe(struct thread *td, struct linux_pipe_args * int fildes[2]; int error; -#ifdef DEBUG - if (ldebug(pipe)) - printf(ARGS(pipe, "*")); -#endif - error = kern_pipe(td, fildes, 0, NULL, NULL); if (error != 0) return (error); @@ -1722,11 +1555,6 @@ linux_pipe2(struct thread *td, struct linux_pipe2_args { int fildes[2]; int error, flags; - -#ifdef DEBUG - if (ldebug(pipe2)) - printf(ARGS(pipe2, "*, %d"), args->flags); -#endif if ((args->flags & ~(LINUX_O_NONBLOCK | LINUX_O_CLOEXEC)) != 0) return (EINVAL); Modified: stable/12/sys/compat/linux/linux_fork.c ============================================================================== --- stable/12/sys/compat/linux/linux_fork.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/compat/linux/linux_fork.c Mon Aug 24 17:06:34 2020 (r364712) @@ -74,11 +74,6 @@ linux_fork(struct thread *td, struct linux_fork_args * struct proc *p2; struct thread *td2; -#ifdef DEBUG - if (ldebug(fork)) - printf(ARGS(fork, "")); -#endif - bzero(&fr, sizeof(fr)); fr.fr_flags = RFFDG | RFPROC | RFSTOPPED; fr.fr_procp = &p2; @@ -110,11 +105,6 @@ linux_vfork(struct thread *td, struct linux_vfork_args struct proc *p2; struct thread *td2; -#ifdef DEBUG - if (ldebug(vfork)) - printf(ARGS(vfork, "")); -#endif - bzero(&fr, sizeof(fr)); fr.fr_flags = RFFDG | RFPROC | RFMEM | RFPPWAIT | RFSTOPPED; fr.fr_procp = &p2; @@ -149,14 +139,6 @@ linux_clone_proc(struct thread *td, struct linux_clone int exit_signal; struct linux_emuldata *em; -#ifdef DEBUG - if (ldebug(clone)) { - printf(ARGS(clone, "flags %x, stack %p, parent tid: %p, " - "child tid: %p"), (unsigned)args->flags, - args->stack, args->parent_tidptr, args->child_tidptr); - } -#endif - exit_signal = args->flags & 0x000000ff; if (LINUX_SIG_VALID(exit_signal)) { exit_signal = linux_to_bsd_signal(exit_signal); @@ -212,7 +194,7 @@ linux_clone_proc(struct thread *td, struct linux_clone error = copyout(&p2->p_pid, args->parent_tidptr, sizeof(p2->p_pid)); if (error) - printf(LMSG("copyout failed!")); + linux_msg(td, "copyout p_pid failed!"); } PROC_LOCK(p2); @@ -240,13 +222,6 @@ linux_clone_proc(struct thread *td, struct linux_clone sx_xunlock(&proctree_lock); } -#ifdef DEBUG - if (ldebug(clone)) - printf(LMSG("clone: successful rfork to %d, " - "stack %p sig = %d"), (int)p2->p_pid, args->stack, - exit_signal); -#endif - /* * Make this runnable after we are finished with it. */ @@ -268,14 +243,6 @@ linux_clone_thread(struct thread *td, struct linux_clo struct proc *p; int error; -#ifdef DEBUG - if (ldebug(clone)) { - printf(ARGS(clone, "thread: flags %x, stack %p, parent tid: %p, " - "child tid: %p"), (unsigned)args->flags, - args->stack, args->parent_tidptr, args->child_tidptr); - } -#endif - LINUX_CTR4(clone_thread, "thread(%d) flags %x ptid %p ctid %p", td->td_tid, (unsigned)args->flags, args->parent_tidptr, args->child_tidptr); @@ -360,12 +327,6 @@ linux_clone_thread(struct thread *td, struct linux_clo tidhash_add(newtd); -#ifdef DEBUG - if (ldebug(clone)) - printf(ARGS(clone, "successful clone to %d, stack %p"), - (int)newtd->td_tid, args->stack); -#endif - LINUX_CTR2(clone_thread, "thread(%d) successful clone to %d", td->td_tid, newtd->td_tid); @@ -373,7 +334,7 @@ linux_clone_thread(struct thread *td, struct linux_clo error = copyout(&newtd->td_tid, args->parent_tidptr, sizeof(newtd->td_tid)); if (error) - printf(LMSG("clone_thread: copyout failed!")); + linux_msg(td, "clone_thread: copyout td_tid failed!"); } /* Modified: stable/12/sys/compat/linux/linux_getcwd.c ============================================================================== --- stable/12/sys/compat/linux/linux_getcwd.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/compat/linux/linux_getcwd.c Mon Aug 24 17:06:34 2020 (r364712) @@ -65,11 +65,6 @@ linux_getcwd(struct thread *td, struct linux_getcwd_ar char *path; int error, lenused; -#ifdef DEBUG - if (ldebug(getcwd)) - printf(ARGS(getcwd, "%p, %ld"), args->buf, (long)args->bufsize); -#endif - /* * Linux returns ERANGE instead of EINVAL. */ Modified: stable/12/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/12/sys/compat/linux/linux_ioctl.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/compat/linux/linux_ioctl.c Mon Aug 24 17:06:34 2020 (r364712) @@ -241,12 +241,7 @@ linux_ioctl_hdio(struct thread *td, struct linux_ioctl */ bytespercyl = (off_t) sectorsize * fwheads * fwsectors; fwcylinders = mediasize / bytespercyl; -#if defined(DEBUG) - linux_msg(td, "HDIO_GET_GEO: mediasize %jd, c/h/s %d/%d/%d, " - "bpc %jd", - (intmax_t)mediasize, fwcylinders, fwheads, fwsectors, - (intmax_t)bytespercyl); -#endif + if ((args->cmd & 0xffff) == LINUX_HDIO_GET_GEO) { struct linux_hd_geometry hdg; @@ -438,19 +433,6 @@ bsd_to_linux_termios(struct termios *bios, struct linu { int i; -#ifdef DEBUG - if (ldebug(ioctl)) { - printf("LINUX: BSD termios structure (input):\n"); - printf("i=%08x o=%08x c=%08x l=%08x ispeed=%d ospeed=%d\n", - bios->c_iflag, bios->c_oflag, bios->c_cflag, bios->c_lflag, - bios->c_ispeed, bios->c_ospeed); - printf("c_cc "); - for (i=0; i<NCCS; i++) - printf("%02x ", bios->c_cc[i]); - printf("\n"); - } -#endif - lios->c_iflag = 0; if (bios->c_iflag & IGNBRK) lios->c_iflag |= LINUX_IGNBRK; @@ -561,19 +543,6 @@ bsd_to_linux_termios(struct termios *bios, struct linu lios->c_cc[i] = LINUX_POSIX_VDISABLE; } lios->c_line = 0; - -#ifdef DEBUG - if (ldebug(ioctl)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008241706.07OH6ZUq099611>