linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@kernel.org>
Cc: Elvira Khabirova <lineprinter0@gmail.com>,
	X86 ML <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86/signal: Cleanup get_nr_restart_syscall
Date: Sat, 19 Dec 2015 02:37:36 +0300	[thread overview]
Message-ID: <20151218233736.GA28013@altlinux.org> (raw)
In-Reply-To: <CALCETrUDmn_FoQXnQopO4H2c+N4P=Tv60w2T6G92c4L5_=soQA@mail.gmail.com>

Check for TS_COMPAT instead of TIF_IA32 to distinguish ia32 tasks
from 64-bit tasks.
Check for __X32_SYSCALL_BIT only if CONFIG_X86_X32_ABI is defined.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Cc: Elvira Khabirova <lineprinter0@gmail.com>
Cc: Andy Lutomirski <luto@amacapital.net>
---
 arch/x86/kernel/signal.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index cb6282c..ff7dedc 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -692,12 +692,15 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 
 static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
 {
-#if defined(CONFIG_X86_32) || !defined(CONFIG_X86_64)
+#ifdef CONFIG_X86_64
+	if (is_ia32_task())
+		return __NR_ia32_restart_syscall;
+# ifdef CONFIG_X86_X32_ABI
+	if (regs->orig_ax & __X32_SYSCALL_BIT)
+		return __NR_restart_syscall | __X32_SYSCALL_BIT;
+# endif
+#endif
 	return __NR_restart_syscall;
-#else /* !CONFIG_X86_32 && CONFIG_X86_64 */
-	return test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall :
-		__NR_restart_syscall | (regs->orig_ax & __X32_SYSCALL_BIT);
-#endif /* CONFIG_X86_32 || !CONFIG_X86_64 */
 }
 
 /*
-- 
ldv

  reply	other threads:[~2015-12-18 23:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 23:22 [PATCH] x86/signal: fix restart_syscall number for x32 tasks Andy Lutomirski
2015-12-13  3:44 ` Dmitry V. Levin
2015-12-17 20:27   ` Andy Lutomirski
2015-12-18 23:37     ` Dmitry V. Levin [this message]
2015-12-19  6:34       ` [PATCH] x86/signal: Cleanup get_nr_restart_syscall H. Peter Anvin
2015-12-19 14:43         ` [PATCH v2] " Dmitry V. Levin
2015-12-19 20:48           ` Andy Lutomirski
2016-01-11 14:55             ` [RESEND PATCH " Dmitry V. Levin
2016-01-19 13:39               ` [tip:x86/asm] x86/signal: Cleanup get_nr_restart_syscall() tip-bot for Dmitry V. Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151218233736.GA28013@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=hpa@zytor.com \
    --cc=lineprinter0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).