<feed xmlns='http://www.w3.org/2005/Atom'>
<title>BMC/Intel-BMC/linux.git/arch/arm64/kernel/insn.c, branch dev-4.6</title>
<subtitle>Intel OpenBMC Linux kernel source tree (mirror)</subtitle>
<id>https://git.radix-linux.su/BMC/Intel-BMC/linux.git/atom?h=dev-4.6</id>
<link rel='self' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/atom?h=dev-4.6'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/'/>
<updated>2016-01-18T00:15:26+00:00</updated>
<entry>
<title>arm64: insn: remove BUG_ON from codegen</title>
<updated>2016-01-18T00:15:26+00:00</updated>
<author>
<name>Zi Shen Lim</name>
<email>zlim.lnx@gmail.com</email>
</author>
<published>2016-01-14T07:33:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.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:29+00:00</updated>
<author>
<name>Yang Shi</name>
<email>yang.shi@linaro.org</email>
</author>
<published>2015-09-30T18:23:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.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>
<entry>
<title>arm64: insn: use set_fixmap_offset to make it more clear</title>
<updated>2015-07-27T10:08:41+00:00</updated>
<author>
<name>yalin wang</name>
<email>yalin.wang2010@gmail.com</email>
</author>
<published>2015-07-24T11:52:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=51650dc2a18b1c65026c3bb9e35da2750e985706'/>
<id>urn:sha1:51650dc2a18b1c65026c3bb9e35da2750e985706</id>
<content type='text'>
A little change to patch_map() function,
use set_fixmap_offset() to make code more clear.

Signed-off-by: yalin wang &lt;yalin.wang2010@gmail.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: insn: Add aarch64_{get,set}_branch_offset</title>
<updated>2015-06-03T14:43:24+00:00</updated>
<author>
<name>Marc Zyngier</name>
<email>marc.zyngier@arm.com</email>
</author>
<published>2015-06-01T09:47:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=10b48f7ef2a765452a583dbc256ed7da7fe7f1fc'/>
<id>urn:sha1:10b48f7ef2a765452a583dbc256ed7da7fe7f1fc</id>
<content type='text'>
In order to deal with branches located in alternate sequences,
but pointing to the main kernel text, it is required to extract
the relative displacement encoded in the instruction, and to be
able to update said instruction with a new offset (once it is
known).

For this, we introduce three new helpers:
- aarch64_insn_is_branch_imm is a predicate indicating if the
  instruction is an immediate branch
- aarch64_get_branch_offset returns a signed value representing
  the byte offset encoded in a branch instruction
- aarch64_set_branch_offset takes an instruction and an offset,
  and returns the corresponding updated instruction.

Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: insn: Add aarch64_insn_decode_immediate</title>
<updated>2015-03-30T10:03:42+00:00</updated>
<author>
<name>Marc Zyngier</name>
<email>marc.zyngier@arm.com</email>
</author>
<published>2015-03-27T13:09:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=0978fb25f86b7595821cee6955679250d47c6438'/>
<id>urn:sha1:0978fb25f86b7595821cee6955679250d47c6438</id>
<content type='text'>
Patching an instruction sometimes requires extracting the immediate
field from this instruction. To facilitate this, and avoid
potential duplication of code, add aarch64_insn_decode_immediate
as the reciprocal to aarch64_insn_encode_immediate.

Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: Fix text patching logic when using fixmap</title>
<updated>2015-02-26T18:34:27+00:00</updated>
<author>
<name>Marc Zyngier</name>
<email>marc.zyngier@arm.com</email>
</author>
<published>2015-02-24T16:30:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=f6242cac10427c546271050b31c891a078e490cd'/>
<id>urn:sha1:f6242cac10427c546271050b31c891a078e490cd</id>
<content type='text'>
Patch 2f896d586610 ("arm64: use fixmap for text patching") changed
the way we patch the kernel text, using a fixmap when the kernel or
modules are flagged as read only.

Unfortunately, a flaw in the logic makes it fall over when patching
modules without CONFIG_DEBUG_SET_MODULE_RONX enabled:

[...]
[   32.032636] Call trace:
[   32.032716] [&lt;fffffe00003da0dc&gt;] __copy_to_user+0x2c/0x60
[   32.032837] [&lt;fffffe0000099f08&gt;] __aarch64_insn_write+0x94/0xf8
[   32.033027] [&lt;fffffe000009a0a0&gt;] aarch64_insn_patch_text_nosync+0x18/0x58
[   32.033200] [&lt;fffffe000009c3ec&gt;] ftrace_modify_code+0x58/0x84
[   32.033363] [&lt;fffffe000009c4e4&gt;] ftrace_make_nop+0x3c/0x58
[   32.033532] [&lt;fffffe0000164420&gt;] ftrace_process_locs+0x3d0/0x5c8
[   32.033709] [&lt;fffffe00001661cc&gt;] ftrace_module_init+0x28/0x34
[   32.033882] [&lt;fffffe0000135148&gt;] load_module+0xbb8/0xfc4
[   32.034044] [&lt;fffffe0000135714&gt;] SyS_finit_module+0x94/0xc4
[...]

This is triggered by the use of virt_to_page() on a module address,
which ends to pointing to Nowhereland if you're lucky, or corrupt
your precious data if not.

This patch fixes the logic by mimicking what is done on arm:
- If we're patching a module and CONFIG_DEBUG_SET_MODULE_RONX is set,
  use vmalloc_to_page().
- If we're patching the kernel and CONFIG_DEBUG_RODATA is set,
  use virt_to_page().
- Otherwise, use the provided address, as we can write to it directly.

Tested on 4.0-rc1 as a KVM guest.

Reported-by: Richard W.M. Jones &lt;rjones@redhat.com&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Acked-by: Laura Abbott &lt;lauraa@codeaurora.org&gt;
Tested-by: Richard W.M. Jones &lt;rjones@redhat.com&gt;
Cc: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: use fixmap for text patching</title>
<updated>2015-01-22T11:50:56+00:00</updated>
<author>
<name>Laura Abbott</name>
<email>lauraa@codeaurora.org</email>
</author>
<published>2015-01-22T01:36:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=2f896d5866107e2926dcdec34a7d40bc56dd2951'/>
<id>urn:sha1:2f896d5866107e2926dcdec34a7d40bc56dd2951</id>
<content type='text'>
When kernel text is marked as read only, it cannot be modified directly.
Use a fixmap to modify the text instead in a similar manner to
x86 and arm.

Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Tested-by: Kees Cook &lt;keescook@chromium.org&gt;
Tested-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Laura Abbott &lt;lauraa@codeaurora.org&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux</title>
<updated>2014-12-09T21:12:47+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2014-12-09T21:12:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=b64bb1d758163814687eb3b84d74e56f04d0c9d1'/>
<id>urn:sha1:b64bb1d758163814687eb3b84d74e56f04d0c9d1</id>
<content type='text'>
Pull arm64 updates from Will Deacon:
 "Here's the usual mixed bag of arm64 updates, also including some
  related EFI changes (Acked by Matt) and the MMU gather range cleanup
  (Acked by you).

  Changes include:
   - support for alternative instruction patching from Andre
   - seccomp from Akashi
   - some AArch32 instruction emulation, required by the Android folks
   - optimisations for exception entry/exit code, cmpxchg, pcpu atomics
   - mmu_gather range calculations moved into core code
   - EFI updates from Ard, including long-awaited SMBIOS support
   - /proc/cpuinfo fixes to align with the format used by arch/arm/
   - a few non-critical fixes across the architecture"

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (70 commits)
  arm64: remove the unnecessary arm64_swiotlb_init()
  arm64: add module support for alternatives fixups
  arm64: perf: Prevent wraparound during overflow
  arm64/include/asm: Fixed a warning about 'struct pt_regs'
  arm64: Provide a namespace to NCAPS
  arm64: bpf: lift restriction on last instruction
  arm64: Implement support for read-mostly sections
  arm64: compat: align cacheflush syscall with arch/arm
  arm64: add seccomp support
  arm64: add SIGSYS siginfo for compat task
  arm64: add seccomp syscall for compat task
  asm-generic: add generic seccomp.h for secure computing mode 1
  arm64: ptrace: allow tracer to skip a system call
  arm64: ptrace: add NT_ARM_SYSTEM_CALL regset
  arm64: Move some head.text functions to executable section
  arm64: jump labels: NOP out NOP -&gt; NOP replacement
  arm64: add support to dump the kernel page tables
  arm64: Add FIX_HOLE to permanent fixed addresses
  arm64: alternatives: fix pr_fmt string for consistency
  arm64: vmlinux.lds.S: don't discard .exit.* sections at link-time
  ...
</content>
</entry>
<entry>
<title>arm64: Emulate CP15 Barrier instructions</title>
<updated>2014-11-20T16:34:48+00:00</updated>
<author>
<name>Punit Agrawal</name>
<email>punit.agrawal@arm.com</email>
</author>
<published>2014-11-18T11:41:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=c852f320584600a372646055d8229e063949eee7'/>
<id>urn:sha1:c852f320584600a372646055d8229e063949eee7</id>
<content type='text'>
The CP15 barrier instructions (CP15ISB, CP15DSB and CP15DMB) are
deprecated in the ARMv7 architecture, superseded by ISB, DSB and DMB
instructions respectively. Some implementations may provide the
ability to disable the CP15 barriers by disabling the CP15BEN bit in
SCTLR_EL1. If not enabled, the encodings for these instructions become
undefined.

To support legacy software using these instructions, this patch
register hooks to -
* emulate CP15 barriers and warn the user about their use
* toggle CP15BEN in SCTLR_EL1

Signed-off-by: Punit Agrawal &lt;punit.agrawal@arm.com&gt;
Reviewed-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: Port SWP/SWPB emulation support from arm</title>
<updated>2014-11-20T16:34:31+00:00</updated>
<author>
<name>Punit Agrawal</name>
<email>punit.agrawal@arm.com</email>
</author>
<published>2014-11-18T11:41:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/BMC/Intel-BMC/linux.git/commit/?id=bd35a4adc4131c530ec7d90242555eac7b3dbe3f'/>
<id>urn:sha1:bd35a4adc4131c530ec7d90242555eac7b3dbe3f</id>
<content type='text'>
The SWP instruction was deprecated in the ARMv6 architecture. The
ARMv7 multiprocessing extensions mandate that SWP/SWPB instructions
are treated as undefined from reset, with the ability to enable them
through the System Control Register SW bit. With ARMv8, the option to
enable these instructions through System Control Register was dropped
as well.

To support legacy applications using these instructions, port the
emulation of the SWP and SWPB instructions from the arm port to arm64.

Reviewed-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Punit Agrawal &lt;punit.agrawal@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
</feed>
