From: kettenis Date: Thu, 15 Apr 2021 07:28:37 +0000 (+0000) Subject: The SSR1 register can have bits set that don't match to bits in the MSR X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2207c4325726fdc5c4bcd0011af0fdf7d3dab137;p=openbsd The SSR1 register can have bits set that don't match to bits in the MSR register. We would set the sc_ps member of struct sigcontext to SSR1 when entering a signal handler, and compare it to PSL_USER in sigreturn(2) to make sure that the user code didn't set any bits it shouldn't set. If non-MSR bits are set that comparison would fail and sigreturn(2) would fail. Fix this by initializing sc_ps to PSL_USER instead of taking its value from SSR1. On OpenBSD we always run processes with the same MSR value. ok deraadt@ --- diff --git a/sys/arch/powerpc64/powerpc64/machdep.c b/sys/arch/powerpc64/powerpc64/machdep.c index cb1b89db3c8..b8467449ee6 100644 --- a/sys/arch/powerpc64/powerpc64/machdep.c +++ b/sys/arch/powerpc64/powerpc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.67 2021/01/09 13:14:02 kettenis Exp $ */ +/* $OpenBSD: machdep.c,v 1.68 2021/04/15 07:28:37 kettenis Exp $ */ /* * Copyright (c) 2020 Mark Kettenis @@ -933,7 +933,7 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) frame.sf_sc.sc_xer = tf->xer; frame.sf_sc.sc_ctr = tf->ctr; frame.sf_sc.sc_pc = tf->srr0; - frame.sf_sc.sc_ps = tf->srr1; + frame.sf_sc.sc_ps = PSL_USER; frame.sf_sc.sc_vrsave = tf->vrsave; /* Copy the saved FPU state into the frame if necessary. */