linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/10] Make check implementation arch agnostic
@ 2020-09-04 15:27 Julien Thierry
  2020-09-04 15:27 ` [PATCH v3 01/10] objtool: Group headers to check in a single list Julien Thierry
  2020-09-04 15:36 ` [PATCH v3 00/10] Make check implementation arch agnostic Julien Thierry
  0 siblings, 2 replies; 4+ messages in thread
From: Julien Thierry @ 2020-09-04 15:27 UTC (permalink / raw)
  To: linux-kernel
  Cc: jpoimboe, peterz, mbenes, raphael.gault, benh, Julien Thierry

Hi,

The current implementation of the check subcommand has various x86 bits
here and there. In order to prepare objtool to provide check for other
architectures, add some abstraction over the x86 specific bits, relying
on objtool arch specific code to provide some necessary operations.

This is part of the effort to implement check for arm64, initiated [1]
by Raphael. The series is based on top of the separation of check & orc
subcommands series[2].

I've push both series base on top of tip/objtool/core at [3].

- The first two patches make it simpler for new arches to provide their
list of kernel headers, without worrying about modifications in the x86
headers.
- Patch 3 Moves arch specific macros to more suitable location
- Patches 4 and 5 add abstraction to handle alternatives
- Patch 6 adds abstraction to handle jump table
- Patches 7-10 makes unwind hint definitions shared across architectures

Changes since v2 [4]:
- Rebased on v5.9-rc1
- Under tools/objtool/arch/x86/, rename arch_special.c to special.c
- Rename include/linux/frame.h to inclide/linux/objtool.h
- Share unwind hint types across architectures

[1] https://lkml.org/lkml/2019/8/16/400
[2] https://lkml.org/lkml/2020/6/4/675
[3] https://github.com/julien-thierry/linux/tree/arch-independent-check
[4] https://lkml.org/lkml/2020/7/30/424

Cheers,

Julien

-->

Julien Thierry (9):
  objtool: Group headers to check in a single list
  objtool: Make sync-check consider the target architecture
  objtool: Move macros describing structures to arch-dependent code
  objtool: Abstract alternative special case handling
  objtool: Make relocation in alternative handling arch dependent
  headers: Rename frame.h
  objtool: Only include valid definitions depending on source file type
  objtool: Make unwind hints definitions available to other
    architectures
  objtool: Decode unwind hint register depending on architecture

Raphael Gault (1):
  objtool: Refactor switch-tables code to support other architectures

 arch/x86/include/asm/nospec-branch.h          |   2 +-
 arch/x86/include/asm/orc_types.h              |  34 ----
 arch/x86/include/asm/unwind_hints.h           |  50 +-----
 arch/x86/kernel/kprobes/core.c                |   2 +-
 arch/x86/kernel/kprobes/opt.c                 |   2 +-
 arch/x86/kernel/reboot.c                      |   2 +-
 arch/x86/kernel/unwind_orc.c                  |  11 +-
 arch/x86/kvm/svm/svm.c                        |   2 +-
 arch/x86/kvm/vmx/nested.c                     |   2 +-
 arch/x86/kvm/vmx/vmx.c                        |   2 +-
 arch/x86/xen/enlighten_pv.c                   |   2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c           |   3 +-
 include/linux/frame.h                         |  35 -----
 include/linux/objtool.h                       | 134 ++++++++++++++++
 kernel/bpf/core.c                             |   2 +-
 kernel/kexec_core.c                           |   2 +-
 tools/arch/x86/include/asm/orc_types.h        |  34 ----
 tools/include/linux/objtool.h                 | 134 ++++++++++++++++
 tools/objtool/Makefile                        |   2 +-
 tools/objtool/arch.h                          |   2 +
 tools/objtool/arch/x86/Build                  |   1 +
 tools/objtool/arch/x86/decode.c               |  37 +++++
 tools/objtool/arch/x86/include/arch_special.h |  20 +++
 tools/objtool/arch/x86/special.c              | 145 ++++++++++++++++++
 tools/objtool/check.c                         | 137 ++---------------
 tools/objtool/check.h                         |   7 +-
 tools/objtool/objtool.h                       |   2 +
 tools/objtool/orc_dump.c                      |   7 +-
 tools/objtool/orc_gen.c                       |   5 +-
 tools/objtool/special.c                       |  48 +-----
 tools/objtool/special.h                       |  10 ++
 tools/objtool/sync-check.sh                   |  27 ++--
 tools/objtool/weak.c                          |   2 -
 33 files changed, 561 insertions(+), 346 deletions(-)
 delete mode 100644 include/linux/frame.h
 create mode 100644 include/linux/objtool.h
 create mode 100644 tools/include/linux/objtool.h
 create mode 100644 tools/objtool/arch/x86/include/arch_special.h
 create mode 100644 tools/objtool/arch/x86/special.c

--
2.21.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 01/10] objtool: Group headers to check in a single list
  2020-09-04 15:27 [PATCH v3 00/10] Make check implementation arch agnostic Julien Thierry
@ 2020-09-04 15:27 ` Julien Thierry
  2020-09-04 15:36 ` [PATCH v3 00/10] Make check implementation arch agnostic Julien Thierry
  1 sibling, 0 replies; 4+ messages in thread
From: Julien Thierry @ 2020-09-04 15:27 UTC (permalink / raw)
  To: linux-kernel
  Cc: jpoimboe, peterz, mbenes, raphael.gault, benh, Julien Thierry

In order to support multiple architectures and potentially different
sets of header to compare against their kernel equivalent, it is simpler
to have all headers to check in a single list.

Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Julien Thierry <jthierry@redhat.com>
---
 tools/objtool/sync-check.sh | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/tools/objtool/sync-check.sh b/tools/objtool/sync-check.sh
index 2a1261bfbb62..c9674877419c 100755
--- a/tools/objtool/sync-check.sh
+++ b/tools/objtool/sync-check.sh
@@ -1,13 +1,17 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 
-FILES='
+FILES="
 arch/x86/include/asm/inat_types.h
 arch/x86/include/asm/orc_types.h
 arch/x86/include/asm/emulate_prefix.h
 arch/x86/lib/x86-opcode-map.txt
 arch/x86/tools/gen-insn-attr-x86.awk
-'
+arch/x86/include/asm/inat.h     -I '^#include [\"<]\(asm/\)*inat_types.h[\">]'
+arch/x86/include/asm/insn.h     -I '^#include [\"<]\(asm/\)*inat.h[\">]'
+arch/x86/lib/inat.c             -I '^#include [\"<]\(../include/\)*asm/insn.h[\">]'
+arch/x86/lib/insn.c             -I '^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]' -I '^#include [\"<]\(../include/\)*asm/emulate_prefix.h[\">]'
+"
 
 check_2 () {
   file1=$1
@@ -40,11 +44,10 @@ fi
 
 cd ../..
 
-for i in $FILES; do
-  check $i
-done
+while read -r file_entry; do
+    if [ -z "$file_entry" ]; then
+	continue
+    fi
 
-check arch/x86/include/asm/inat.h     '-I "^#include [\"<]\(asm/\)*inat_types.h[\">]"'
-check arch/x86/include/asm/insn.h     '-I "^#include [\"<]\(asm/\)*inat.h[\">]"'
-check arch/x86/lib/inat.c             '-I "^#include [\"<]\(../include/\)*asm/insn.h[\">]"'
-check arch/x86/lib/insn.c             '-I "^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]" -I "^#include [\"<]\(../include/\)*asm/emulate_prefix.h[\">]"'
+    check $file_entry
+done <<< "$FILES"
-- 
2.21.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 00/10] Make check implementation arch agnostic
  2020-09-04 15:27 [PATCH v3 00/10] Make check implementation arch agnostic Julien Thierry
  2020-09-04 15:27 ` [PATCH v3 01/10] objtool: Group headers to check in a single list Julien Thierry
@ 2020-09-04 15:36 ` Julien Thierry
  1 sibling, 0 replies; 4+ messages in thread
From: Julien Thierry @ 2020-09-04 15:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: jpoimboe, peterz, mbenes, raphael.gault, benh

Hi,

Apologies again about the duplicate. It seems like I have issues sending 
batched emails...

This thread can be ignored.

On 9/4/20 4:27 PM, Julien Thierry wrote:
> Hi,
> 
> The current implementation of the check subcommand has various x86 bits
> here and there. In order to prepare objtool to provide check for other
> architectures, add some abstraction over the x86 specific bits, relying
> on objtool arch specific code to provide some necessary operations.
> 
> This is part of the effort to implement check for arm64, initiated [1]
> by Raphael. The series is based on top of the separation of check & orc
> subcommands series[2].
> 
> I've push both series base on top of tip/objtool/core at [3].
> 
> - The first two patches make it simpler for new arches to provide their
> list of kernel headers, without worrying about modifications in the x86
> headers.
> - Patch 3 Moves arch specific macros to more suitable location
> - Patches 4 and 5 add abstraction to handle alternatives
> - Patch 6 adds abstraction to handle jump table
> - Patches 7-10 makes unwind hint definitions shared across architectures
> 
> Changes since v2 [4]:
> - Rebased on v5.9-rc1
> - Under tools/objtool/arch/x86/, rename arch_special.c to special.c
> - Rename include/linux/frame.h to inclide/linux/objtool.h
> - Share unwind hint types across architectures
> 
> [1] https://lkml.org/lkml/2019/8/16/400
> [2] https://lkml.org/lkml/2020/6/4/675
> [3] https://github.com/julien-thierry/linux/tree/arch-independent-check
> [4] https://lkml.org/lkml/2020/7/30/424
> 
> Cheers,
> 
> Julien
> 
> -->
> 
> Julien Thierry (9):
>    objtool: Group headers to check in a single list
>    objtool: Make sync-check consider the target architecture
>    objtool: Move macros describing structures to arch-dependent code
>    objtool: Abstract alternative special case handling
>    objtool: Make relocation in alternative handling arch dependent
>    headers: Rename frame.h
>    objtool: Only include valid definitions depending on source file type
>    objtool: Make unwind hints definitions available to other
>      architectures
>    objtool: Decode unwind hint register depending on architecture
> 
> Raphael Gault (1):
>    objtool: Refactor switch-tables code to support other architectures
> 
>   arch/x86/include/asm/nospec-branch.h          |   2 +-
>   arch/x86/include/asm/orc_types.h              |  34 ----
>   arch/x86/include/asm/unwind_hints.h           |  50 +-----
>   arch/x86/kernel/kprobes/core.c                |   2 +-
>   arch/x86/kernel/kprobes/opt.c                 |   2 +-
>   arch/x86/kernel/reboot.c                      |   2 +-
>   arch/x86/kernel/unwind_orc.c                  |  11 +-
>   arch/x86/kvm/svm/svm.c                        |   2 +-
>   arch/x86/kvm/vmx/nested.c                     |   2 +-
>   arch/x86/kvm/vmx/vmx.c                        |   2 +-
>   arch/x86/xen/enlighten_pv.c                   |   2 +-
>   drivers/gpu/drm/vmwgfx/vmwgfx_msg.c           |   3 +-
>   include/linux/frame.h                         |  35 -----
>   include/linux/objtool.h                       | 134 ++++++++++++++++
>   kernel/bpf/core.c                             |   2 +-
>   kernel/kexec_core.c                           |   2 +-
>   tools/arch/x86/include/asm/orc_types.h        |  34 ----
>   tools/include/linux/objtool.h                 | 134 ++++++++++++++++
>   tools/objtool/Makefile                        |   2 +-
>   tools/objtool/arch.h                          |   2 +
>   tools/objtool/arch/x86/Build                  |   1 +
>   tools/objtool/arch/x86/decode.c               |  37 +++++
>   tools/objtool/arch/x86/include/arch_special.h |  20 +++
>   tools/objtool/arch/x86/special.c              | 145 ++++++++++++++++++
>   tools/objtool/check.c                         | 137 ++---------------
>   tools/objtool/check.h                         |   7 +-
>   tools/objtool/objtool.h                       |   2 +
>   tools/objtool/orc_dump.c                      |   7 +-
>   tools/objtool/orc_gen.c                       |   5 +-
>   tools/objtool/special.c                       |  48 +-----
>   tools/objtool/special.h                       |  10 ++
>   tools/objtool/sync-check.sh                   |  27 ++--
>   tools/objtool/weak.c                          |   2 -
>   33 files changed, 561 insertions(+), 346 deletions(-)
>   delete mode 100644 include/linux/frame.h
>   create mode 100644 include/linux/objtool.h
>   create mode 100644 tools/include/linux/objtool.h
>   create mode 100644 tools/objtool/arch/x86/include/arch_special.h
>   create mode 100644 tools/objtool/arch/x86/special.c
> 
> --
> 2.21.3
> 

-- 
Julien Thierry


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 01/10] objtool: Group headers to check in a single list
  2020-09-04 15:30 Julien Thierry
@ 2020-09-04 15:30 ` Julien Thierry
  0 siblings, 0 replies; 4+ messages in thread
From: Julien Thierry @ 2020-09-04 15:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: jpoimboe, peterz, mbenes, raphael.gault, benh, Julien Thierry

In order to support multiple architectures and potentially different
sets of header to compare against their kernel equivalent, it is simpler
to have all headers to check in a single list.

Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Julien Thierry <jthierry@redhat.com>
---
 tools/objtool/sync-check.sh | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/tools/objtool/sync-check.sh b/tools/objtool/sync-check.sh
index 2a1261bfbb62..c9674877419c 100755
--- a/tools/objtool/sync-check.sh
+++ b/tools/objtool/sync-check.sh
@@ -1,13 +1,17 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 
-FILES='
+FILES="
 arch/x86/include/asm/inat_types.h
 arch/x86/include/asm/orc_types.h
 arch/x86/include/asm/emulate_prefix.h
 arch/x86/lib/x86-opcode-map.txt
 arch/x86/tools/gen-insn-attr-x86.awk
-'
+arch/x86/include/asm/inat.h     -I '^#include [\"<]\(asm/\)*inat_types.h[\">]'
+arch/x86/include/asm/insn.h     -I '^#include [\"<]\(asm/\)*inat.h[\">]'
+arch/x86/lib/inat.c             -I '^#include [\"<]\(../include/\)*asm/insn.h[\">]'
+arch/x86/lib/insn.c             -I '^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]' -I '^#include [\"<]\(../include/\)*asm/emulate_prefix.h[\">]'
+"
 
 check_2 () {
   file1=$1
@@ -40,11 +44,10 @@ fi
 
 cd ../..
 
-for i in $FILES; do
-  check $i
-done
+while read -r file_entry; do
+    if [ -z "$file_entry" ]; then
+	continue
+    fi
 
-check arch/x86/include/asm/inat.h     '-I "^#include [\"<]\(asm/\)*inat_types.h[\">]"'
-check arch/x86/include/asm/insn.h     '-I "^#include [\"<]\(asm/\)*inat.h[\">]"'
-check arch/x86/lib/inat.c             '-I "^#include [\"<]\(../include/\)*asm/insn.h[\">]"'
-check arch/x86/lib/insn.c             '-I "^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]" -I "^#include [\"<]\(../include/\)*asm/emulate_prefix.h[\">]"'
+    check $file_entry
+done <<< "$FILES"
-- 
2.21.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-04 15:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 15:27 [PATCH v3 00/10] Make check implementation arch agnostic Julien Thierry
2020-09-04 15:27 ` [PATCH v3 01/10] objtool: Group headers to check in a single list Julien Thierry
2020-09-04 15:36 ` [PATCH v3 00/10] Make check implementation arch agnostic Julien Thierry
2020-09-04 15:30 Julien Thierry
2020-09-04 15:30 ` [PATCH v3 01/10] objtool: Group headers to check in a single list Julien Thierry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).