Date: Tue, 17 Nov 2020 12:33:12 +0000 (UTC) From: "Alfredo Dal'Ava Junior" <alfredo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367760 - head/sys/powerpc/powerpc Message-ID: <202011171233.0AHCXCkR042938@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alfredo Date: Tue Nov 17 12:33:12 2020 New Revision: 367760 URL: https://svnweb.freebsd.org/changeset/base/367760 Log: [POWERPC] fix signal race condition r367416 should have called save_fpu() before kern_sigprocmask to avoid race condition Thanks jhibbits and bdragon for pointing it out Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D27241 Modified: head/sys/powerpc/powerpc/exec_machdep.c Modified: head/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/exec_machdep.c Tue Nov 17 12:04:29 2020 (r367759) +++ head/sys/powerpc/powerpc/exec_machdep.c Tue Nov 17 12:33:12 2020 (r367760) @@ -334,8 +334,6 @@ sys_sigreturn(struct thread *td, struct sigreturn_args if (error != 0) return (error); - kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); - /* * Save FPU state if needed. User may have changed it on * signal handler @@ -343,6 +341,8 @@ sys_sigreturn(struct thread *td, struct sigreturn_args if (uc.uc_mcontext.mc_srr1 & PSL_FP) save_fpu(td); + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); + CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); @@ -836,8 +836,6 @@ freebsd32_sigreturn(struct thread *td, struct freebsd3 if (error != 0) return (error); - kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); - /* * Save FPU state if needed. User may have changed it on * signal handler @@ -845,6 +843,7 @@ freebsd32_sigreturn(struct thread *td, struct freebsd3 if (uc.uc_mcontext.mc_srr1 & PSL_FP) save_fpu(td); + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011171233.0AHCXCkR042938>