Re: [PATCH] xen/evtchn: Change irq_info lock to raw_spinlock_t

2021-04-06 Thread Julien Grall
_t to raw_spinlock_t Cc: sta...@vger.kernel.org Fixes: 25da4618af24 ("xen/events: don't unmask an event channel when an eoi is pending") Signed-off-by: Luca Fancellu Reviewed-by: Julien Grall Cheers, -- Julien Grall

Re: [RFC PATCH v2 13/13] objtool: arm64: Enable stack validation for arm64

2021-03-09 Thread Julien Thierry
On 3/7/21 11:25 AM, Ard Biesheuvel wrote: On Wed, 3 Mar 2021 at 18:10, Julien Thierry wrote: From: Raphael Gault Add build option to run stack validation at compile time. When requiring stack validation, jump tables are disabled as it simplifies objtool analysis (without having to

Re: [RFC PATCH v2 00/13] objtool: add base support for arm64

2021-03-09 Thread Julien Thierry
there are multiple parts in arm64 assembler needing this). I have not submitted those yet because I didn't want the amount of patches to become overwhelming and mixing objtool + kernel sources. [1] https://github.com/julien-thierry/linux/commit/9005e9f3bb10aac663c42bb87d337b7a1aae5a

Re: [RFC PATCH v2 00/13] objtool: add base support for arm64

2021-03-04 Thread Julien Thierry
ke bellow which is simple enough to use and update. Otherwise you could have per arch targets, but since the generic part of objtool uses arch specific headers, you'll have to rebuild object files between two arch builds anyway. Julien --> >From 36cf9e05f2ee40bd5239c3b78cd1c5260941cb94

[RFC PATCH v2 12/13] objtool: arm64: Ignore replacement section for alternative callback

2021-03-03 Thread Julien Thierry
ARM64_CB_PATCH doesn't have static replacement instructions. Skip trying to validate the alternative section. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/special.c | 12 tools/objtool/check.c | 3 +++ 2 files changed, 15 insertions(+) diff --

[RFC PATCH v2 03/13] tools: bug: Remove duplicate definition

2021-03-03 Thread Julien Thierry
Under tools, bug.h only defines BUILD_BUG_ON_ZERO() which is already defined in build_bug.h. This prevents a file to include both headers at the same time. Have bug.h include build_bug.h instead. Signed-off-by: Julien Thierry --- tools/include/linux/bug.h | 6 +- 1 file changed, 1

[RFC PATCH v2 07/13] objtool: arm64: Decode other system instructions

2021-03-03 Thread Julien Thierry
Decode ERET, BRK and NOPs Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/tools/objtool/arch/arm64/decode.c b/tools/objtool/arch/arm64/decode.c index 983f16b8b2af..3008dcbb5e64 100644 --- a/tools/objtool/arch/arm64

[RFC PATCH v2 09/13] objtool: arm64: Decode LDR instructions

2021-03-03 Thread Julien Thierry
Load literal instructions can generate constants inside code sections. Record the locations of the constants in order to be able to remove their corresponding "struct instruction". Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c| 86 +

[RFC PATCH v2 06/13] objtool: arm64: Decode jump and call related instructions

2021-03-03 Thread Julien Thierry
Decode branch, branch and link (aarch64's call) and return instructions. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/tools/objtool/arch/arm64/decode.c b/tools/objtool/arch/arm64/decode.c

[RFC PATCH v2 02/13] tools: arm64: Make aarch64 instruction decoder available to tools

2021-03-03 Thread Julien Thierry
Add aarch64 encoder/decoder implementation under tools/ as well as the necessary arm64 headers. Signed-off-by: Julien Thierry --- tools/arch/arm64/include/asm/insn.h | 565 +++ tools/arch/arm64/lib/insn.c | 1456 +++ 2 files changed, 2021 insertions

[RFC PATCH v2 01/13] tools: Add some generic functions and headers

2021-03-03 Thread Julien Thierry
These will be needed to be able to use arm64 instruction decoder in userland tools. Signed-off-by: Julien Thierry --- tools/include/asm-generic/bitops/__ffs.h | 11 +++ tools/include/linux/kernel.h | 21 + tools/include/linux/printk.h | 40

[RFC PATCH v2 13/13] objtool: arm64: Enable stack validation for arm64

2021-03-03 Thread Julien Thierry
size nor system performance. Signed-off-by: Raphael Gault Signed-off-by: Julien Thierry --- arch/arm64/Kconfig | 1 + arch/arm64/Makefile | 4 2 files changed, 5 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 1f212b47a48a..928323c03318 100644 --- a/arch/arm64

[RFC PATCH v2 10/13] objtool: arm64: Accept padding in code sections

2021-03-03 Thread Julien Thierry
The compiler can introduce some '0' words in code sections to pad the end of functions. Similar to load literal functions, record these zero words to remove the "struct instruction" created for them. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c | 19 ++

[RFC PATCH v2 08/13] objtool: arm64: Decode load/store instructions

2021-03-03 Thread Julien Thierry
the base pointer after the load). Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c | 148 ++ 1 file changed, 148 insertions(+) diff --git a/tools/objtool/arch/arm64/decode.c b/tools/objtool/arch/arm64/decode.c index 3008dcbb5e64..4e086d2251f5 100644

[RFC PATCH v2 8/8] arm64: insn: Add load/store decoding helpers

2021-03-03 Thread Julien Thierry
Provide some function to group different load/store instructions. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/insn.h | 28 1 file changed, 28 insertions(+) diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h index 388aa22eacb1

[RFC PATCH v2 05/13] objtool: arm64: Decode add/sub instructions

2021-03-03 Thread Julien Thierry
Decode aarch64 additions and substractions and create stack_ops for instructions interacting with SP or FP. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c | 94 +++ 1 file changed, 94 insertions(+) diff --git a/tools/objtool/arch/arm64/decode.c

[RFC PATCH v2 04/13] objtool: arm64: Add base definition for arm64 backend

2021-03-03 Thread Julien Thierry
Provide needed definitions for a new architecture instruction decoder. No proper decoding is done yet. Signed-off-by: Julien Thierry --- tools/objtool/Makefile| 5 + tools/objtool/arch/arm64/Build| 8 ++ tools/objtool/arch/arm64/decode.c

[RFC PATCH v2 00/13] objtool: add base support for arm64

2021-03-03 Thread Julien Thierry
e changes, there are still some errors when building with objtool. A number of cleanups/annotations are needed on the arm64, as well as handling SYM_DATA objects in objtool. Those changes can be found on top of this branch here: git clone https://github.com/julien-thierry/linux.git -b objtoolxa

[RFC PATCH v2 11/13] objtool: arm64: Handle supported relocations in alternatives

2021-03-03 Thread Julien Thierry
Based on get_alt_insn() in arch/arm64/kernel/alternative.c, arm64 alternative code adapts offsets for static branches and adrp instructions. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/special.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools

[RFC PATCH v2 7/8] arm64: insn: Add some opcodes to instruction decoder

2021-03-03 Thread Julien Thierry
Add decoding capability for some instructions that objtool will need to decode. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/insn.h | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h index 185f52ef0228

[RFC PATCH v2 6/8] arm64: insn: Add barrier encodings

2021-03-03 Thread Julien Thierry
Create necessary functions to encode/decode aarch64 barrier instructions. DSB needs special case handling as it has multiple encodings. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/insn.h | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/arm64/include

[RFC PATCH v2 3/8] arm64: insn: Reduce header dependencies of instruction decoder

2021-03-03 Thread Julien Thierry
The instruction encoder/decoder depends on alternative headers only for single macro definitions that could be part of the instruction decoder. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/alternative-macros.h | 3 --- arch/arm64/include/asm/insn.h | 3 ++- 2 files

[RFC PATCH v2 5/8] arm64: insn: Add SVE instruction class

2021-03-03 Thread Julien Thierry
SVE has been public for some time now. Let the decoder acknowledge its existence. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/insn.h | 1 + arch/arm64/lib/insn.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64

[RFC PATCH v2 4/8] arm64: Move instruction encoder/decoder under lib/

2021-03-03 Thread Julien Thierry
. Code was only moved, no code should have been added, removed nor modifier. Signed-off-by: Julien Thierry --- arch/arm64/kernel/Makefile| 2 +- arch/arm64/lib/Makefile | 6 +++--- arch/arm64/{kernel => lib}/insn.c | 0 3 files changed, 4 insertions(+), 4 deletions(-) rename a

[RFC PATCH v2 2/8] arm64: Move aarch32 condition check functions

2021-03-03 Thread Julien Thierry
The functions to check condition flags for aarch32 execution is only used to emulate aarch32 instructions. Move them from the instruction encoding/decoding code to the trap handling files. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/insn.h| 2 - arch/arm64/include/asm

[RFC PATCH v2 1/8] arm64: Move patching utilities out of instruction encoding/decoding

2021-03-03 Thread Julien Thierry
Files insn.[c|h] containt some functions used for instruction patching. In order to reuse the instruction encoder/decoder, move the patching utilities to their own file. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/insn.h | 5 - arch/arm64/include/asm/patching.h | 13

[RFC PATCH v2 0/8] arm64: Prepare instruction decoder for objtool

2021-03-03 Thread Julien Thierry
encoder/decoder capabilities in several steps as suggested by Mark R. - Exclude dsb encoding where CRm != 0b0x00 - Support dsb FEAT_XS encoding - Support previously missing barriers [1] https://lkml.org/lkml/2021/1/20/791 Thanks, Julien --> Julien Thierry (8): arm64: Move patching utilit

Re: [PATCH v3 3/8] xen/events: avoid handling the same event on two cpus at the same time

2021-02-20 Thread Julien Grall
t data and call the handler only if this flag isn't set. Cc: sta...@vger.kernel.org Reported-by: Julien Grall Signed-off-by: Juergen Gross Reviewed-by: Julien Grall Cheers, -- Julien Grall

Re: [PATCH v3 2/8] xen/events: don't unmask an event channel when an eoi is pending

2021-02-20 Thread Julien Grall
"normal" masking/unmasking from eoi related masking/unmasking and temporary masking. The event channel should only be able to generate an interrupt if all flags are cleared. Cc: sta...@vger.kernel.org Fixes: 54c9de89895e0a36047 ("xen/events: add a new late EOI evtchn framework") Repor

Re: [PATCH v2 3/8] xen/events: avoid handling the same event on two cpus at the same time

2021-02-14 Thread Julien Grall
t data and call the handler only if this flag isn't set. Reported-by: Julien Grall Signed-off-by: Juergen Gross --- V2: - new patch --- drivers/xen/events/events_base.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/xen/events/events_base.

Re: [PATCH v2 1/8] xen/events: reset affinity of 2-level event when tearing it down

2021-02-14 Thread Julien Grall
zeroed out). Cc: sta...@vger.kernel.org Reported-by: Julien Grall Signed-off-by: Juergen Gross Reviewed-by: Julien Grall Cheers, --- V2: - reset affinity when tearing down the event (Julien Grall) --- drivers/xen/events/events_2l.c | 15 +++ drivers/xen/events

[PATCH] arm/xen: Don't probe xenbus as part of an early initcall

2021-02-10 Thread Julien Grall
From: Julien Grall After Commit 3499ba8198cad ("xen: Fix event channel callback via INTX/GSI"), xenbus_probe() will be called too early on Arm. This will recent to a guest hang during boot. If there hang wasn't there, we would have ended up to call xenbus_probe() twice (the se

Re: [PATCH 0/7] xen/events: bug fixes and some diagnostic aids

2021-02-08 Thread Julien Grall
On 08/02/2021 14:20, Julien Grall wrote: I believe this will be the case before our "lateeoi" handling is becoming active (more precise: when our IRQ handler is returning to handle_fasteoi_irq()), resulting in the possibility of the same race we are experiencing now. I am a bi

Re: [PATCH 0/7] xen/events: bug fixes and some diagnostic aids

2021-02-08 Thread Julien Grall
Hi Juergen, On 08/02/2021 13:58, Jürgen Groß wrote: On 08.02.21 14:09, Julien Grall wrote: Hi Juergen, On 08/02/2021 12:31, Jürgen Groß wrote: On 08.02.21 13:16, Julien Grall wrote: On 08/02/2021 12:14, Jürgen Groß wrote: On 08.02.21 11:40, Julien Grall wrote: Hi Juergen, On 08/02/2021

Re: [PATCH 0/7] xen/events: bug fixes and some diagnostic aids

2021-02-08 Thread Julien Grall
Hi Juergen, On 08/02/2021 12:31, Jürgen Groß wrote: On 08.02.21 13:16, Julien Grall wrote: On 08/02/2021 12:14, Jürgen Groß wrote: On 08.02.21 11:40, Julien Grall wrote: Hi Juergen, On 08/02/2021 10:22, Jürgen Groß wrote: On 08.02.21 10:54, Julien Grall wrote: ... I don't really se

Re: [PATCH 0/7] xen/events: bug fixes and some diagnostic aids

2021-02-08 Thread Julien Grall
On 08/02/2021 12:14, Jürgen Groß wrote: On 08.02.21 11:40, Julien Grall wrote: Hi Juergen, On 08/02/2021 10:22, Jürgen Groß wrote: On 08.02.21 10:54, Julien Grall wrote: ... I don't really see how the difference matter here. The idea is to re-use what's already existing rather t

Re: [PATCH 7/7] xen/evtchn: read producer index only once

2021-02-08 Thread Julien Grall
Hi Juergen, On 08/02/2021 11:48, Jürgen Groß wrote: On 08.02.21 12:40, Julien Grall wrote: On 06/02/2021 10:49, Juergen Gross wrote: In evtchn_read() use READ_ONCE() for reading the producer index in order to avoid the compiler generating multiple accesses. Signed-off-by: Juergen Gross

Re: [PATCH 7/7] xen/evtchn: read producer index only once

2021-02-08 Thread Julien Grall
or properly aligned machine-sized stores, WRITE_ONCE() will prevent store tearing." Cheers, [1] https://lwn.net/Articles/793253/#Load%20Tearing Juergen -- Julien Grall

Re: [PATCH 7/7] xen/evtchn: read producer index only once

2021-02-08 Thread Julien Grall
ons; - p = u->ring_prod; + p = READ_ONCE(u->ring_prod); For consistency, don't you also need the write side in evtchn_interrupt() to use WRITE_ONCE()? if (c != p) break; -- Julien Grall

Re: [PATCH 0/7] xen/events: bug fixes and some diagnostic aids

2021-02-08 Thread Julien Grall
Hi Juergen, On 08/02/2021 10:22, Jürgen Groß wrote: On 08.02.21 10:54, Julien Grall wrote: ... I don't really see how the difference matter here. The idea is to re-use what's already existing rather than trying to re-invent the wheel with an extra lock (or whatever we can come

Re: [PATCH 0/7] xen/events: bug fixes and some diagnostic aids

2021-02-08 Thread Julien Grall
On 08/02/2021 09:41, Jürgen Groß wrote: On 08.02.21 10:11, Julien Grall wrote: Hi Juergen, On 07/02/2021 12:58, Jürgen Groß wrote: On 06.02.21 19:46, Julien Grall wrote: Hi Juergen, On 06/02/2021 10:49, Juergen Gross wrote: The first three patches are fixes for XSA-332. The avoid WARN

Re: [PATCH 0/7] xen/events: bug fixes and some diagnostic aids

2021-02-08 Thread Julien Grall
Hi Juergen, On 07/02/2021 12:58, Jürgen Groß wrote: On 06.02.21 19:46, Julien Grall wrote: Hi Juergen, On 06/02/2021 10:49, Juergen Gross wrote: The first three patches are fixes for XSA-332. The avoid WARN splats and a performance issue with interdomain events. Thanks for helping to

Re: [PATCH 0/7] xen/events: bug fixes and some diagnostic aids

2021-02-06 Thread Julien Grall
we may want to consider to hold evtchn_rwlock with the write permission. Although, I am not 100% sure this is going to prevent everything. Does my write-up make sense to you? Cheers, -- Julien Grall

Re: [PATCH 1/7] xen/events: reset affinity of 2-level event initially

2021-02-06 Thread Julien Grall
On 06/02/2021 12:09, Jürgen Groß wrote: On 06.02.21 12:20, Julien Grall wrote: Hi Juergen, On 06/02/2021 10:49, Juergen Gross wrote: When creating a new event channel with 2-level events the affinity needs to be reset initially in order to avoid using an old affinity from earlier usage of

Re: [PATCH 1/7] xen/events: reset affinity of 2-level event initially

2021-02-06 Thread Julien Grall
old affinity settings for this vcpu must be reset. As percpu events get initialized before the percpu event channel hook is called, resetting of the affinities happens after offlining a vcpu (this is working, as initial percpu memory is zeroed out). Cc: sta...@vger.kernel.org Reported-by: Julien

Re: [RFC PATCH 1/5] arm64: Move instruction encoder/decoder under lib/

2021-02-03 Thread Julien Thierry
On 2/3/21 12:12 PM, Mark Rutland wrote: On Wed, Feb 03, 2021 at 09:26:45AM +0100, Julien Thierry wrote: On 2/2/21 11:17 AM, Mark Rutland wrote: On Wed, Jan 20, 2021 at 06:17:41PM +0100, Julien Thierry wrote: Aarch64 instruction set encoding and decoding logic can prove useful for some

Re: [RFC PATCH 3/5] arm64: aarch64-insn: Add barrier encodings

2021-02-03 Thread Julien Thierry
On 2/2/21 12:15 PM, Mark Rutland wrote: On Wed, Jan 20, 2021 at 06:17:43PM +0100, Julien Thierry wrote: Create necessary functions to encode/decode aarch64 data/instruction barriers. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/aarch64-insn.h | 9 + 1 file changed, 9

Re: [RFC PATCH 1/5] arm64: Move instruction encoder/decoder under lib/

2021-02-03 Thread Julien Thierry
Hi Mark, On 2/2/21 11:17 AM, Mark Rutland wrote: Hi Julien, On Wed, Jan 20, 2021 at 06:17:41PM +0100, Julien Thierry wrote: Aarch64 instruction set encoding and decoding logic can prove useful for some features/tools both part of the kernel and outside the kernel. Isolate the function

Re: [RFC PATCH 12/17] gcc-plugins: objtool: Add plugin to detect switch table on arm64

2021-02-03 Thread Julien Thierry
On 2/3/21 12:01 AM, Nick Desaulniers wrote: On Tue, Feb 2, 2021 at 12:57 AM Julien Thierry wrote: On 2/2/21 12:17 AM, Nick Desaulniers wrote: On Mon, Feb 1, 2021 at 1:44 PM Josh Poimboeuf wrote: On Fri, Jan 29, 2021 at 10:10:01AM -0800, Nick Desaulniers wrote: On Wed, Jan 27, 2021

Re: [RFC PATCH 12/17] gcc-plugins: objtool: Add plugin to detect switch table on arm64

2021-02-02 Thread Julien Thierry
ge section name to store switch table information, Make plugin Kconfig be selected rather than opt-in by user, Add a relocation in the switch_table_info that points to the jump operation itself] Signed-off-by: Julien Thierry Rather than tightly couple this feature to a

Re: [RFC PATCH 00/17] objtool: add base support for arm64

2021-01-21 Thread Julien Thierry
On 1/21/21 12:08 PM, Ard Biesheuvel wrote: On Thu, 21 Jan 2021 at 11:26, Julien Thierry wrote: Hi Ard, On 1/21/21 10:03 AM, Ard Biesheuvel wrote: Hello Julien, On Wed, 20 Jan 2021 at 18:38, Julien Thierry wrote: Hi, This series enables objtool to start doing stack validation on

Re: [RFC PATCH 00/17] objtool: add base support for arm64

2021-01-21 Thread Julien Thierry
Hi Ard, On 1/21/21 10:03 AM, Ard Biesheuvel wrote: Hello Julien, On Wed, 20 Jan 2021 at 18:38, Julien Thierry wrote: Hi, This series enables objtool to start doing stack validation on arm64 kernel builds. Could we elaborate on this point, please? 'Stack validation' means

[RFC PATCH 15/17] objtool: arm64: Handle supported relocations in alternatives

2021-01-20 Thread Julien Thierry
Based on get_alt_insn() in arch/arm64/kernel/alternative.c, arm64 alternative code adapts offsets for static branches and adrp instructions. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/special.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools

[RFC PATCH 09/17] objtool: arm64: Decode LDR instructions

2021-01-20 Thread Julien Thierry
Load literal instructions can generate constants inside code sections. Record the locations of the constants in order to be able to remove their corresponding "struct instruction". Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c| 86 +

[RFC PATCH 00/17] objtool: add base support for arm64

2021-01-20 Thread Julien Thierry
hanges can be found on top of this branch here: git clone https://github.com/julien-thierry/linux.git -b objtoolxarm64-latest But it would be nice to have some feedback on this before I start submitting everyting. [1] https://lkml.org/lkml/2021/1/20/791 Thanks, Julien --> Julien Thierry

[RFC PATCH 01/17] tools: Add some generic functions and headers

2021-01-20 Thread Julien Thierry
These will be needed to be able to use arm64 instruction decoder in userland tools. Signed-off-by: Julien Thierry --- tools/include/asm-generic/bitops/__ffs.h | 11 +++ tools/include/linux/kernel.h | 21 + tools/include/linux/printk.h | 40

[RFC PATCH 07/17] objtool: arm64: Decode other system instructions

2021-01-20 Thread Julien Thierry
Decode ERET, BRK and NOPs Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/tools/objtool/arch/arm64/decode.c b/tools/objtool/arch/arm64/decode.c index 924121b4b466..a4a587c400a1 100644 --- a/tools/objtool/arch/arm64

[RFC PATCH 05/17] objtool: arm64: Decode add/sub instructions

2021-01-20 Thread Julien Thierry
Decode aarch64 additions and substractions and create stack_ops for instructions interacting with SP or FP. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c | 84 +++ 1 file changed, 84 insertions(+) diff --git a/tools/objtool/arch/arm64/decode.c

[RFC PATCH 03/17] tools: bug: Remove duplicate definition

2021-01-20 Thread Julien Thierry
Under tools, bug.h only defines BUILD_BUG_ON_ZERO() which is already defined in build_bug.h. This prevents a file to include both headers at the same time. Have bug.h include build_bug.h instead. Signed-off-by: Julien Thierry --- tools/include/linux/bug.h | 6 +- 1 file changed, 1

[RFC PATCH 06/17] objtool: arm64: Decode jump and call related instructions

2021-01-20 Thread Julien Thierry
Decode branch, branch and link (aarch64's call) and return instructions. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/tools/objtool/arch/arm64/decode.c b/tools/objtool/arch/arm64/decode.c

[RFC PATCH 02/17] tools: arm64: Make aarch64 instruction decoder available to tools

2021-01-20 Thread Julien Thierry
Add aarch64 encoder/decoder implementation under tools/ as well as the necessary arm64 headers. Signed-off-by: Julien Thierry --- tools/arch/arm64/include/asm/aarch64-insn.h | 551 +++ tools/arch/arm64/lib/aarch64-insn.c | 1425 +++ 2 files changed, 1976 insertions

[RFC PATCH 08/17] objtool: arm64: Decode load/store instructions

2021-01-20 Thread Julien Thierry
the base pointer after the load). Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c | 127 ++ 1 file changed, 127 insertions(+) diff --git a/tools/objtool/arch/arm64/decode.c b/tools/objtool/arch/arm64/decode.c index a4a587c400a1..1087ede67bcd 100644

[RFC PATCH 04/17] objtool: arm64: Add base definition for arm64 backend

2021-01-20 Thread Julien Thierry
Provide needed definitions for a new architecture instruction decoder. No proper decoding is done yet. Signed-off-by: Julien Thierry --- tools/objtool/Makefile| 5 + tools/objtool/arch/arm64/Build| 8 ++ tools/objtool/arch/arm64/decode.c

[RFC PATCH 10/17] objtool: arm64: Accept padding in code sections

2021-01-20 Thread Julien Thierry
The compiler can introduce some '0' words in code sections to pad the end of functions. Similar to load literal functions, record these zero words to remove the "struct instruction" created for them. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/decode.c | 19 ++

[RFC PATCH 12/17] gcc-plugins: objtool: Add plugin to detect switch table on arm64

2021-01-20 Thread Julien Thierry
ge section name to store switch table information, Make plugin Kconfig be selected rather than opt-in by user, Add a relocation in the switch_table_info that points to the jump operation itself] Signed-off-by: Julien Thierry --- arch/arm64/Kconfig

[RFC PATCH 13/17] objtool: arm64: Implement functions to add switch tables alternatives

2021-01-20 Thread Julien Thierry
. Signed-off-by: Raphael Gault [J.T.: Update arch implementation to new prototypes, Update switch table information section name, Do some clean up, Use the offset sign information, Use the newly added rela to find the corresponding jump instruction] Signed-off-by: Julien

[RFC PATCH 16/17] objtool: arm64: Ignore replacement section for alternative callback

2021-01-20 Thread Julien Thierry
ARM64_CB_PATCH doesn't have static replacement instructions. Skip trying to validate the alternative section. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/special.c | 12 tools/objtool/check.c | 3 +++ 2 files changed, 15 insertions(+) diff --

[RFC PATCH 14/17] objtool: arm64: Cache section with switch table information

2021-01-20 Thread Julien Thierry
Section ".discard.switch_table_info", created by the gcc plugin will be looked up for every dynamic jump in the object file while the section might not even exist. Cache the result of the first lookup. Signed-off-by: Julien Thierry --- tools/objtool/arch/arm64/spec

[RFC PATCH 17/17] objtool: arm64: Enable stack validation for arm64

2021-01-20 Thread Julien Thierry
From: Raphael Gault Add build option to run stack validation at compile time. Signed-off-by: Raphael Gault Signed-off-by: Julien Thierry --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 93a320cc8e03..3f297d61b56b 100644

[RFC PATCH 11/17] efi: libstub: Ignore relocations for .discard sections

2021-01-20 Thread Julien Thierry
EFI stub cannot have absolute relocations in sections affecting the execution flow. However, for sections that get discarded at link time, it doesn't really matter if they have absolute relocations. Ignore the relocation associated with such sections. Signed-off-by: Julien Thierry --- dr

Re: Live patching on ARM64

2021-01-20 Thread Julien Thierry
/linux-arm-kernel/20210120173800.1660730-1-jthie...@redhat.com/T/#t There are still some things missing, so if you want to investigate a more complete state I have a branch: $ git clone https://github.com/julien-thierry/linux.git -b objtoolxarm64-latest Let me know if there are any questions rel

[RFC PATCH 4/5] arm64: aarch64-insn: Add some opcodes to instruction decoder

2021-01-20 Thread Julien Thierry
Add decoding capability for some instructions that objtool will need to decode. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/aarch64-insn.h | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/arm64/include/asm/aarch64-insn.h b/arch/arm64/include/asm/aarch64-insn.h

[RFC PATCH 5/5] arm64: Add load/store decoding helpers

2021-01-20 Thread Julien Thierry
Provide some function to group different load/store instructions. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/aarch64-insn.h | 28 +++ 1 file changed, 28 insertions(+) diff --git a/arch/arm64/include/asm/aarch64-insn.h b/arch/arm64/include/asm/aarch64

[RFC PATCH 0/5] arm64: Prepare instruction decoder for objtool

2021-01-20 Thread Julien Thierry
ortly. Thanks, Julien --> Julien Thierry (5): arm64: Move instruction encoder/decoder under lib/ arm64: aarch64-insn: Add SVE instruction class arm64: aarch64-insn: Add barrier encodings arm64: aarch64-insn: Add some opcodes to instruction decoder arm64: Add load/store decoding helper

[RFC PATCH 1/5] arm64: Move instruction encoder/decoder under lib/

2021-01-20 Thread Julien Thierry
. Code was only moved, no code should have been added, removed nor modifier. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/aarch64-insn.h | 505 +++ arch/arm64/include/asm/alternative-macros.h |3 - arch/arm64/include/asm/alternative.h|1 + arch/arm64/include

[RFC PATCH 2/5] arm64: aarch64-insn: Add SVE instruction class

2021-01-20 Thread Julien Thierry
SVE has been public for some time now. Let the decoder acknowledge its existence. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/aarch64-insn.h | 1 + arch/arm64/lib/aarch64-insn.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm

[RFC PATCH 3/5] arm64: aarch64-insn: Add barrier encodings

2021-01-20 Thread Julien Thierry
Create necessary functions to encode/decode aarch64 data/instruction barriers. Signed-off-by: Julien Thierry --- arch/arm64/include/asm/aarch64-insn.h | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/arm64/include/asm/aarch64-insn.h b/arch/arm64/include/asm/aarch64-insn.h

Re: Live patching on ARM64

2021-01-19 Thread Julien Thierry
Hi Madhavan, On 1/17/21 6:25 PM, Madhavan T. Venkataraman wrote: On 1/15/21 6:33 AM, Mark Rutland wrote: It looks like the most recent work in this area has been from the following folks: Mark Brown and Mark Rutland: Kernel changes to providing reliable stack traces. Julien

[tip: objtool/core] objtool: Make SP memory operation match PUSH/POP semantics

2021-01-18 Thread tip-bot2 for Julien Thierry
The following commit has been merged into the objtool/core branch of tip: Commit-ID: 201ef5a974e24112953b74cc9f33dcfc4cbcc1cb Gitweb: https://git.kernel.org/tip/201ef5a974e24112953b74cc9f33dcfc4cbcc1cb Author:Julien Thierry AuthorDate:Wed, 14 Oct 2020 08:38:02 +01:00

[tip: objtool/core] objtool: Fully validate the stack frame

2021-01-18 Thread tip-bot2 for Julien Thierry
The following commit has been merged into the objtool/core branch of tip: Commit-ID: fb084fde0c8106bc86df243411751c3421c07c08 Gitweb: https://git.kernel.org/tip/fb084fde0c8106bc86df243411751c3421c07c08 Author:Julien Thierry AuthorDate:Wed, 14 Oct 2020 08:38:00 +01:00

[tip: objtool/core] objtool: Support addition to set CFA base

2021-01-18 Thread tip-bot2 for Julien Thierry
The following commit has been merged into the objtool/core branch of tip: Commit-ID: 468af56a7bbaa626da5a4578bedc930d731fba13 Gitweb: https://git.kernel.org/tip/468af56a7bbaa626da5a4578bedc930d731fba13 Author:Julien Thierry AuthorDate:Wed, 14 Oct 2020 08:38:01 +01:00

Re: xen/evtchn: Interrupt for port 34, but apparently not enabled; per-user 00000000a86a4c1b on 5.10

2020-12-23 Thread Julien Grall
Hi Juergen, On 15/12/2020 10:20, Jürgen Groß wrote: On 15.12.20 08:27, Jürgen Groß wrote: On 14.12.20 22:25, Julien Grall wrote: Hi Juergen, When testing Linux 5.10 dom0, I could reliably hit the following warning with using event 2L ABI: [  589.591737] Interrupt for port 34, but

Re: xen/evtchn: Interrupt for port 34, but apparently not enabled; per-user 00000000a86a4c1b on 5.10

2020-12-18 Thread Julien Grall
Hi Juergen, On 15/12/2020 10:20, Jürgen Groß wrote: On 15.12.20 08:27, Jürgen Groß wrote: On 14.12.20 22:25, Julien Grall wrote: Hi Juergen, When testing Linux 5.10 dom0, I could reliably hit the following warning with using event 2L ABI: [  589.591737] Interrupt for port 34, but

xen/evtchn: Interrupt for port 34, but apparently not enabled; per-user 00000000a86a4c1b on 5.10

2020-12-14 Thread Julien Grall
enough because I haven't found anything yet preventing a race between evtchn_2l_handle_events9) and evtchn_2l_bind_vcpu(). So maybe we want to introduce a refcounting (if there is nothing provided by the IRQ framework) and only unmask when the counter drop to 0. Any opinions? Cheers,

[PATCH v3 0/3] objtool: Extend CFA updating/checking

2020-10-14 Thread Julien Thierry
BP and return address [1] https://lkml.org/lkml/2020/9/28/354 Thanks, Julien Julien Thierry (3): objtool: check: Fully validate the stack frame objtool: check: Support addition to set CFA base objtool: check: Make SP memory operation match PUSH/POP semantics tools/objtool/check.c | 46

[PATCH v3 1/3] objtool: check: Fully validate the stack frame

2020-10-14 Thread Julien Thierry
verify a function properly sets up all the elements of the stack frame. Signed-off-by: Julien Thierry --- tools/objtool/check.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index f50ffa243c72..87f10e726a75 100644

[PATCH v3 3/3] objtool: check: Make SP memory operation match PUSH/POP semantics

2020-10-14 Thread Julien Thierry
Architectures without PUSH/POP instructions will always access the stack though memory operations (SRC/DEST_INDIRECT). Make those operations have the same effect on the CFA as PUSH/POP, with no stack pointer modification. Signed-off-by: Julien Thierry --- tools/objtool/check.c | 20

[PATCH v3 2/3] objtool: check: Support addition to set CFA base

2020-10-14 Thread Julien Thierry
instruction. Signed-off-by: Julien Thierry --- tools/objtool/check.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 87f10e726a75..815aeb770930 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1898,6 +1898,17 @@ static

Re: [PATCH v2 1/3] objtool: check: Fully validate the stack frame

2020-10-13 Thread Julien Thierry
On 10/12/20 4:35 PM, Josh Poimboeuf wrote: On Mon, Oct 12, 2020 at 11:21:49AM +0100, Julien Thierry wrote: On 9/29/20 8:18 PM, Josh Poimboeuf wrote: "Stack frame" has more than one meaning now, I suppose. i.e. it could also include the callee-saved registers and any other s

Re: [PATCH v2 1/3] objtool: check: Fully validate the stack frame

2020-10-12 Thread Julien Thierry
On 9/29/20 8:18 PM, Josh Poimboeuf wrote: On Mon, Sep 28, 2020 at 10:36:29AM +0100, Julien Thierry wrote: +++ b/tools/objtool/arch/x86/include/cfi_regs.h @@ -22,4 +22,7 @@ #define CFI_RA16 #define CFI_NUM_REGS 17 A few more naming nitpicks: +#define

Re: [PATCH] arm/arm64: xen: Fix to convert percpu address to gfn correctly

2020-10-05 Thread Julien Grall
define gfn_to_virt(m)(__va(gfn_to_pfn(m) << XEN_PAGE_SHIFT)) +#define percpu_to_gfn(v) \ + (pfn_to_gfn(per_cpu_ptr_to_phys(v) >> XEN_PAGE_SHIFT)) + /* Only used in PV code. But ARM guests are always HVM. */ static inline xmaddr_t arbitrary_virt_to_machine(void *vaddr) { Cheers, -- Julien Grall

[PATCH v2 3/3] objtool: check: Make SP memory operation match PUSH/POP semantics

2020-09-28 Thread Julien Thierry
Architectures without PUSH/POP instructions will always access the stack though memory operations (SRC/DEST_INDIRECT). Make those operations have the same effect on the CFA as PUSH/POP, with no stack pointer modification. Signed-off-by: Julien Thierry --- tools/objtool/check.c | 20

[PATCH v2 1/3] objtool: check: Fully validate the stack frame

2020-09-28 Thread Julien Thierry
verify a function properly sets up all the elements of the stack frame. Signed-off-by: Julien Thierry --- tools/objtool/arch/x86/include/cfi_regs.h | 3 +++ tools/objtool/cfi.h | 2 ++ tools/objtool/check.c | 21 + 3 files changed, 22

[PATCH v2 2/3] objtool: check: Support addition to set CFA base

2020-09-28 Thread Julien Thierry
instruction. Signed-off-by: Julien Thierry --- tools/objtool/check.c | 13 + 1 file changed, 13 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 50b3a4504db1..9f7a14a24a65 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1901,6 +1901,19

[PATCH v2 0/3] objtool: Extend CFA updating/checking

2020-09-28 Thread Julien Thierry
discussion with Josh [1] https://www.spinics.net/lists/kernel/msg3662146.html Thanks, Julien --> Julien Thierry (3): objtool: check: Fully validate the stack frame objtool: check: Support addition to set CFA base objtool: check: Make SP memory operation match PUSH/POP semantics to

[tip: objtool/core] objtool: Ignore unreachable fake jumps

2020-09-21 Thread tip-bot2 for Julien Thierry
The following commit has been merged into the objtool/core branch of tip: Commit-ID: fb136219f0e2b417d84e67b2a3adc1f933997d04 Gitweb: https://git.kernel.org/tip/fb136219f0e2b417d84e67b2a3adc1f933997d04 Author:Julien Thierry AuthorDate:Tue, 15 Sep 2020 08:53:17 +01:00

[tip: objtool/core] objtool: Remove useless tests before save_reg()

2020-09-21 Thread tip-bot2 for Julien Thierry
The following commit has been merged into the objtool/core branch of tip: Commit-ID: f4f803984c3685f416a74e9e2fa7d39bdafbe02b Gitweb: https://git.kernel.org/tip/f4f803984c3685f416a74e9e2fa7d39bdafbe02b Author:Julien Thierry AuthorDate:Tue, 15 Sep 2020 08:53:16 +01:00

[tip: objtool/core] objtool: Handle calling non-function symbols in other sections

2020-09-21 Thread tip-bot2 for Julien Thierry
The following commit has been merged into the objtool/core branch of tip: Commit-ID: 2b232a22d8225df419a92ca69ddeeb4e5fe902f7 Gitweb: https://git.kernel.org/tip/2b232a22d8225df419a92ca69ddeeb4e5fe902f7 Author:Julien Thierry AuthorDate:Tue, 15 Sep 2020 08:53:18 +01:00

Re: [PATCH 1/3] objtool: check: Fully validate the stack frame

2020-09-21 Thread Julien Thierry
On 9/18/20 9:56 PM, Josh Poimboeuf wrote: On Tue, Sep 15, 2020 at 09:12:02AM +0100, Julien Thierry wrote: A valid stack frame should contain both the return address and the previous frame pointer value. On x86, the return value is placed on the stack by the calling instructions. On other

Re: [PATCH 3/3] objtool: check: Make SP memory operation match PUSH/POP semantics

2020-09-21 Thread Julien Thierry
On 9/18/20 10:43 PM, Josh Poimboeuf wrote: On Tue, Sep 15, 2020 at 09:12:04AM +0100, Julien Thierry wrote: Architectures without PUSH/POP instructions will always access the stack though memory operations (SRC/DEST_INDIRECT). Make those operations have the same effect on the CFA as PUSH/POP

  1   2   3   4   5   6   7   8   9   10   >