* [Qemu-devel] [PATCH v2] linux-user/signal.c: Fix several issues for target alpha
@ 2015-09-14 19:48 gang.chen.5i5j
0 siblings, 0 replies; only message in thread
From: gang.chen.5i5j @ 2015-09-14 19:48 UTC (permalink / raw)
To: riku.voipio, peter.maydell, rth; +Cc: qemu-devel, xili_gchen_5257, Chen Gang
From: Chen Gang <gang.chen.5i5j@gmail.com>
Remove useless variable err in setup_frame() and setup_rt_frame().
Add unlock_user_struct() for setup_rt_frame().
Do not call unlock_user_struct() when lock_user_struct() failed in
do_rt_sigreturn().
Remove white space of label badframe in do_sigreturn().
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
linux-user/signal.c | 41 ++++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 21 deletions(-)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 502efd9..e188931 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -5396,7 +5396,6 @@ static void setup_frame(int sig, struct target_sigaction *ka,
{
abi_ulong frame_addr, r26;
struct target_sigframe *frame;
- int err = 0;
frame_addr = get_sigframe(ka, env, sizeof(*frame));
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
@@ -5418,20 +5417,19 @@ static void setup_frame(int sig, struct target_sigaction *ka,
unlock_user_struct(frame, frame_addr, 1);
- if (err) {
- give_sigsegv:
- if (sig == TARGET_SIGSEGV) {
- ka->_sa_handler = TARGET_SIG_DFL;
- }
- force_sig(TARGET_SIGSEGV);
- }
-
env->ir[IR_RA] = r26;
env->ir[IR_PV] = env->pc = ka->_sa_handler;
env->ir[IR_A0] = sig;
env->ir[IR_A1] = 0;
env->ir[IR_A2] = frame_addr + offsetof(struct target_sigframe, sc);
env->ir[IR_SP] = frame_addr;
+ return;
+
+give_sigsegv:
+ if (sig == TARGET_SIGSEGV) {
+ ka->_sa_handler = TARGET_SIG_DFL;
+ }
+ force_sig(TARGET_SIGSEGV);
}
static void setup_rt_frame(int sig, struct target_sigaction *ka,
@@ -5440,7 +5438,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
{
abi_ulong frame_addr, r26;
struct target_rt_sigframe *frame;
- int i, err = 0;
+ int i;
frame_addr = get_sigframe(ka, env, sizeof(*frame));
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
@@ -5474,13 +5472,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
r26 = frame_addr;
}
- if (err) {
- give_sigsegv:
- if (sig == TARGET_SIGSEGV) {
- ka->_sa_handler = TARGET_SIG_DFL;
- }
- force_sig(TARGET_SIGSEGV);
- }
+ unlock_user_struct(frame, frame_addr, 1);
env->ir[IR_RA] = r26;
env->ir[IR_PV] = env->pc = ka->_sa_handler;
@@ -5488,6 +5480,13 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
env->ir[IR_A1] = frame_addr + offsetof(struct target_rt_sigframe, info);
env->ir[IR_A2] = frame_addr + offsetof(struct target_rt_sigframe, uc);
env->ir[IR_SP] = frame_addr;
+ return;
+
+give_sigsegv:
+ if (sig == TARGET_SIGSEGV) {
+ ka->_sa_handler = TARGET_SIG_DFL;
+ }
+ force_sig(TARGET_SIGSEGV);
}
long do_sigreturn(CPUAlphaState *env)
@@ -5511,7 +5510,7 @@ long do_sigreturn(CPUAlphaState *env)
unlock_user_struct(sc, sc_addr, 0);
return env->ir[IR_V0];
- badframe:
+badframe:
force_sig(TARGET_SIGSEGV);
}
@@ -5522,7 +5521,7 @@ long do_rt_sigreturn(CPUAlphaState *env)
sigset_t set;
if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {
- goto badframe;
+ goto err;
}
target_to_host_sigset(&set, &frame->uc.tuc_sigmask);
do_sigprocmask(SIG_SETMASK, &set, NULL);
@@ -5537,9 +5536,9 @@ long do_rt_sigreturn(CPUAlphaState *env)
unlock_user_struct(frame, frame_addr, 0);
return env->ir[IR_V0];
-
- badframe:
+badframe:
unlock_user_struct(frame, frame_addr, 0);
+err:
force_sig(TARGET_SIGSEGV);
}
--
1.9.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-09-14 19:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14 19:48 [Qemu-devel] [PATCH v2] linux-user/signal.c: Fix several issues for target alpha gang.chen.5i5j
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).