aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlfredo Dal'Ava Junior <alfredo@FreeBSD.org>2020-11-17 12:33:12 +0000
committerAlfredo Dal'Ava Junior <alfredo@FreeBSD.org>2020-11-17 12:33:12 +0000
commit23f001f742d1cee649bde91ec8a787dc343ad1f8 (patch)
treebec962ab16e36a449cccfe84c8756ff9eb8bee1f /sys
parentdda1987fe5dbf418b55195990896b0ef0a5b8e4a (diff)
downloadsrc-23f001f742d1cee649bde91ec8a787dc343ad1f8.tar.gz
src-23f001f742d1cee649bde91ec8a787dc343ad1f8.zip
[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
Notes
Notes: svn path=/head/; revision=367760
Diffstat (limited to 'sys')
-rw-r--r--sys/powerpc/powerpc/exec_machdep.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c
index 2a2fffbdd6ef..807a06b783c0 100644
--- a/sys/powerpc/powerpc/exec_machdep.c
+++ b/sys/powerpc/powerpc/exec_machdep.c
@@ -334,8 +334,6 @@ sys_sigreturn(struct thread *td, struct sigreturn_args *uap)
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 *uap)
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 freebsd32_sigreturn_args *uap)
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 freebsd32_sigreturn_args *uap)
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]);