<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/kernel/traps.c, branch linux-3.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2015-01-08T18:30:21Z</updated>
<entry>
<title>x86/asm/traps: Disable tracing and kprobes in fixup_bad_iret and sync_regs</title>
<updated>2015-01-08T18:30:21Z</updated>
<author>
<name>Andy Lutomirski</name>
</author>
<published>2014-11-25T01:39:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=afe83db5ddb73ffafb4669dfa2e1a3c3ad960155'/>
<id>urn:sha1:afe83db5ddb73ffafb4669dfa2e1a3c3ad960155</id>
<content type='text'>
commit 7ddc6a2199f1da405a2fb68c40db8899b1a8cd87 upstream.

These functions can be executed on the int3 stack, so kprobes
are dangerous. Tracing is probably a bad idea, too.

Fixes: b645af2d5905 ("x86_64, traps: Rework bad_iret")
Signed-off-by: Andy Lutomirski &lt;luto@amacapital.net&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Link: http://lkml.kernel.org/r/50e33d26adca60816f3ba968875801652507d0c4.1416870125.git.luto@amacapital.net
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>x86_64, traps: Rework bad_iret</title>
<updated>2014-11-23T21:56:19Z</updated>
<author>
<name>Andy Lutomirski</name>
</author>
<published>2014-11-23T02:00:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b645af2d5905c4e32399005b867987919cbfc3ae'/>
<id>urn:sha1:b645af2d5905c4e32399005b867987919cbfc3ae</id>
<content type='text'>
It's possible for iretq to userspace to fail.  This can happen because
of a bad CS, SS, or RIP.

Historically, we've handled it by fixing up an exception from iretq to
land at bad_iret, which pretends that the failed iret frame was really
the hardware part of #GP(0) from userspace.  To make this work, there's
an extra fixup to fudge the gs base into a usable state.

This is suboptimal because it loses the original exception.  It's also
buggy because there's no guarantee that we were on the kernel stack to
begin with.  For example, if the failing iret happened on return from an
NMI, then we'll end up executing general_protection on the NMI stack.
This is bad for several reasons, the most immediate of which is that
general_protection, as a non-paranoid idtentry, will try to deliver
signals and/or schedule from the wrong stack.

This patch throws out bad_iret entirely.  As a replacement, it augments
the existing swapgs fudge into a full-blown iret fixup, mostly written
in C.  It's should be clearer and more correct.

Signed-off-by: Andy Lutomirski &lt;luto@amacapital.net&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>x86_64, traps: Stop using IST for #SS</title>
<updated>2014-11-23T21:56:19Z</updated>
<author>
<name>Andy Lutomirski</name>
</author>
<published>2014-11-23T02:00:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6f442be2fb22be02cafa606f1769fa1e6f894441'/>
<id>urn:sha1:6f442be2fb22be02cafa606f1769fa1e6f894441</id>
<content type='text'>
On a 32-bit kernel, this has no effect, since there are no IST stacks.

On a 64-bit kernel, #SS can only happen in user code, on a failed iret
to user space, a canonical violation on access via RSP or RBP, or a
genuine stack segment violation in 32-bit kernel code.  The first two
cases don't need IST, and the latter two cases are unlikely fatal bugs,
and promoting them to double faults would be fine.

This fixes a bug in which the espfix64 code mishandles a stack segment
violation.

This saves 4k of memory per CPU and a tiny bit of code.

Signed-off-by: Andy Lutomirski &lt;luto@amacapital.net&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>x86_64, traps: Fix the espfix64 #DF fixup and rewrite it in C</title>
<updated>2014-11-23T21:56:18Z</updated>
<author>
<name>Andy Lutomirski</name>
</author>
<published>2014-11-23T02:00:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=af726f21ed8af2cdaa4e93098dc211521218ae65'/>
<id>urn:sha1:af726f21ed8af2cdaa4e93098dc211521218ae65</id>
<content type='text'>
There's nothing special enough about the espfix64 double fault fixup to
justify writing it in assembly.  Move it to C.

This also fixes a bug: if the double fault came from an IST stack, the
old asm code would return to a partially uninitialized stack frame.

Fixes: 3891a04aafd668686239349ea58f3314ea2af86b
Signed-off-by: Andy Lutomirski &lt;luto@amacapital.net&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>x86/kprobes: Fix build errors and blacklist context_track_user</title>
<updated>2014-06-14T07:07:44Z</updated>
<author>
<name>Masami Hiramatsu</name>
</author>
<published>2014-06-14T06:47:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4cdf77a828b056258f48a9f6078bd2f77d9704bb'/>
<id>urn:sha1:4cdf77a828b056258f48a9f6078bd2f77d9704bb</id>
<content type='text'>
This essentially reverts commit:

  ecd50f714c42 ("kprobes, x86: Call exception_enter after kprobes handled")

since it causes build errors with CONFIG_CONTEXT_TRACKING and
that has been made from misunderstandings;
context_track_user_*() don't involve much in interrupt context,
it just returns if in_interrupt() is true.

Instead of changing the do_debug/int3(), this just adds
context_track_user_*() to kprobes blacklist, since those are
still can be called right before kprobes handles int3 and debug
exceptions, and probing those will cause an infinite loop.

Reported-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Masami Hiramatsu &lt;masami.hiramatsu.pt@hitachi.com&gt;
Cc: Borislav Petkov &lt;bp@suse.de&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Jiri Kosina &lt;jkosina@suse.cz&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Seiji Aguchi &lt;seiji.aguchi@hds.com&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Link: http://lkml.kernel.org/r/20140614064711.7865.45957.stgit@kbuild-fedora.novalocal
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'perf/urgent' into perf/core, to resolve conflict and to prepare for new patches</title>
<updated>2014-06-06T05:55:06Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2014-06-06T05:55:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ec00010972a0971b2c1da4fbe4e5c7d8ed1ecb05'/>
<id>urn:sha1:ec00010972a0971b2c1da4fbe4e5c7d8ed1ecb05</id>
<content type='text'>
Conflicts:
	arch/x86/kernel/traps.c

Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'perf/kprobes' into perf/core</title>
<updated>2014-06-05T10:26:50Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2014-06-05T09:18:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=10b0256496fd6c162478547f7c6df1e052e87644'/>
<id>urn:sha1:10b0256496fd6c162478547f7c6df1e052e87644</id>
<content type='text'>
Conflicts:
	arch/x86/kernel/traps.c

The kprobes enhancements are fully cooked, ship them upstream.

Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>uprobes/x86: Fix the wrong -&gt;si_addr when xol triggers a trap</title>
<updated>2014-05-14T11:57:28Z</updated>
<author>
<name>Oleg Nesterov</name>
</author>
<published>2014-05-12T16:24:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b02ef20a9fba08948e643d3eec0efadf1da01a44'/>
<id>urn:sha1:b02ef20a9fba08948e643d3eec0efadf1da01a44</id>
<content type='text'>
If the probed insn triggers a trap, -&gt;si_addr = regs-&gt;ip is technically
correct, but this is not what the signal handler wants; we need to pass
the address of the probed insn, not the address of xol slot.

Add the new arch-agnostic helper, uprobe_get_trap_addr(), and change
fill_trap_info() and math_error() to use it. !CONFIG_UPROBES case in
uprobes.h uses a macro to avoid include hell and ensure that it can be
compiled even if an architecture doesn't define instruction_pointer().

Test-case:

	#include &lt;signal.h&gt;
	#include &lt;stdio.h&gt;
	#include &lt;unistd.h&gt;

	extern void probe_div(void);

	void sigh(int sig, siginfo_t *info, void *c)
	{
		int passed = (info-&gt;si_addr == probe_div);
		printf(passed ? "PASS\n" : "FAIL\n");
		_exit(!passed);
	}

	int main(void)
	{
		struct sigaction sa = {
			.sa_sigaction	= sigh,
			.sa_flags	= SA_SIGINFO,
		};

		sigaction(SIGFPE, &amp;sa, NULL);

		asm (
			"xor %ecx,%ecx\n"
			".globl probe_div; probe_div:\n"
			"idiv %ecx\n"
		);

		return 0;
	}

it fails if probe_div() is probed.

Note: show_unhandled_signals users should probably use this helper too,
but we need to cleanup them first.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Reviewed-by: Masami Hiramatsu &lt;masami.hiramatsu.pt@hitachi.com&gt;
</content>
</entry>
<entry>
<title>x86/traps: Kill DO_ERROR_INFO()</title>
<updated>2014-05-14T11:57:28Z</updated>
<author>
<name>Oleg Nesterov</name>
</author>
<published>2014-05-08T18:12:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0eb14833d5b1ea1accfeffb71be5de5929f85da9'/>
<id>urn:sha1:0eb14833d5b1ea1accfeffb71be5de5929f85da9</id>
<content type='text'>
Now that DO_ERROR_INFO() doesn't differ from DO_ERROR() we can remove
it and use DO_ERROR() instead.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
</content>
</entry>
<entry>
<title>x86/traps: Shift fill_trap_info() from DO_ERROR_INFO() to do_error_trap()</title>
<updated>2014-05-14T11:57:27Z</updated>
<author>
<name>Oleg Nesterov</name>
</author>
<published>2014-05-08T18:04:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1c326c4dfe182a1c4c1e39f2c00f04c380d11692'/>
<id>urn:sha1:1c326c4dfe182a1c4c1e39f2c00f04c380d11692</id>
<content type='text'>
Move the callsite of fill_trap_info() into do_error_trap() and remove
the "siginfo_t *info" argument.

This obviously breaks DO_ERROR() which passed info == NULL, we simply
change fill_trap_info() to return "siginfo_t *" and add the "default"
case which returns SEND_SIG_PRIV.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
</content>
</entry>
</feed>
