<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/arm64/kernel/entry.S, 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>2019-04-03T04:22:10Z</updated>
<entry>
<title>arm64/kernel: fix incorrect EL0 check in inv_entry macro</title>
<updated>2019-04-03T04:22:10Z</updated>
<author>
<name>Ard Biesheuvel</name>
</author>
<published>2016-03-18T09:58:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0c99d0dc291d5f310ad64ceda22ec52006848cd8'/>
<id>urn:sha1:0c99d0dc291d5f310ad64ceda22ec52006848cd8</id>
<content type='text'>
[ Upstream commit b660950c60a7278f9d8deb7c32a162031207c758 ]

The implementation of macro inv_entry refers to its 'el' argument without
the required leading backslash, which results in an undefined symbol
'el' to be passed into the kernel_entry macro rather than the index of
the exception level as intended.

This undefined symbol strangely enough does not result in build failures,
although it is visible in vmlinux:

     $ nm -n vmlinux |head
                      U el
     0000000000000000 A _kernel_flags_le_hi32
     0000000000000000 A _kernel_offset_le_hi32
     0000000000000000 A _kernel_size_le_hi32
     000000000000000a A _kernel_flags_le_lo32
     .....

However, it does result in incorrect code being generated for invalid
exceptions taken from EL0, since the argument check in kernel_entry
assumes EL1 if its argument does not equal '0'.

Signed-off-by: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64: Add trace_hardirqs_off annotation in ret_to_user</title>
<updated>2018-10-13T07:09:23Z</updated>
<author>
<name>Catalin Marinas</name>
</author>
<published>2015-12-04T12:42:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5e290d8b45feead8ccc17df0118f52ca558a2722'/>
<id>urn:sha1:5e290d8b45feead8ccc17df0118f52ca558a2722</id>
<content type='text'>
commit db3899a6477a4dccd26cbfb7f408b6be2cc068e0 upstream.

When a kernel is built with CONFIG_TRACE_IRQFLAGS the following warning
is produced when entering userspace for the first time:

  WARNING: at /work/Linux/linux-2.6-aarch64/kernel/locking/lockdep.c:3519
  Modules linked in:
  CPU: 1 PID: 1 Comm: systemd Not tainted 4.4.0-rc3+ #639
  Hardware name: Juno (DT)
  task: ffffffc9768a0000 ti: ffffffc9768a8000 task.ti: ffffffc9768a8000
  PC is at check_flags.part.22+0x19c/0x1a8
  LR is at check_flags.part.22+0x19c/0x1a8
  pc : [&lt;ffffffc0000fba6c&gt;] lr : [&lt;ffffffc0000fba6c&gt;] pstate: 600001c5
  sp : ffffffc9768abe10
  x29: ffffffc9768abe10 x28: ffffffc9768a8000
  x27: 0000000000000000 x26: 0000000000000001
  x25: 00000000000000a6 x24: ffffffc00064be6c
  x23: ffffffc0009f249e x22: ffffffc9768a0000
  x21: ffffffc97fea5480 x20: 00000000000001c0
  x19: ffffffc00169a000 x18: 0000005558cc7b58
  x17: 0000007fb78e3180 x16: 0000005558d2e238
  x15: ffffffffffffffff x14: 0ffffffffffffffd
  x13: 0000000000000008 x12: 0101010101010101
  x11: 7f7f7f7f7f7f7f7f x10: fefefefefefeff63
  x9 : 7f7f7f7f7f7f7f7f x8 : 6e655f7371726964
  x7 : 0000000000000001 x6 : ffffffc0001079c4
  x5 : 0000000000000000 x4 : 0000000000000001
  x3 : ffffffc001698438 x2 : 0000000000000000
  x1 : ffffffc9768a0000 x0 : 000000000000002e
  Call trace:
  [&lt;ffffffc0000fba6c&gt;] check_flags.part.22+0x19c/0x1a8
  [&lt;ffffffc0000fc440&gt;] lock_is_held+0x80/0x98
  [&lt;ffffffc00064bafc&gt;] __schedule+0x404/0x730
  [&lt;ffffffc00064be6c&gt;] schedule+0x44/0xb8
  [&lt;ffffffc000085bb0&gt;] ret_to_user+0x0/0x24
  possible reason: unannotated irqs-off.
  irq event stamp: 502169
  hardirqs last  enabled at (502169): [&lt;ffffffc000085a98&gt;] el0_irq_naked+0x1c/0x24
  hardirqs last disabled at (502167): [&lt;ffffffc0000bb3bc&gt;] __do_softirq+0x17c/0x298
  softirqs last  enabled at (502168): [&lt;ffffffc0000bb43c&gt;] __do_softirq+0x1fc/0x298
  softirqs last disabled at (502143): [&lt;ffffffc0000bb830&gt;] irq_exit+0xa0/0xf0

This happens because we disable interrupts in ret_to_user before calling
schedule() in work_resched. This patch adds the necessary
trace_hardirqs_off annotation.

Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Reported-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
Cc: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;


</content>
</entry>
<entry>
<title>arm64: entry: improve data abort handling of tagged pointers</title>
<updated>2017-06-14T10:54:20Z</updated>
<author>
<name>Kristina Martsenko</name>
</author>
<published>2017-05-03T15:37:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ae91d1e46d2b3a1eb1d769303ec7f7b44528670b'/>
<id>urn:sha1:ae91d1e46d2b3a1eb1d769303ec7f7b44528670b</id>
<content type='text'>
commit 276e93279a630657fff4b086ba14c95955912dfa upstream.

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 &lt;Dave.Martin@arm.com&gt;
Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Kristina Martsenko &lt;kristina.martsenko@arm.com&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;


</content>
</entry>
<entry>
<title>arm64: avoid returning from bad_mode</title>
<updated>2017-04-30T03:49:14Z</updated>
<author>
<name>Mark Rutland</name>
</author>
<published>2017-01-18T17:23:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=21ffe52cc23f29b9fddb2bb063340d1cda9cc57e'/>
<id>urn:sha1:21ffe52cc23f29b9fddb2bb063340d1cda9cc57e</id>
<content type='text'>
commit 7d9e8f71b989230bc613d121ca38507d34ada849 upstream.

Generally, taking an unexpected exception should be a fatal event, and
bad_mode is intended to cater for this. However, it should be possible
to contain unexpected synchronous exceptions from EL0 without bringing
the kernel down, by sending a SIGILL to the task.

We tried to apply this approach in commit 9955ac47f4ba1c95 ("arm64:
don't kill the kernel on a bad esr from el0"), by sending a signal for
any bad_mode call resulting from an EL0 exception.

However, this also applies to other unexpected exceptions, such as
SError and FIQ. The entry paths for these exceptions branch to bad_mode
without configuring the link register, and have no kernel_exit. Thus, if
we take one of these exceptions from EL0, bad_mode will eventually
return to the original user link register value.

This patch fixes this by introducing a new bad_el0_sync handler to cater
for the recoverable case, and restoring bad_mode to its original state,
whereby it calls panic() and never returns. The recoverable case
branches to bad_el0_sync with a bl, and returns to userspace via the
usual ret_to_user mechanism.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Fixes: 9955ac47f4ba1c95 ("arm64: don't kill the kernel on a bad esr from el0")
Reported-by: Mark Salter &lt;msalter@redhat.com&gt;
Cc: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;


</content>
</entry>
<entry>
<title>arm64: entry: fix context tracking for el0_sp_pc</title>
<updated>2015-07-04T03:02:32Z</updated>
<author>
<name>Mark Rutland</name>
</author>
<published>2015-06-15T15:40:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e71254d2aa10d9b5f548bc06d2fbb018deeffac7'/>
<id>urn:sha1:e71254d2aa10d9b5f548bc06d2fbb018deeffac7</id>
<content type='text'>
[ Upstream commit 46b0567c851cf85d6ba6f23eef385ec9111d09bc ]

Commit 6c81fe7925cc4c42 ("arm64: enable context tracking") did not
update el0_sp_pc to use ct_user_exit, but this appears to have been
unintentional. In commit 6ab6463aeb5fbc75 ("arm64: adjust el0_sync so
that a function can be called") we made x0 available, and in the return
to userspace we call ct_user_enter in the kernel_exit macro.

Due to this, we currently don't correctly inform RCU of the user-&gt;kernel
transition, and may erroneously account for time spent in the kernel as
if we were in an extended quiescent state when CONFIG_CONTEXT_TRACKING
is enabled.

As we do record the kernel-&gt;user transition, a userspace application
making accesses from an unaligned stack pointer can demonstrate the
imbalance, provoking the following warning:

------------[ cut here ]------------
WARNING: CPU: 2 PID: 3660 at kernel/context_tracking.c:75 context_tracking_enter+0xd8/0xe4()
Modules linked in:
CPU: 2 PID: 3660 Comm: a.out Not tainted 4.1.0-rc7+ #8
Hardware name: ARM Juno development board (r0) (DT)
Call trace:
[&lt;ffffffc000089914&gt;] dump_backtrace+0x0/0x124
[&lt;ffffffc000089a48&gt;] show_stack+0x10/0x1c
[&lt;ffffffc0005b3cbc&gt;] dump_stack+0x84/0xc8
[&lt;ffffffc0000b3214&gt;] warn_slowpath_common+0x98/0xd0
[&lt;ffffffc0000b330c&gt;] warn_slowpath_null+0x14/0x20
[&lt;ffffffc00013ada4&gt;] context_tracking_enter+0xd4/0xe4
[&lt;ffffffc0005b534c&gt;] preempt_schedule_irq+0xd4/0x114
[&lt;ffffffc00008561c&gt;] el1_preempt+0x4/0x28
[&lt;ffffffc0001b8040&gt;] exit_files+0x38/0x4c
[&lt;ffffffc0000b5b94&gt;] do_exit+0x430/0x978
[&lt;ffffffc0000b614c&gt;] do_group_exit+0x40/0xd4
[&lt;ffffffc0000c0208&gt;] get_signal+0x23c/0x4f4
[&lt;ffffffc0000890b4&gt;] do_signal+0x1ac/0x518
[&lt;ffffffc000089650&gt;] do_notify_resume+0x5c/0x68
---[ end trace 963c192600337066 ]---

This patch adds the missing ct_user_exit to the el0_sp_pc entry path,
correcting the context tracking for this case.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Fixes: 6c81fe7925cc ("arm64: enable context tracking")
Cc: &lt;stable@vger.kernel.org&gt; # v3.17+
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>arm64: errata: add workaround for cortex-a53 erratum #845719</title>
<updated>2015-04-27T21:13:46Z</updated>
<author>
<name>Will Deacon</name>
</author>
<published>2015-04-24T17:30:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5430a02112fc962e5dff5feee6e3fcdacc00357f'/>
<id>urn:sha1:5430a02112fc962e5dff5feee6e3fcdacc00357f</id>
<content type='text'>
When running a compat (AArch32) userspace on Cortex-A53, a load at EL0
from a virtual address that matches the bottom 32 bits of the virtual
address used by a recent load at (AArch64) EL1 might return incorrect
data.

This patch works around the issue by writing to the contextidr_el1
register on the exception return path when returning to a 32-bit task.
This workaround is patched in at runtime based on the MIDR value of the
processor.

Reviewed-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Tested-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;

Cc: &lt;stable@vger.kernel.org&gt; # v3.18.y
(cherry picked from commit 905e8c5dcaa147163672b06fe9dcb5abaacbc711)
Signed-off-by: Kevin Hilman &lt;khilman@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>arm64: debug: don't re-enable debug exceptions on return from el1_dbg</title>
<updated>2014-09-23T14:49:34Z</updated>
<author>
<name>Will Deacon</name>
</author>
<published>2014-09-22T10:19:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1059c6bf8534acda249e7e65c81e7696fb074dc1'/>
<id>urn:sha1:1059c6bf8534acda249e7e65c81e7696fb074dc1</id>
<content type='text'>
When returning from a debug exception taken from EL1, we unmask debug
exceptions after handling the exception. This is crucial for debug
exceptions taken from EL0, so that any kernel work on the ret_to_user
path can be debugged by kgdb.

However, when returning back to EL1 the only thing left to do is to
restore the original register state before the exception return. If
single-step has been enabled by the debug exception handler, we will
get stuck in an infinite debug exception loop, since we will take the
step exception as soon as we unmask debug exceptions.

This patch avoids unmasking debug exceptions on the debug exception
return path when the exception was taken from EL1.

Fixes: 2a2830703a23 (arm64: debug: avoid accessing mdscr_el1 on fault paths where possible)
Cc: &lt;stable@vger.kernel.org&gt; #3.16+
Reported-by: David Long &lt;dave.long@linaro.org&gt;
Reported-by: AKASHI Takahiro &lt;takahiro.akashi@linaro.org&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: Add __NR_* definitions for compat syscalls</title>
<updated>2014-07-10T10:02:40Z</updated>
<author>
<name>Catalin Marinas</name>
</author>
<published>2014-01-30T17:56:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f3e5c847ec3d12b4de7898662024ee25622b25d7'/>
<id>urn:sha1:f3e5c847ec3d12b4de7898662024ee25622b25d7</id>
<content type='text'>
This patch adds __NR_* definitions to asm/unistd32.h, moves the
__NR_compat_* definitions to asm/unistd.h and removes all the explicit
unistd32.h includes apart from the one building the compat syscall
table. The aim is to have the compat __NR_* definitions available but
without colliding with the native syscall definitions (required by
lib/compat_audit.c to avoid duplicating the audit header files between
native and compat).

Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: enable context tracking</title>
<updated>2014-07-10T09:10:21Z</updated>
<author>
<name>Larry Bassel</name>
</author>
<published>2014-05-30T19:34:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6c81fe7925cc4c42de49e17be21eb86d1173c3a7'/>
<id>urn:sha1:6c81fe7925cc4c42de49e17be21eb86d1173c3a7</id>
<content type='text'>
Make calls to ct_user_enter when the kernel is exited
and ct_user_exit when the kernel is entered (in el0_da,
el0_ia, el0_svc, el0_irq and all of the "error" paths).

These macros expand to function calls which will only work
properly if el0_sync and related code has been rearranged
(in a previous patch of this series).

The calls to ct_user_exit are made after hw debugging has been
enabled (enable_dbg_and_irq).

The call to ct_user_enter is made at the beginning of the
kernel_exit macro.

This patch is based on earlier work by Kevin Hilman.
Save/restore optimizations were also done by Kevin.

Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Reviewed-by: Kevin Hilman &lt;khilman@linaro.org&gt;
Tested-by: Kevin Hilman &lt;khilman@linaro.org&gt;
Signed-off-by: Larry Bassel &lt;larry.bassel@linaro.org&gt;
Signed-off-by: Kevin Hilman &lt;khilman@linaro.org&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: adjust el0_sync so that a function can be called</title>
<updated>2014-07-10T09:10:20Z</updated>
<author>
<name>Larry Bassel</name>
</author>
<published>2014-05-30T19:34:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6ab6463aeb5fbc75fa3227befb508fc33b34dbf1'/>
<id>urn:sha1:6ab6463aeb5fbc75fa3227befb508fc33b34dbf1</id>
<content type='text'>
To implement the context tracker properly on arm64,
a function call needs to be made after debugging and
interrupts are turned on, but before the lr is changed
to point to ret_to_user(). If the function call
is made after the lr is changed the function will not
return to the correct place.

For similar reasons, defer the setting of x0 so that
it doesn't need to be saved around the function call
(save far_el1 in x26 temporarily instead).

Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Reviewed-by: Kevin Hilman &lt;khilman@linaro.org&gt;
Tested-by: Kevin Hilman &lt;khilman@linaro.org&gt;
Signed-off-by: Larry Bassel &lt;larry.bassel@linaro.org&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
</feed>
