linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/2] Fix ftracetest issues
Date: Sat, 25 Nov 2017 11:33:02 +0000	[thread overview]
Message-ID: <20171125113302.GY31757@n2100.armlinux.org.uk> (raw)

ftracetest provokes the kernel to try and return to userspace addresses
in kernel mode.  These two patches prevent that.

The first patch, which I intend merging with Linus tonight, ensures that
we catch the condition before we hit userspace, meaning that there is no
possibility of executing user code while in kernel mode.

The second patch fixes the ftracetest issue itself by ensuring that it
is not possible to set a kprobe on any of the "special" assembler code.
Such code includes:
- the kernel primary/secondary CPU startup code
- exception entry code
- idmap code

This is because the conditions under which this code is executed does
not meet the kprobes requirements, which is basically that the
"function" is C-like - it does something and then returns to the parent,
and has a stack.  This is just not universally true of the above code.

This patch is larger than one may desire as we re-organise the sections
that some code ends up in, the way the unwinder works, and how we print
stack frames.

 arch/arm/include/asm/assembler.h | 18 ++++++++++++++++++
 arch/arm/include/asm/exception.h |  3 +--
 arch/arm/include/asm/sections.h  | 21 +++++++++++++++++++++
 arch/arm/include/asm/traps.h     | 12 ------------
 arch/arm/kernel/entry-armv.S     |  6 +-----
 arch/arm/kernel/entry-common.S   |  1 +
 arch/arm/kernel/entry-header.S   |  6 ++++++
 arch/arm/kernel/stacktrace.c     | 14 ++------------
 arch/arm/kernel/traps.c          |  4 ++--
 arch/arm/kernel/vmlinux.lds.S    |  6 +++---
 arch/arm/mm/fault.c              |  5 ++---
 arch/arm/probes/kprobes/core.c   | 14 +++++++++++---
 12 files changed, 68 insertions(+), 42 deletions(-)

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

             reply	other threads:[~2017-11-25 11:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-25 11:33 Russell King - ARM Linux [this message]
2017-11-25 11:33 ` [PATCH 1/2] ARM: BUG if jumping to usermode address in kernel mode Russell King
2017-11-27  1:35   ` Joel Stanley
2017-11-27  9:44     ` Russell King - ARM Linux
2017-11-27 10:16       ` Cédric Le Goater
2017-11-27 10:47         ` Russell King - ARM Linux
2017-11-27 11:50           ` Peter Maydell
2017-11-27 16:55             ` Cédric Le Goater
2017-11-27 14:27   ` Marek Szyprowski
2017-11-27 14:32     ` Russell King - ARM Linux
2017-11-27 14:37       ` Marek Szyprowski
2017-12-08  1:02   ` Alex Shi
2017-12-08  6:31     ` Greg KH
2017-11-25 11:33 ` [PATCH 2/2] ARM: probes: avoid adding kprobes to sensitive kernel-entry/exit code Russell King
2017-12-21 19:40   ` Sam Protsenko
2017-12-22  9:55     ` Russell King - ARM Linux
2017-11-26 15:16 ` [PATCH 0/2] Fix ftracetest issues Alex Shi
2017-11-27 17:25   ` Naresh Kamboju
2017-11-28 13:17     ` Alex Shi
2017-11-28 14:08     ` Naresh Kamboju
2017-12-15 17:40       ` Sam Protsenko

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=20171125113302.GY31757@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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).