From: <gregkh@linuxfoundation.org>
To: kristina.martsenko@arm.com, Dave.Martin@arm.com,
catalin.marinas@arm.com, gregkh@linuxfoundation.org,
will.deacon@arm.com
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "arm64: entry: improve data abort handling of tagged pointers" has been added to the 4.9-stable tree
Date: Mon, 12 Jun 2017 15:44:28 +0200 [thread overview]
Message-ID: <149727506832105@kroah.com> (raw)
In-Reply-To: <1496776450-8731-3-git-send-email-kristina.martsenko@arm.com>
This is a note to let you know that I've just added the patch titled
arm64: entry: improve data abort handling of tagged pointers
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
arm64-entry-improve-data-abort-handling-of-tagged-pointers.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From kristina.martsenko@arm.com Mon Jun 12 15:05:37 2017
From: Kristina Martsenko <kristina.martsenko@arm.com>
Date: Tue, 6 Jun 2017 20:14:10 +0100
Subject: arm64: entry: improve data abort handling of tagged pointers
To: stable@vger.kernel.org
Cc: Will Deacon <will.deacon@arm.com>, Catalin Marinas <catalin.marinas@arm.com>
Message-ID: <1496776450-8731-3-git-send-email-kristina.martsenko@arm.com>
From: Kristina Martsenko <kristina.martsenko@arm.com>
commit 276e93279a630657fff4b086ba14c95955912dfa upstream.
This backport has a minor difference from the upstream commit: it adds
the asm-uaccess.h file, which is not present in 4.9, because 4.9 does
not have commit b4b8664d291a ("arm64: don't pull uaccess.h into *.S").
Original patch description:
When handling a data abort from EL0, we currently zero the top byte of
the faulting address, as we assume the address is a TTBR0 address, which
may contain a non-zero address tag. However, the address may be a TTBR1
address, in which case we should not zero the top byte. This patch fixes
that. The effect is that the full TTBR1 address is passed to the task's
signal handler (or printed out in the kernel log).
When handling a data abort from EL1, we leave the faulting address
intact, as we assume it's either a TTBR1 address or a TTBR0 address with
tag 0x00. This is true as far as I'm aware, we don't seem to access a
tagged TTBR0 address anywhere in the kernel. Regardless, it's easy to
forget about address tags, and code added in the future may not always
remember to remove tags from addresses before accessing them. So add tag
handling to the EL1 data abort handler as well. This also makes it
consistent with the EL0 data abort handler.
Fixes: d50240a5f6ce ("arm64: mm: permit use of tagged pointers at EL0")
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/include/asm/asm-uaccess.h | 13 +++++++++++++
arch/arm64/kernel/entry.S | 6 ++++--
2 files changed, 17 insertions(+), 2 deletions(-)
create mode 100644 arch/arm64/include/asm/asm-uaccess.h
--- /dev/null
+++ b/arch/arm64/include/asm/asm-uaccess.h
@@ -0,0 +1,13 @@
+#ifndef __ASM_ASM_UACCESS_H
+#define __ASM_ASM_UACCESS_H
+
+/*
+ * Remove the address tag from a virtual address, if present.
+ */
+ .macro clear_address_tag, dst, addr
+ tst \addr, #(1 << 55)
+ bic \dst, \addr, #(0xff << 56)
+ csel \dst, \dst, \addr, eq
+ .endm
+
+#endif
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -30,6 +30,7 @@
#include <asm/irq.h>
#include <asm/memory.h>
#include <asm/thread_info.h>
+#include <asm/asm-uaccess.h>
#include <asm/unistd.h>
/*
@@ -369,12 +370,13 @@ el1_da:
/*
* Data abort handling
*/
- mrs x0, far_el1
+ mrs x3, far_el1
enable_dbg
// re-enable interrupts if they were enabled in the aborted context
tbnz x23, #7, 1f // PSR_I_BIT
enable_irq
1:
+ clear_address_tag x0, x3
mov x2, sp // struct pt_regs
bl do_mem_abort
@@ -535,7 +537,7 @@ el0_da:
// enable interrupts before calling the main handler
enable_dbg_and_irq
ct_user_exit
- bic x0, x26, #(0xff << 56)
+ clear_address_tag x0, x26
mov x1, x25
mov x2, sp
bl do_mem_abort
Patches currently in stable-queue which might be from kristina.martsenko@arm.com are
queue-4.9/arm64-hw_breakpoint-fix-watchpoint-matching-for-tagged-pointers.patch
queue-4.9/arm64-entry-improve-data-abort-handling-of-tagged-pointers.patch
queue-4.9/arm64-traps-fix-userspace-cache-maintenance-emulation-on-a-tagged-pointer.patch
next prev parent reply other threads:[~2017-06-12 13:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-06 19:14 [PATCH v4.9.y 1/3] arm64: traps: fix userspace cache maintenance emulation on a tagged pointer Kristina Martsenko
2017-06-06 19:14 ` [PATCH v4.9.y 2/3] arm64: hw_breakpoint: fix watchpoint matching for tagged pointers Kristina Martsenko
2017-06-12 13:44 ` Patch "arm64: hw_breakpoint: fix watchpoint matching for tagged pointers" has been added to the 4.9-stable tree gregkh
2017-06-06 19:14 ` [PATCH v4.9.y 3/3] arm64: entry: improve data abort handling of tagged pointers Kristina Martsenko
2017-06-12 13:44 ` gregkh [this message]
2017-06-12 13:06 ` [PATCH v4.9.y 1/3] arm64: traps: fix userspace cache maintenance emulation on a tagged pointer Greg KH
2017-06-12 13:44 ` Patch "arm64: traps: fix userspace cache maintenance emulation on a tagged pointer" has been added to the 4.9-stable tree gregkh
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=149727506832105@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Dave.Martin@arm.com \
--cc=catalin.marinas@arm.com \
--cc=kristina.martsenko@arm.com \
--cc=stable-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=will.deacon@arm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.