[PATCH v2 2/5] x86: ia32_signal: introduce COPY_SEG_STRICT

From: Hiroshi Shimamoto
Date: Mon Nov 17 2008 - 18:47:19 EST


From: Hiroshi Shimamoto <h-shimamoto@xxxxxxxxxxxxx>

Impact: cleanup

Introduce COPY_SEG_STRICT for ia32_restore_sigcontext().

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@xxxxxxxxxxxxx>
---
arch/x86/ia32/ia32_signal.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index a28790a..f74178e 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -201,6 +201,12 @@ struct rt_sigframe
err |= __get_user(regs->x, &sc->x); \
}

+#define COPY_SEG_STRICT(seg) { \
+ unsigned short tmp; \
+ err |= __get_user(tmp, &sc->seg); \
+ regs->seg = tmp | 3; \
+}
+
#define RELOAD_SEG(seg,mask) \
{ unsigned int cur; \
unsigned short pre; \
@@ -246,10 +252,8 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
COPY(dx); COPY(cx); COPY(ip);
/* Don't touch extended registers */

- err |= __get_user(regs->cs, &sc->cs);
- regs->cs |= 3;
- err |= __get_user(regs->ss, &sc->ss);
- regs->ss |= 3;
+ COPY_SEG_STRICT(cs);
+ COPY_SEG_STRICT(ss);

err |= __get_user(tmpflags, &sc->flags);
regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
--
1.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/