From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: ensure dump_instr() checks addr_limit
Date: Thu, 2 Nov 2017 16:57:56 +0000 [thread overview]
Message-ID: <20171102165755.GG9463@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20171102163452.7652-1-mark.rutland@arm.com>
On Thu, Nov 02, 2017 at 04:34:52PM +0000, Mark Rutland wrote:
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
>
> When CONFIG_DEBUG_USER is enabled, it's possible for a user to
> deliberately trigger dump_instr() with a chosen kernel address.
Hi Mark,
Please show how userspace could trigger that, as I don't think it's
possible. Firstly, you need to set PC to a kernel address, which
will trigger an abort.
When that happens, we'll get a section permission fault, and head
to do_sect_fault(). This will call do_bad_area(), which will detect
that it's a userspace fault (because of the CPSR value).
This calls show_pte() and show_regs(). show_pte() shows the page
table values only. show_regs() shows the register values, and then
dumps the kernel stack via show_stack(). Nothing in this path calls
dump_instr().
The places where dump_instr() is called from are:
die()
do_undefinstr()
bad_syscall()
arm_syscall()
baddataabort() (only for late v4 faulting architectures)
The last four all need the CPU to have read and attempted to execute
the instruction, so the permission checks must have passed. Userspace
can't achieve that by setting the PC to a kernel address.
die() is called when we enter an exception in an invalid mode, or we
have a kernel mode fault (CPSR in kernel mode) that we can't handle,
we have fault handling disabled (never the case when running user
code), or we have no mm (kernel thread).
So, I don't see how the kernel could be provoked to dump instructions
from kernel space by the user.
Please show a working example.
Thanks.
--
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
prev parent reply other threads:[~2017-11-02 16:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-02 16:34 [PATCH] arm: ensure dump_instr() checks addr_limit Mark Rutland
2017-11-02 16:47 ` Greg KH
2017-11-02 17:30 ` Mark Rutland
2017-11-02 17:46 ` Greg KH
2017-11-02 17:50 ` Russell King - ARM Linux
2017-11-02 16:57 ` Russell King - ARM Linux [this message]
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=20171102165755.GG9463@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).