From: tip-bot for Dmitry Safonov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, mingo@kernel.org, palves@redhat.com,
tglx@linutronix.de, dsafonov@virtuozzo.com,
linux-kernel@vger.kernel.org
Subject: [tip:x86/vdso] x86/ptrace: Down with test_thread_flag(TIF_IA32)
Date: Wed, 14 Sep 2016 12:35:35 -0700 [thread overview]
Message-ID: <tip-cc87324b3dbb9bdf6916c7f479230db24c4aa309@git.kernel.org> (raw)
In-Reply-To: <20160905133308.28234-6-dsafonov@virtuozzo.com>
Commit-ID: cc87324b3dbb9bdf6916c7f479230db24c4aa309
Gitweb: http://git.kernel.org/tip/cc87324b3dbb9bdf6916c7f479230db24c4aa309
Author: Dmitry Safonov <dsafonov@virtuozzo.com>
AuthorDate: Mon, 5 Sep 2016 16:33:07 +0300
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 14 Sep 2016 21:28:11 +0200
x86/ptrace: Down with test_thread_flag(TIF_IA32)
As the task isn't executing at the moment of {GET,SET}REGS,
return regset that corresponds to code selector, rather than
value of TIF_IA32 flag.
I.e. if we ptrace i386 elf binary that has just changed it's
code selector to __USER_CS, than GET_REGS will return
full x86_64 register set.
Note, that this will work only if application has changed it's CS.
If the application does 32-bit syscall with __USER_CS, ptrace
will still return 64-bit register set. Which might be still confusing
for tools that expect TS_COMPACT to be exposed [1, 2].
So this this change should make PTRACE_GETREGSET more reliable and
this will be another step to drop TIF_{IA32,X32} flags.
[1]: https://sourceforge.net/p/strace/mailman/message/30471411/
[2]: https://lkml.org/lkml/2012/1/18/320
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Cc: 0x7f454c46@gmail.com
Cc: oleg@redhat.com
Cc: linux-mm@kvack.org
Cc: luto@kernel.org
Cc: Pedro Alves <palves@redhat.com>
Cc: gorcunov@openvz.org
Cc: xemul@virtuozzo.com
Link: http://lkml.kernel.org/r/20160905133308.28234-6-dsafonov@virtuozzo.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/kernel/ptrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index f79576a..ad0bab8 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1358,7 +1358,7 @@ void update_regset_xstate_info(unsigned int size, u64 xstate_mask)
const struct user_regset_view *task_user_regset_view(struct task_struct *task)
{
#ifdef CONFIG_IA32_EMULATION
- if (test_tsk_thread_flag(task, TIF_IA32))
+ if (!user_64bit_mode(task_pt_regs(task)))
#endif
#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
return &user_x86_32_view;
next prev parent reply other threads:[~2016-09-14 19:36 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-05 13:33 [PATCHv5 0/6] x86: 32-bit compatible C/R on x86_64 Dmitry Safonov
2016-09-05 13:33 ` Dmitry Safonov
2016-09-05 13:33 ` [PATCHv5 1/6] x86/vdso: unmap vdso blob on vvar mapping failure Dmitry Safonov
2016-09-05 13:33 ` Dmitry Safonov
2016-09-14 19:33 ` [tip:x86/vdso] x86/vdso: Unmap " tip-bot for Dmitry Safonov
2016-09-05 13:33 ` [PATCHv5 2/6] x86/vdso: replace calculate_addr in map_vdso() with addr Dmitry Safonov
2016-09-05 13:33 ` Dmitry Safonov
2016-09-14 19:34 ` [tip:x86/vdso] x86/vdso: Replace " tip-bot for Dmitry Safonov
2016-09-05 13:33 ` [PATCHv5 3/6] x86/arch_prctl/vdso: add ARCH_MAP_VDSO_* Dmitry Safonov
2016-09-05 13:33 ` Dmitry Safonov
2016-09-05 17:01 ` Andy Lutomirski
2016-09-05 17:01 ` Andy Lutomirski
2016-09-14 19:34 ` [tip:x86/vdso] x86/arch_prctl/vdso: Add ARCH_MAP_VDSO_* tip-bot for Dmitry Safonov
2016-10-26 12:30 ` Paul Bolle
2016-10-26 12:49 ` Dmitry Safonov
2016-09-05 13:33 ` [PATCHv5 4/6] x86/coredump: use pr_reg size, rather that TIF_IA32 flag Dmitry Safonov
2016-09-05 13:33 ` Dmitry Safonov
2016-09-14 19:35 ` [tip:x86/vdso] x86/coredump: Use " tip-bot for Dmitry Safonov
2016-09-05 13:33 ` [PATCHv5 5/6] x86/ptrace: down with test_thread_flag(TIF_IA32) Dmitry Safonov
2016-09-05 13:33 ` Dmitry Safonov
2016-09-14 19:35 ` tip-bot for Dmitry Safonov [this message]
2016-09-05 13:33 ` [PATCHv5 6/6] x86/signal: add SA_{X32,IA32}_ABI sa_flags Dmitry Safonov
2016-09-05 13:33 ` Dmitry Safonov
2016-09-14 19:36 ` [tip:x86/vdso] x86/signal: Add " tip-bot for Dmitry Safonov
2016-09-14 15:56 ` [PATCHv5 0/6] x86: 32-bit compatible C/R on x86_64 Dmitry Safonov
2016-09-14 15:56 ` Dmitry Safonov
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=tip-cc87324b3dbb9bdf6916c7f479230db24c4aa309@git.kernel.org \
--to=tipbot@zytor.com \
--cc=dsafonov@virtuozzo.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=palves@redhat.com \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.