NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/56471: ntpd dies at startup on macppc/current, sshd randomly dies



> On Oct 30, 2021, at 5:48 AM, Jason Thorpe <thorpej%me.com@localhost> wrote:

> I.e. does no checking, and simply forces it to what it should be (modulo accepting the user-settable bits, which in the OEA case are basically FP modes and single-stepping).

Martin — can you please try this patch?  I’d like to see the debug output.

? pr-56471-test-patch.txt
Index: compat_16_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/powerpc/compat_16_machdep.c,v
retrieving revision 1.21
diff -u -p -r1.21 compat_16_machdep.c
--- compat_16_machdep.c	27 Oct 2021 04:15:00 -0000	1.21
+++ compat_16_machdep.c	30 Oct 2021 13:13:30 -0000
@@ -204,8 +204,11 @@ compat_16_sys___sigreturn14(struct lwp *
 	/*
 	 * Make sure SRR1 hasn't been maliciously tampered with.
 	 */
-	if (!PSL_USEROK_P(sc.sc_frame.srr1))
-		return (EINVAL);
+	if (!PSL_USEROK_P(utf->srr1)) {
+		printf("%s: XXX SRR1 = 0x%lx\n",
+		    (u_long)sc.sc_frame.srr1);
+		/* return (EINVAL); */
+	}
 
 	/* Restore register context. */
 	memcpy(tf->tf_fixreg, utf->fixreg, sizeof(tf->tf_fixreg));
@@ -214,7 +217,7 @@ compat_16_sys___sigreturn14(struct lwp *
 	tf->tf_xer  = utf->xer;
 	tf->tf_ctr  = utf->ctr;
 	tf->tf_srr0 = utf->srr0;
-	tf->tf_srr1 = utf->srr1;
+	tf->tf_srr1 = (utf->srr1 & PSL_USERMOD) | PSL_USERSET;
 
 #ifdef PPC_HAVE_FPU
 	struct pcb * const pcb = lwp_getpcb(l);

-- thorpej



Home | Main Index | Thread Index | Old Index