From: Dmitry Safonov <dsafonov@virtuozzo.com>
To: <linux-kernel@vger.kernel.org>
Cc: <luto@amacapital.net>, <tglx@linutronix.de>, <mingo@redhat.com>,
<hpa@zytor.com>, <x86@kernel.org>, <rric@kernel.org>,
<oprofile-list@lists.sf.net>, <0x7f454c46@gmail.com>,
Dmitry Safonov <dsafonov@virtuozzo.com>
Subject: [PATCH 2/4] x86/intel: down with test_thread_flag(TIF_IA32)
Date: Thu, 14 Apr 2016 21:10:12 +0300 [thread overview]
Message-ID: <1460657414-12530-3-git-send-email-dsafonov@virtuozzo.com> (raw)
In-Reply-To: <1460657414-12530-1-git-send-email-dsafonov@virtuozzo.com>
For IP + one insturction fixup there is need to know
in which state (compat/native) is application. Now
it's done with TIF_IA32 test, which is buggy, as
the process may change it's CS register to __USER32_CS
descriptor (and vice-versa) so instruction interpreter
will fail to correctly fixup IP.
Changing to user_64bit_mode to check for interrupt
register set is better, however it may race with task,
that changes it's code selector frequiently.
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
---
arch/x86/events/intel/ds.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index 8584b90d8e0b..e903a8d3b4b0 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -962,7 +962,7 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
old_to = to;
#ifdef CONFIG_X86_64
- is_64bit = kernel_ip(to) || !test_thread_flag(TIF_IA32);
+ is_64bit = kernel_ip(to) || user_64bit_mode(regs);
#endif
insn_init(&insn, kaddr, size, is_64bit);
insn_get_length(&insn);
--
2.8.0
next prev parent reply other threads:[~2016-04-14 18:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-14 18:10 [PATCH 0/4] drop test_thread_flag checks Dmitry Safonov
2016-04-14 18:10 ` [PATCH 1/4] x86/events: down with test_thread_flag(TIF_IA32) Dmitry Safonov
2016-04-14 18:32 ` Andy Lutomirski
2016-04-20 11:15 ` Peter Zijlstra
2016-04-14 18:10 ` Dmitry Safonov [this message]
2016-04-14 18:10 ` [PATCH 3/4] x86/intel lbr: " Dmitry Safonov
2016-04-14 19:29 ` Andy Lutomirski
2016-04-20 11:21 ` Peter Zijlstra
2016-04-20 13:43 ` Dmitry Safonov
2016-04-14 18:10 ` [PATCH 4/4] x86/oprofile: " Dmitry Safonov
2016-04-14 19:29 ` Andy Lutomirski
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=1460657414-12530-3-git-send-email-dsafonov@virtuozzo.com \
--to=dsafonov@virtuozzo.com \
--cc=0x7f454c46@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=oprofile-list@lists.sf.net \
--cc=rric@kernel.org \
--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
all inboxes | Powered by JetHome®