From: Borislav Petkov <bp@alien8.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "X86 ML" <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Frédéric Weisbecker" <fweisbec@gmail.com>,
"Oleg Nesterov" <oleg@redhat.com>,
"kvm list" <kvm@vger.kernel.org>
Subject: Re: [PATCH 1/3] x86_64,entry: Fix RCX for traced syscalls
Date: Tue, 6 Jan 2015 16:34:29 +0100 [thread overview]
Message-ID: <20150106153429.GB32560@pd.tnic> (raw)
In-Reply-To: <CALCETrVEnVV5gibE++gj=eudqEBFTckDasqcY2zZDC9Y+NMUrQ@mail.gmail.com>
On Mon, Jan 05, 2015 at 12:31:15PM -0800, Andy Lutomirski wrote:
> Do you have context tracking on?
Yap, it is enabled for whatever reason:
CONFIG_CONTEXT_TRACKING=y
CONFIG_CONTEXT_TRACKING_FORCE=y
CONFIG_HAVE_CONTEXT_TRACKING=y
> I assume that's in the historical tree?
Yeah.
> > [ 180.059170] ata1.00: exception Emask 0x0 SAct 0x7fffffff SErr 0x0 action 0x6 frozen
> > [ 180.066873] ata1.00: failed command: WRITE FPDMA QUEUED
> > [ 180.072158] ata1.00: cmd 61/08:00:a8:ac:d9/00:00:23:00:00/40 tag 0 ncq 4096 out
> > [ 180.072158] res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
>
> That's really weird. The only thing I can think of is that somehow we
> returned to user mode without enabling interrupts.
Right, considering FIXUP_TOP_OF_STACK is used in a bunch of cases in
entry_64.S, no wonder it corrupts something.
> This leads me to wonder: why do we save eflags in the R11 pt_regs
> slot?
That: "If executed in 64-bit mode, SYSRET loads the lower-32 RFLAGS bits
from R11[31:0] and clears the upper 32 RFLAGS bits."
> This seems entirely backwards, not to mention that it accounts for two
> instructions in each of FIXUP_TOP_OF_STACK and RESTORE_TOP_OF_STACK
> for no apparently reason whatsoever.
> Can you send the full output from syscall_exit_regs_64 from here:
>
> https://gitorious.org/linux-test-utils/linux-clock-tests/source/34884122b6ebe81d9b96e3e5128b6d6d95082c6e:
>
> with the patch applied (assuming it even gets that far for you)? I
> see results like:
>
> [NOTE] syscall ffff: orig RCX = 1 ss = 2b orig_ss = 6b flags =
> 217 orig_flags = 217
>
> which seems fine.
./syscall_exit_regs_64
[OK] int80 ffff: AX = ffffffffffffffda
[OK] int80 40000000: AX = ffffffffffffffda
[OK] syscall ffff: RCX = 400962 RIP = 400962
[OK] syscall ffff: AX = ffffffffffffffda
[NOTE] syscall ffff: orig RCX = 1 ss = 2b orig_ss = 6b flags = 217 orig_flags = 217
[OK] syscall 40000000: RCX = 400962 RIP = 400962
[FAIL] syscall 40000000: AX = fffffffffffffff7
[NOTE] syscall 40000000: orig RCX = 1 ss = 2b orig_ss = 6b flags = 217 orig_flags = 217
[OK] syscall(ffff): ret = -1, errno = 38
> Are you seeing this with the whole series applied or with only this patch?
I applied this patch only and started seeing those. Then I booted in the
previous kernel and tried to repro but it didn't trigger.
I'll try hammering on the kernel *without* your patch to see whether I
can trigger it somehow...
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
next prev parent reply other threads:[~2015-01-06 15:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 23:58 [PATCH 0/3] x86_64,entry: Rearrange the syscall exit optimizations Andy Lutomirski
2014-11-07 23:58 ` [PATCH 1/3] x86_64,entry: Fix RCX for traced syscalls Andy Lutomirski
2015-01-05 12:59 ` Borislav Petkov
2015-01-05 20:31 ` Andy Lutomirski
2015-01-06 15:34 ` Borislav Petkov [this message]
2015-01-06 18:43 ` Andy Lutomirski
2015-01-06 19:00 ` Borislav Petkov
2015-01-07 15:55 ` Borislav Petkov
2014-11-07 23:58 ` [PATCH 2/3] x86_64,entry: Use sysret to return to userspace when possible Andy Lutomirski
2015-01-08 12:29 ` Borislav Petkov
2015-01-08 13:57 ` Borislav Petkov
2015-01-10 21:05 ` Andy Lutomirski
2015-01-09 10:40 ` Borislav Petkov
2014-11-07 23:58 ` [PATCH 3/3] x86_64,entry: Remove the syscall exit audit and schedule optimizations Andy Lutomirski
2015-01-09 15:53 ` Borislav Petkov
2015-01-09 16:08 ` Andy Lutomirski
2014-12-04 1:42 ` [PATCH 0/3] x86_64,entry: Rearrange the syscall exit optimizations 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=20150106153429.GB32560@pd.tnic \
--to=bp@alien8.de \
--cc=fweisbec@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=oleg@redhat.com \
--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