提交 dc884393 编写于 作者: P Peter Collingbourne 提交者: Yang Yingliang

arm64: fix inline asm in load_unaligned_zeropad()

stable inclusion
from linux-4.19.189
commit ab51a5ee10925b7c3f42767353ea61446b0247d6

--------------------------------

commit 185f2e5f upstream.

The inline asm's addr operand is marked as input-only, however in
the case where an exception is taken it may be modified by the BIC
instruction on the exception path. Fix the problem by using a temporary
register as the destination register for the BIC instruction.
Signed-off-by: NPeter Collingbourne <pcc@google.com>
Cc: stable@vger.kernel.org
Link: https://linux-review.googlesource.com/id/I84538c8a2307d567b4f45bb20b715451005f9617
Link: https://lore.kernel.org/r/20210401165110.3952103-1-pcc@google.comSigned-off-by: NWill Deacon <will@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 fed63342
...@@ -64,7 +64,7 @@ static inline unsigned long find_zero(unsigned long mask) ...@@ -64,7 +64,7 @@ static inline unsigned long find_zero(unsigned long mask)
*/ */
static inline unsigned long load_unaligned_zeropad(const void *addr) static inline unsigned long load_unaligned_zeropad(const void *addr)
{ {
unsigned long ret, offset; unsigned long ret, tmp;
/* Load word from unaligned pointer addr */ /* Load word from unaligned pointer addr */
asm( asm(
...@@ -72,9 +72,9 @@ static inline unsigned long load_unaligned_zeropad(const void *addr) ...@@ -72,9 +72,9 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
"2:\n" "2:\n"
" .pushsection .fixup,\"ax\"\n" " .pushsection .fixup,\"ax\"\n"
" .align 2\n" " .align 2\n"
"3: and %1, %2, #0x7\n" "3: bic %1, %2, #0x7\n"
" bic %2, %2, #0x7\n" " ldr %0, [%1]\n"
" ldr %0, [%2]\n" " and %1, %2, #0x7\n"
" lsl %1, %1, #0x3\n" " lsl %1, %1, #0x3\n"
#ifndef __AARCH64EB__ #ifndef __AARCH64EB__
" lsr %0, %0, %1\n" " lsr %0, %0, %1\n"
...@@ -84,7 +84,7 @@ static inline unsigned long load_unaligned_zeropad(const void *addr) ...@@ -84,7 +84,7 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
" b 2b\n" " b 2b\n"
" .popsection\n" " .popsection\n"
_ASM_EXTABLE(1b, 3b) _ASM_EXTABLE(1b, 3b)
: "=&r" (ret), "=&r" (offset) : "=&r" (ret), "=&r" (tmp)
: "r" (addr), "Q" (*(unsigned long *)addr)); : "r" (addr), "Q" (*(unsigned long *)addr));
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册