<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/arm64/kernel/insn.c, branch linux-4.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-04-20T07:06:44Z</updated>
<entry>
<title>arm64: patch_text: Fixup last cpu should be master</title>
<updated>2022-04-20T07:06:44Z</updated>
<author>
<name>Guo Ren</name>
</author>
<published>2022-04-07T07:33:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cbd827cae3fdf8c7d2fe2a9ebe34ca4548b0028b'/>
<id>urn:sha1:cbd827cae3fdf8c7d2fe2a9ebe34ca4548b0028b</id>
<content type='text'>
commit 31a099dbd91e69fcab55eef4be15ed7a8c984918 upstream.

These patch_text implementations are using stop_machine_cpuslocked
infrastructure with atomic cpu_count. The original idea: When the
master CPU patch_text, the others should wait for it. But current
implementation is using the first CPU as master, which couldn't
guarantee the remaining CPUs are waiting. This patch changes the
last CPU as the master to solve the potential risk.

Fixes: ae16480785de ("arm64: introduce interfaces to hotpatch kernel and module code")
Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Guo Ren &lt;guoren@kernel.org&gt;
Reviewed-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Reviewed-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Link: https://lore.kernel.org/r/20220407073323.743224-2-guoren@kernel.org
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>arm64: Add helper to decode register from instruction</title>
<updated>2022-04-12T05:52:15Z</updated>
<author>
<name>Suzuki K Poulose</name>
</author>
<published>2022-04-06T16:45:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f28446994a55b1f8b67cb215d7913cce67d2275e'/>
<id>urn:sha1:f28446994a55b1f8b67cb215d7913cce67d2275e</id>
<content type='text'>
commit 8c2dcbd2c4443bad0b4242fb62baa47b260b8f79 upstream.

Add a helper to extract the register field from a given
instruction.

Cc: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Cc: Will Deacon &lt;will.deacon@arm.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Reviewed-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Suzuki K Poulose &lt;suzuki.poulose@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: James Morse &lt;james.morse@arm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>arm64: insn: Add helpers for adrp offsets</title>
<updated>2016-09-09T14:03:28Z</updated>
<author>
<name>Suzuki K Poulose</name>
</author>
<published>2016-09-09T13:07:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=46084bc253e1acdd6c47846e91fc20f4ab4f1fec'/>
<id>urn:sha1:46084bc253e1acdd6c47846e91fc20f4ab4f1fec</id>
<content type='text'>
Adds helpers for decoding/encoding the PC relative addresses for adrp.
This will be used for handling dynamic patching of 'adrp' instructions
in alternative code patching.

Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Will Deacon &lt;will.deacon@arm.com&gt;
Cc: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Cc: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Signed-off-by: Suzuki K Poulose &lt;suzuki.poulose@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: always enable DEBUG_RODATA and remove the Kconfig option</title>
<updated>2016-08-26T09:13:41Z</updated>
<author>
<name>Mark Rutland</name>
</author>
<published>2016-08-25T16:23:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=40982fd6b975de4a51ce5147bc1d698c3b075634'/>
<id>urn:sha1:40982fd6b975de4a51ce5147bc1d698c3b075634</id>
<content type='text'>
Follow the example set by x86 in commit 9ccaf77cf05915f5 ("x86/mm:
Always enable CONFIG_DEBUG_RODATA and remove the Kconfig option"), and
make these protections a fundamental security feature rather than an
opt-in. This also results in a minor code simplification.

For those rare cases when users wish to disable this protection (e.g.
for debugging), this can be done by passing 'rodata=off' on the command
line.

As DEBUG_RODATA_ALIGN is only intended to address a performance/memory
tradeoff, and does not affect correctness, this is left user-selectable.
DEBUG_MODULE_RONX is also left user-selectable until the core code
provides a boot-time option to disable the protection for debugging
use-cases.

Cc: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Acked-by: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: Laura Abbott &lt;labbott@redhat.com&gt;
Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: kprobes instruction simulation support</title>
<updated>2016-07-19T14:03:21Z</updated>
<author>
<name>Sandeepa Prabhu</name>
</author>
<published>2016-07-08T16:35:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=39a67d49ba353630d144a8eb775500c041c89e7a'/>
<id>urn:sha1:39a67d49ba353630d144a8eb775500c041c89e7a</id>
<content type='text'>
Kprobes needs simulation of instructions that cannot be stepped
from a different memory location, e.g.: those instructions
that uses PC-relative addressing. In simulation, the behaviour
of the instruction is implemented using a copy of pt_regs.

The following instruction categories are simulated:
 - All branching instructions(conditional, register, and immediate)
 - Literal access instructions(load-literal, adr/adrp)

Conditional execution is limited to branching instructions in
ARM v8. If conditions at PSTATE do not match the condition fields
of opcode, the instruction is effectively NOP.

Thanks to Will Cohen for assorted suggested changes.

Signed-off-by: Sandeepa Prabhu &lt;sandeepa.s.prabhu@gmail.com&gt;
Signed-off-by: William Cohen &lt;wcohen@redhat.com&gt;
Signed-off-by: David A. Long &lt;dave.long@linaro.org&gt;
Acked-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
[catalin.marinas@arm.com: removed linux/module.h include]
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: add conditional instruction simulation support</title>
<updated>2016-07-19T14:03:19Z</updated>
<author>
<name>David A. Long</name>
</author>
<published>2016-07-08T16:35:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2af3ec08b414ceb9c32fad2bb0f87252f3f18de8'/>
<id>urn:sha1:2af3ec08b414ceb9c32fad2bb0f87252f3f18de8</id>
<content type='text'>
Cease using the arm32 arm_check_condition() function and replace it with
a local version for use in deprecated instruction support on arm64. Also
make the function table used by this available for future use by kprobes
and/or uprobes.

This function is derived from code written by Sandeepa Prabhu.

Signed-off-by: Sandeepa Prabhu &lt;sandeepa.s.prabhu@gmail.com&gt;
Signed-off-by: David A. Long &lt;dave.long@linaro.org&gt;
Acked-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: Add more test functions to insn.c</title>
<updated>2016-07-19T14:03:19Z</updated>
<author>
<name>David A. Long</name>
</author>
<published>2016-07-08T16:35:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d59bee887231191c80f2ee674d7ec19179eb40ec'/>
<id>urn:sha1:d59bee887231191c80f2ee674d7ec19179eb40ec</id>
<content type='text'>
Certain instructions are hard to execute correctly out-of-line (as in
kprobes).  Test functions are added to insn.[hc] to identify these.  The
instructions include any that use PC-relative addressing, change the PC,
or change interrupt masking. For efficiency and simplicity test
functions are also added for small collections of related instructions.

Signed-off-by: David A. Long &lt;dave.long@linaro.org&gt;
Acked-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: insn: avoid virt_to_page() translations on core kernel symbols</title>
<updated>2016-04-14T15:31:49Z</updated>
<author>
<name>Ard Biesheuvel</name>
</author>
<published>2016-03-30T14:45:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e44308e62e19b42810207780a2a32148af0cb5d9'/>
<id>urn:sha1:e44308e62e19b42810207780a2a32148af0cb5d9</id>
<content type='text'>
Before restricting virt_to_page() to the linear mapping, ensure that
the text patching code does not use it to resolve references into the
core kernel text, which is mapped in the vmalloc area.

Signed-off-by: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: insn: remove BUG_ON from codegen</title>
<updated>2016-01-18T00:15:26Z</updated>
<author>
<name>Zi Shen Lim</name>
</author>
<published>2016-01-14T07:33:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c94ae4f7c5ec6b6fddde1c08809d5e32a963d7f3'/>
<id>urn:sha1:c94ae4f7c5ec6b6fddde1c08809d5e32a963d7f3</id>
<content type='text'>
During code generation, we used to BUG_ON unknown/unsupported encoding
or invalid parameters.

Instead, now we report these as errors and simply return the
instruction AARCH64_BREAK_FAULT. Users of these codegen helpers should
check for and handle this failure condition as appropriate.

Otherwise, unhandled codegen failure will result in trapping at
run-time due to AARCH64_BREAK_FAULT, which is arguably better than a
BUG_ON.

Signed-off-by: Zi Shen Lim &lt;zlim.lnx@gmail.com&gt;
Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>arm64: convert patch_lock to raw lock</title>
<updated>2015-10-05T17:30:29Z</updated>
<author>
<name>Yang Shi</name>
</author>
<published>2015-09-30T18:23:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=abffa6f3b1578d5991545f6998ca7ee70b830e94'/>
<id>urn:sha1:abffa6f3b1578d5991545f6998ca7ee70b830e94</id>
<content type='text'>
When running kprobe test on arm64 rt kernel, it reports the below warning:

root@qemu7:~# modprobe kprobe_example
BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:917
in_atomic(): 0, irqs_disabled(): 128, pid: 484, name: modprobe
CPU: 0 PID: 484 Comm: modprobe Not tainted 4.1.6-rt5 #2
Hardware name: linux,dummy-virt (DT)
Call trace:
[&lt;ffffffc0000891b8&gt;] dump_backtrace+0x0/0x128
[&lt;ffffffc000089300&gt;] show_stack+0x20/0x30
[&lt;ffffffc00061dae8&gt;] dump_stack+0x1c/0x28
[&lt;ffffffc0000bbad0&gt;] ___might_sleep+0x120/0x198
[&lt;ffffffc0006223e8&gt;] rt_spin_lock+0x28/0x40
[&lt;ffffffc000622b30&gt;] __aarch64_insn_write+0x28/0x78
[&lt;ffffffc000622e48&gt;] aarch64_insn_patch_text_nosync+0x18/0x48
[&lt;ffffffc000622ee8&gt;] aarch64_insn_patch_text_cb+0x70/0xa0
[&lt;ffffffc000622f40&gt;] aarch64_insn_patch_text_sync+0x28/0x48
[&lt;ffffffc0006236e0&gt;] arch_arm_kprobe+0x38/0x48
[&lt;ffffffc00010e6f4&gt;] arm_kprobe+0x34/0x50
[&lt;ffffffc000110374&gt;] register_kprobe+0x4cc/0x5b8
[&lt;ffffffbffc002038&gt;] kprobe_init+0x38/0x7c [kprobe_example]
[&lt;ffffffc000084240&gt;] do_one_initcall+0x90/0x1b0
[&lt;ffffffc00061c498&gt;] do_init_module+0x6c/0x1cc
[&lt;ffffffc0000fd0c0&gt;] load_module+0x17f8/0x1db0
[&lt;ffffffc0000fd8cc&gt;] SyS_finit_module+0xb4/0xc8

Convert patch_lock to raw loc kto avoid this issue.

Although the problem is found on rt kernel, the fix should be applicable to
mainline kernel too.

Acked-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Yang Shi &lt;yang.shi@linaro.org&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
</feed>
