From 2e79a216329f62a78dbbc72256e782353e220968 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Thu, 16 Sep 2021 16:48:27 +0300 Subject: amd64: consistently use uprintf() to report weird situations in sigreturn Reviewed by: jhb Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/exec_machdep.c | 5 ++--- sys/amd64/linux/linux_sysvec.c | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c index 168c24cbb65b..d605f080871a 100644 --- a/sys/amd64/amd64/exec_machdep.c +++ b/sys/amd64/amd64/exec_machdep.c @@ -197,9 +197,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) (xfpusave != NULL && copyout(xfpusave, (void *)sf.sf_uc.uc_mcontext.mc_xfpustate, xfpusave_len) != 0)) { -#ifdef DEBUG - printf("process %ld has trashed its stack\n", (long)p->p_pid); -#endif + uprintf("pid %d comm %s has trashed its stack, killing\n", + p->p_pid, p->p_comm); PROC_LOCK(p); sigexit(td, SIGILL); } diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index d6f2ec2ab832..b7aedff23536 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -556,7 +556,8 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * one less debugger trap, so allowing it is fairly harmless. */ if (!EFL_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) { - printf("linux_rt_sigreturn: rflags = 0x%lx\n", rflags); + uprintf("pid %d comm %s linux mangled rflags %#lx\n", + p->p_pid, p->p_comm, rflags); return (EINVAL); } @@ -566,7 +567,8 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * other selectors, invalid %eip's and invalid %esp's. */ if (!CS_SECURE(context->sc_cs)) { - printf("linux_rt_sigreturn: cs = 0x%x\n", context->sc_cs); + uprintf("pid %d comm %s linux mangled cs %#x\n", + p->p_pid, p->p_comm, context->sc_cs); ksiginfo_init_trap(&ksi); ksi.ksi_signo = SIGBUS; ksi.ksi_code = BUS_OBJERR; -- cgit v1.2.3