All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL] objtool changes for v5.19
@ 2022-05-23 16:32 Ingo Molnar
  2022-05-24  5:34 ` Ingo Molnar
  2022-05-24 19:53 ` pr-tracker-bot
  0 siblings, 2 replies; 7+ messages in thread
From: Ingo Molnar @ 2022-05-23 16:32 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Josh Poimboeuf, Thomas Gleixner,
	Borislav Petkov, Andrew Morton

Linus,

Please pull the latest objtool/core git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git objtool-core-2022-05-23

   # HEAD: 22682a07acc308ef78681572e19502ce8893c4d4 objtool: Fix objtool regression on x32 systems

Objtool changes for this cycle were:

 - Comprehensive interface overhaul:
   =================================

   Objtool's interface has some issues:

     - Several features are done unconditionally, without any way to turn
       them off.  Some of them might be surprising.  This makes objtool
       tricky to use, and prevents porting individual features to other
       arches.

     - The config dependencies are too coarse-grained.  Objtool enablement is
       tied to CONFIG_STACK_VALIDATION, but it has several other features
       independent of that.

     - The objtool subcmds ("check" and "orc") are clumsy: "check" is really
       a subset of "orc", so it has all the same options.  The subcmd model
       has never really worked for objtool, as it only has a single purpose:
       "do some combination of things on an object file".

     - The '--lto' and '--vmlinux' options are nonsensical and have
       surprising behavior.

   Overhaul the interface:

      - get rid of subcmds

      - make all features individually selectable

      - remove and/or clarify confusing/obsolete options

      - update the documentation

      - fix some bugs found along the way

 - Fix x32 regression

 - Fix Kbuild cleanup bugs

 - Add scripts/objdump-func helper script to disassemble a single function from an object file.

 - Rewrite scripts/faddr2line to be section-aware, by basing it on 'readelf',
   moving it away from 'nm', which doesn't handle multiple sections well,
   which can result in decoding failure.

 - Rewrite & fix symbol handling - which had a number of bugs wrt. object files
   that don't have global symbols - which is rare but possible. Also fix a
   bunch of symbol handling bugs found along the way.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
 Thanks,

	Ingo

------------------>
Borislav Petkov (1):
      x86/cpu: Load microcode during restore_processor_state()

Dmitry Monakhov (1):
      x86/unwind/orc: Recheck address range after stack info was updated

Josh Poimboeuf (27):
      MAINTAINERS: Add x86 unwinding entry
      objtool: Enable unreachable warnings for CLANG LTO
      x86/static_call: Add ANNOTATE_NOENDBR to static call trampoline
      x86/retpoline: Add ANNOTATE_NOENDBR for retpolines
      x86/uaccess: Add ENDBR to __put_user_nocheck*()
      x86/xen: Add ANNOTATE_NOENDBR to startup_xen()
      objtool: Print data address for "!ENDBR" data warnings
      objtool: Use offstr() to print address of missing ENDBR
      libsubcmd: Fix OPTION_GROUP sorting
      objtool: Reorganize cmdline options
      objtool: Ditch subcommands
      objtool: Don't print parentheses in function addresses
      objtool: Add option to print section addresses
      objtool: Make stack validation optional
      objtool: Rework ibt and extricate from stack validation
      objtool: Extricate sls from stack validation
      objtool: Add CONFIG_OBJTOOL
      objtool: Make stack validation frame-pointer-specific
      objtool: Make static call annotation optional
      objtool: Make jump label hack optional
      objtool: Make noinstr hacks optional
      objtool: Rename "VMLINUX_VALIDATION" -> "NOINSTR_VALIDATION"
      objtool: Add HAVE_NOINSTR_VALIDATION
      objtool: Remove --lto and --vmlinux in favor of --link
      objtool: Update documentation
      scripts: Create objdump-func helper script
      scripts/faddr2line: Fix overlapping text section failures

Mikulas Patocka (1):
      objtool: Fix objtool regression on x32 systems

Nur Hussein (1):
      x86/Kconfig: fix the spelling of 'becoming' in X86_KERNEL_IBT config

Peter Zijlstra (5):
      lib/strn*,objtool: Enforce user_access_begin() rules
      x86,xen,objtool: Add UNWIND hint
      x86,objtool: Mark cpu_startup_entry() __noreturn
      x86,objtool: Explicitly mark idtentry_body()s tail REACHABLE
      objtool: Fix symbol creation

Tiezhu Yang (2):
      objtool: Remove inat-tables.c when make clean
      objtool: Remove libsubcmd.a when make clean

Tony Luck (1):
      x86/cpu: Add new Alderlake and Raptorlake CPU model numbers


 MAINTAINERS                                        |   9 +
 Makefile                                           |   2 +-
 arch/Kconfig                                       |  18 +-
 arch/x86/Kconfig                                   |  23 +-
 arch/x86/Kconfig.debug                             |   2 +-
 arch/x86/entry/entry_64.S                          |   3 +
 arch/x86/include/asm/intel-family.h                |   3 +
 arch/x86/include/asm/jump_label.h                  |   6 +-
 arch/x86/include/asm/microcode.h                   |   2 +
 arch/x86/include/asm/static_call.h                 |   1 +
 arch/x86/kernel/alternative.c                      |   6 +-
 arch/x86/kernel/cpu/microcode/core.c               |   6 +-
 arch/x86/kernel/unwind_orc.c                       |   8 +-
 arch/x86/lib/putuser.S                             |   4 +
 arch/x86/lib/retpoline.S                           |   2 +-
 arch/x86/platform/pvh/head.S                       |   1 +
 arch/x86/power/cpu.c                               |  10 +-
 arch/x86/xen/xen-head.S                            |   1 +
 include/linux/compiler.h                           |   6 +-
 include/linux/cpu.h                                |   2 +-
 include/linux/instrumentation.h                    |   6 +-
 include/linux/objtool.h                            |   6 +-
 kernel/trace/Kconfig                               |   1 +
 lib/Kconfig.debug                                  |  22 +-
 lib/Kconfig.kcsan                                  |   4 +-
 lib/Kconfig.ubsan                                  |   2 +-
 lib/strncpy_from_user.c                            |   2 +-
 lib/strnlen_user.c                                 |   2 +-
 scripts/Makefile.build                             |  23 +-
 scripts/faddr2line                                 | 150 ++++---
 scripts/link-vmlinux.sh                            |  66 +--
 scripts/objdump-func                               |  29 ++
 scripts/package/builddeb                           |   2 +-
 tools/include/linux/objtool.h                      |   6 +-
 tools/lib/subcmd/parse-options.c                   |  17 +-
 tools/objtool/Build                                |  12 +-
 .../{stack-validation.txt => objtool.txt}          | 122 +++++-
 tools/objtool/Makefile                             |  10 +-
 tools/objtool/arch/x86/decode.c                    |   2 +-
 tools/objtool/arch/x86/special.c                   |   2 +-
 tools/objtool/builtin-check.c                      | 156 +++++--
 tools/objtool/builtin-orc.c                        |  73 ----
 tools/objtool/check.c                              | 466 +++++++++++----------
 tools/objtool/elf.c                                | 211 ++++++----
 tools/objtool/include/objtool/builtin.h            |  34 +-
 tools/objtool/include/objtool/elf.h                |  16 +-
 tools/objtool/include/objtool/warn.h               |  35 +-
 tools/objtool/objtool.c                            | 103 +----
 tools/objtool/weak.c                               |   9 +-
 49 files changed, 1004 insertions(+), 700 deletions(-)
 create mode 100755 scripts/objdump-func
 rename tools/objtool/Documentation/{stack-validation.txt => objtool.txt} (80%)
 delete mode 100644 tools/objtool/builtin-orc.c


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

* Re: [GIT PULL] objtool changes for v5.19
  2022-05-23 16:32 [GIT PULL] objtool changes for v5.19 Ingo Molnar
@ 2022-05-24  5:34 ` Ingo Molnar
  2022-05-24  6:02   ` Ingo Molnar
  2022-05-24 19:53 ` pr-tracker-bot
  1 sibling, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2022-05-24  5:34 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Josh Poimboeuf, Thomas Gleixner,
	Borislav Petkov, Andrew Morton


* Ingo Molnar <mingo@kernel.org> wrote:

> Linus,
> 
> Please pull the latest objtool/core git tree from:
> 
>    git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git objtool-core-2022-05-23
> 
>    # HEAD: 22682a07acc308ef78681572e19502ce8893c4d4 objtool: Fix objtool regression on x32 systems
> 
> Objtool changes for this cycle were:
> 
>  - Comprehensive interface overhaul:
>    =================================
> 
>    Objtool's interface has some issues:
> 
>      - Several features are done unconditionally, without any way to turn
>        them off.  Some of them might be surprising.  This makes objtool
>        tricky to use, and prevents porting individual features to other
>        arches.
> 
>      - The config dependencies are too coarse-grained.  Objtool enablement is
>        tied to CONFIG_STACK_VALIDATION, but it has several other features
>        independent of that.
> 
>      - The objtool subcmds ("check" and "orc") are clumsy: "check" is really
>        a subset of "orc", so it has all the same options.  The subcmd model
>        has never really worked for objtool, as it only has a single purpose:
>        "do some combination of things on an object file".
> 
>      - The '--lto' and '--vmlinux' options are nonsensical and have
>        surprising behavior.
> 
>    Overhaul the interface:
> 
>       - get rid of subcmds
> 
>       - make all features individually selectable
> 
>       - remove and/or clarify confusing/obsolete options
> 
>       - update the documentation
> 
>       - fix some bugs found along the way
> 
>  - Fix x32 regression
> 
>  - Fix Kbuild cleanup bugs
> 
>  - Add scripts/objdump-func helper script to disassemble a single function from an object file.
> 
>  - Rewrite scripts/faddr2line to be section-aware, by basing it on 'readelf',
>    moving it away from 'nm', which doesn't handle multiple sections well,
>    which can result in decoding failure.
> 
>  - Rewrite & fix symbol handling - which had a number of bugs wrt. object files
>    that don't have global symbols - which is rare but possible. Also fix a
>    bunch of symbol handling bugs found along the way.
> 
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
>  Thanks,
> 
> 	Ingo
> 
> ------------------>
> Borislav Petkov (1):
>       x86/cpu: Load microcode during restore_processor_state()
> 
> Dmitry Monakhov (1):
>       x86/unwind/orc: Recheck address range after stack info was updated
> 
> Josh Poimboeuf (27):
>       MAINTAINERS: Add x86 unwinding entry
>       objtool: Enable unreachable warnings for CLANG LTO
>       x86/static_call: Add ANNOTATE_NOENDBR to static call trampoline
>       x86/retpoline: Add ANNOTATE_NOENDBR for retpolines
>       x86/uaccess: Add ENDBR to __put_user_nocheck*()
>       x86/xen: Add ANNOTATE_NOENDBR to startup_xen()
>       objtool: Print data address for "!ENDBR" data warnings
>       objtool: Use offstr() to print address of missing ENDBR
>       libsubcmd: Fix OPTION_GROUP sorting
>       objtool: Reorganize cmdline options
>       objtool: Ditch subcommands
>       objtool: Don't print parentheses in function addresses
>       objtool: Add option to print section addresses
>       objtool: Make stack validation optional
>       objtool: Rework ibt and extricate from stack validation
>       objtool: Extricate sls from stack validation
>       objtool: Add CONFIG_OBJTOOL
>       objtool: Make stack validation frame-pointer-specific
>       objtool: Make static call annotation optional
>       objtool: Make jump label hack optional
>       objtool: Make noinstr hacks optional
>       objtool: Rename "VMLINUX_VALIDATION" -> "NOINSTR_VALIDATION"
>       objtool: Add HAVE_NOINSTR_VALIDATION
>       objtool: Remove --lto and --vmlinux in favor of --link
>       objtool: Update documentation
>       scripts: Create objdump-func helper script
>       scripts/faddr2line: Fix overlapping text section failures
> 
> Mikulas Patocka (1):
>       objtool: Fix objtool regression on x32 systems
> 
> Nur Hussein (1):
>       x86/Kconfig: fix the spelling of 'becoming' in X86_KERNEL_IBT config
> 
> Peter Zijlstra (5):
>       lib/strn*,objtool: Enforce user_access_begin() rules
>       x86,xen,objtool: Add UNWIND hint
>       x86,objtool: Mark cpu_startup_entry() __noreturn
>       x86,objtool: Explicitly mark idtentry_body()s tail REACHABLE
>       objtool: Fix symbol creation
> 
> Tiezhu Yang (2):
>       objtool: Remove inat-tables.c when make clean
>       objtool: Remove libsubcmd.a when make clean
> 
> Tony Luck (1):
>       x86/cpu: Add new Alderlake and Raptorlake CPU model numbers
> 
> 
>  MAINTAINERS                                        |   9 +
>  Makefile                                           |   2 +-
>  arch/Kconfig                                       |  18 +-
>  arch/x86/Kconfig                                   |  23 +-
>  arch/x86/Kconfig.debug                             |   2 +-
>  arch/x86/entry/entry_64.S                          |   3 +
>  arch/x86/include/asm/intel-family.h                |   3 +
>  arch/x86/include/asm/jump_label.h                  |   6 +-
>  arch/x86/include/asm/microcode.h                   |   2 +
>  arch/x86/include/asm/static_call.h                 |   1 +
>  arch/x86/kernel/alternative.c                      |   6 +-
>  arch/x86/kernel/cpu/microcode/core.c               |   6 +-
>  arch/x86/kernel/unwind_orc.c                       |   8 +-
>  arch/x86/lib/putuser.S                             |   4 +
>  arch/x86/lib/retpoline.S                           |   2 +-
>  arch/x86/platform/pvh/head.S                       |   1 +
>  arch/x86/power/cpu.c                               |  10 +-
>  arch/x86/xen/xen-head.S                            |   1 +
>  include/linux/compiler.h                           |   6 +-
>  include/linux/cpu.h                                |   2 +-
>  include/linux/instrumentation.h                    |   6 +-
>  include/linux/objtool.h                            |   6 +-
>  kernel/trace/Kconfig                               |   1 +
>  lib/Kconfig.debug                                  |  22 +-
>  lib/Kconfig.kcsan                                  |   4 +-
>  lib/Kconfig.ubsan                                  |   2 +-
>  lib/strncpy_from_user.c                            |   2 +-
>  lib/strnlen_user.c                                 |   2 +-
>  scripts/Makefile.build                             |  23 +-
>  scripts/faddr2line                                 | 150 ++++---
>  scripts/link-vmlinux.sh                            |  66 +--
>  scripts/objdump-func                               |  29 ++
>  scripts/package/builddeb                           |   2 +-
>  tools/include/linux/objtool.h                      |   6 +-
>  tools/lib/subcmd/parse-options.c                   |  17 +-
>  tools/objtool/Build                                |  12 +-
>  .../{stack-validation.txt => objtool.txt}          | 122 +++++-
>  tools/objtool/Makefile                             |  10 +-
>  tools/objtool/arch/x86/decode.c                    |   2 +-
>  tools/objtool/arch/x86/special.c                   |   2 +-
>  tools/objtool/builtin-check.c                      | 156 +++++--
>  tools/objtool/builtin-orc.c                        |  73 ----
>  tools/objtool/check.c                              | 466 +++++++++++----------
>  tools/objtool/elf.c                                | 211 ++++++----
>  tools/objtool/include/objtool/builtin.h            |  34 +-
>  tools/objtool/include/objtool/elf.h                |  16 +-
>  tools/objtool/include/objtool/warn.h               |  35 +-
>  tools/objtool/objtool.c                            | 103 +----
>  tools/objtool/weak.c                               |   9 +-
>  49 files changed, 1004 insertions(+), 700 deletions(-)
>  create mode 100755 scripts/objdump-func
>  rename tools/objtool/Documentation/{stack-validation.txt => objtool.txt} (80%)
>  delete mode 100644 tools/objtool/builtin-orc.c

Not sure what happened there, a previous x86/urgent got mixed into the 
shortlog & diffstat - this is the correct shortlog & diffstat you should 
get when pulling objtool-core-2022-05-23:

Josh Poimboeuf (19):
      libsubcmd: Fix OPTION_GROUP sorting
      objtool: Reorganize cmdline options
      objtool: Ditch subcommands
      objtool: Don't print parentheses in function addresses
      objtool: Add option to print section addresses
      objtool: Make stack validation optional
      objtool: Rework ibt and extricate from stack validation
      objtool: Extricate sls from stack validation
      objtool: Add CONFIG_OBJTOOL
      objtool: Make stack validation frame-pointer-specific
      objtool: Make static call annotation optional
      objtool: Make jump label hack optional
      objtool: Make noinstr hacks optional
      objtool: Rename "VMLINUX_VALIDATION" -> "NOINSTR_VALIDATION"
      objtool: Add HAVE_NOINSTR_VALIDATION
      objtool: Remove --lto and --vmlinux in favor of --link
      objtool: Update documentation
      scripts: Create objdump-func helper script
      scripts/faddr2line: Fix overlapping text section failures

Mikulas Patocka (1):
      objtool: Fix objtool regression on x32 systems

Peter Zijlstra (2):
      Merge branch 'tip/x86/urgent'
      objtool: Fix symbol creation

Tiezhu Yang (2):
      objtool: Remove inat-tables.c when make clean
      objtool: Remove libsubcmd.a when make clean

 ================>

 Makefile                                                          |   2 +-
 arch/Kconfig                                                      |  18 ++++++-
 arch/x86/Kconfig                                                  |  21 +++++---
 arch/x86/Kconfig.debug                                            |   2 +-
 arch/x86/include/asm/jump_label.h                                 |   6 +--
 arch/x86/kernel/alternative.c                                     |   6 +--
 include/linux/compiler.h                                          |   6 +--
 include/linux/instrumentation.h                                   |   6 +--
 include/linux/objtool.h                                           |   6 +--
 kernel/trace/Kconfig                                              |   1 +
 lib/Kconfig.debug                                                 |  22 ++++----
 lib/Kconfig.kcsan                                                 |   4 +-
 lib/Kconfig.ubsan                                                 |   2 +-
 scripts/Makefile.build                                            |  23 +++++----
 scripts/faddr2line                                                | 150 +++++++++++++++++++++++++++++++++++-------------------
 scripts/link-vmlinux.sh                                           |  66 +++++++++++++++---------
 scripts/objdump-func                                              |  29 +++++++++++
 scripts/package/builddeb                                          |   2 +-
 tools/include/linux/objtool.h                                     |   6 +--
 tools/lib/subcmd/parse-options.c                                  |  17 +++++--
 tools/objtool/Build                                               |  12 ++---
 tools/objtool/Documentation/{stack-validation.txt => objtool.txt} | 122 ++++++++++++++++++++++++++++++++++++--------
 tools/objtool/Makefile                                            |  10 ++--
 tools/objtool/arch/x86/decode.c                                   |   2 +-
 tools/objtool/arch/x86/special.c                                  |   2 +-
 tools/objtool/builtin-check.c                                     | 156 +++++++++++++++++++++++++++++++++++++++++++++-----------
 tools/objtool/builtin-orc.c                                       |  73 --------------------------
 tools/objtool/check.c                                             | 463 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------
 tools/objtool/elf.c                                               | 211 ++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
 tools/objtool/include/objtool/builtin.h                           |  34 +++++++++++--
 tools/objtool/include/objtool/elf.h                               |  16 ++++--
 tools/objtool/include/objtool/warn.h                              |  35 +++++++------
 tools/objtool/objtool.c                                           | 103 ++-----------------------------------
 tools/objtool/weak.c                                              |   9 +---
 34 files changed, 959 insertions(+), 684 deletions(-)
 create mode 100755 scripts/objdump-func
 rename tools/objtool/Documentation/{stack-validation.txt => objtool.txt} (80%)
 delete mode 100644 tools/objtool/builtin-orc.c

Thanks,

	Ingo

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

* Re: [GIT PULL] objtool changes for v5.19
  2022-05-24  5:34 ` Ingo Molnar
@ 2022-05-24  6:02   ` Ingo Molnar
  2022-05-24 17:53     ` Linus Torvalds
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2022-05-24  6:02 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Josh Poimboeuf, Thomas Gleixner,
	Borislav Petkov, Andrew Morton


* Ingo Molnar <mingo@kernel.org> wrote:

>  34 files changed, 959 insertions(+), 684 deletions(-)

Note that with your latest tree you'll get 3 new conflicts:

  CONFLICT (content): Merge conflict in scripts/link-vmlinux.sh
  CONFLICT (content): Merge conflict in scripts/Makefile.build
  CONFLICT (content): Merge conflict in arch/x86/Kconfig

If you want to double check, you can find our resolution in tip:x86/merge:

  a1df7cc57786 Merge branch 'objtool/core' into x86/merge, to resolve conflicts

At:

  git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/merge # INTERNAL MERGE TREE, DO NOT PULL

Here's the merge description:

 ===================
 The following commits between objtool/core and various x86 branches conflict:

   968b493173ac x86/mm: Make DMA memory shared for TD guest
   77a512e35db7 x86/boot: Avoid #VE during boot for TDX platforms
   65fab5bc033a x86/tdx: Exclude shared bit from __PHYSICAL_MASK
   41394e33f3a0 x86/tdx: Extend the confidential computing API to support TDX guests
   59bd54a84d15 x86/tdx: Detect running as a TDX guest in early boot
   dbae0a934f09 x86/cpu: Remove CONFIG_X86_SMAP and "nosmap"

 and:

   753da4179d08 objtool: Remove --lto and --vmlinux in favor of --link
   489e355b4225 objtool: Add HAVE_NOINSTR_VALIDATION
   0f620cefd775 objtool: Rename "VMLINUX_VALIDATION" -> "NOINSTR_VALIDATION"
   22102f4559be objtool: Make noinstr hacks optional
   4ab7674f5951 objtool: Make jump label hack optional
   26e176896a5b objtool: Make static call annotation optional
   720644749647 objtool: Make stack validation frame-pointer-specific
   03f16cd020eb objtool: Add CONFIG_OBJTOOL
   7dce62041ac3 objtool: Make stack validation optional
   b51277eb9775 objtool: Ditch subcommands
   2daf7faba7de objtool: Reorganize cmdline options
   4cdfc11b2836 x86/Kconfig: fix the spelling of 'becoming' in X86_KERNEL_IBT config
   4a5de9b76fcb objtool: Enable unreachable warnings for CLANG LTO

 Resolve them:

  - overlapping modifications
  - modifying removed functionality

 Conflicts:
	arch/x86/Kconfig
	scripts/Makefile.build
	scripts/link-vmlinux.sh
 ===================

Thanks,

	Ingo

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

* Re: [GIT PULL] objtool changes for v5.19
  2022-05-24  6:02   ` Ingo Molnar
@ 2022-05-24 17:53     ` Linus Torvalds
  2022-05-24 18:08       ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Torvalds @ 2022-05-24 17:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Josh Poimboeuf,
	Thomas Gleixner, Borislav Petkov, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]

On Mon, May 23, 2022 at 11:02 PM Ingo Molnar <mingo@kernel.org> wrote:
>
> Note that with your latest tree you'll get 3 new conflicts:

No problem, but the conflicts did make something clear: the objtool
code should just get rid of the "--uaccess" flag that is now
unconditional when CONFIG_X86_SMAP has been removed.

I didn't actually do that, and instead just did the mindless merge
conflict resolution, but it might be a good idea.

See commit dbae0a934f09 ("x86/cpu: Remove CONFIG_X86_SMAP and
'nosmap'") for when it was removed.

Josh? The patch *might* be something like the attached, but this is
(a) untested and (b) that 'opts.noinstr' part of the patch is a bit
dodgy (ie I made the previous 'if' unconditional, but then changed the
follow 'else if ()'  to just 'if ()' instead of deleting it, which is
what "uaccess is always set" would technically have done.

Again: I did *not* do this as part of the merge, the attached patch is
just a suggestion of something that I think should now be done after
the merge.

Hmm?

                        Linus

[-- Attachment #2: patch.diff --]
[-- Type: text/x-patch, Size: 4744 bytes --]

 scripts/Makefile.build                  |  1 -
 scripts/link-vmlinux.sh                 |  2 --
 tools/objtool/arch/x86/special.c        |  8 ++------
 tools/objtool/builtin-check.c           |  4 +---
 tools/objtool/check.c                   | 30 +++++++++++++-----------------
 tools/objtool/include/objtool/builtin.h |  1 -
 6 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index f89d3fcff39f..4d96dea9ff31 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -236,7 +236,6 @@ objtool_args =								\
 	$(if $(CONFIG_SLS), --sls)					\
 	$(if $(CONFIG_STACK_VALIDATION), --stackval)			\
 	$(if $(CONFIG_HAVE_STATIC_CALL_INLINE), --static-call)		\
-	--uaccess							\
 	$(if $(linked-object), --link)					\
 	$(if $(part-of-module), --module)				\
 	$(if $(CONFIG_GCOV_KERNEL), --no-unreachable)
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index d7f26f02f142..add98ce9e1e5 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -152,8 +152,6 @@ objtool_link()
 		if is_enabled CONFIG_HAVE_STATIC_CALL_INLINE; then
 			objtoolopt="${objtoolopt} --static-call"
 		fi
-
-		objtoolopt="${objtoolopt} --uaccess"
 	fi
 
 	if is_enabled CONFIG_NOINSTR_VALIDATION; then
diff --git a/tools/objtool/arch/x86/special.c b/tools/objtool/arch/x86/special.c
index 7c97b7391279..b070edb5fd8f 100644
--- a/tools/objtool/arch/x86/special.c
+++ b/tools/objtool/arch/x86/special.c
@@ -12,18 +12,14 @@ void arch_handle_alternative(unsigned short feature, struct special_alt *alt)
 	switch (feature) {
 	case X86_FEATURE_SMAP:
 		/*
-		 * If UACCESS validation is enabled; force that alternative;
-		 * otherwise force it the other way.
+		 * Force the uaccess alternative.
 		 *
 		 * What we want to avoid is having both the original and the
 		 * alternative code flow at the same time, in that case we can
 		 * find paths that see the STAC but take the NOP instead of
 		 * CLAC and the other way around.
 		 */
-		if (opts.uaccess)
-			alt->skip_orig = true;
-		else
-			alt->skip_alt = true;
+		alt->skip_orig = true;
 		break;
 	case X86_FEATURE_POPCNT:
 		/*
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index f4c3a5091737..ae28905dc17a 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -71,7 +71,6 @@ const struct option check_options[] = {
 	OPT_BOOLEAN('l', "sls", &opts.sls, "validate straight-line-speculation mitigations"),
 	OPT_BOOLEAN('s', "stackval", &opts.stackval, "validate frame pointer rules"),
 	OPT_BOOLEAN('t', "static-call", &opts.static_call, "annotate static calls"),
-	OPT_BOOLEAN('u', "uaccess", &opts.uaccess, "validate uaccess rules for SMAP"),
 	OPT_CALLBACK_OPTARG(0, "dump", NULL, NULL, "orc", "dump metadata", parse_dump),
 
 	OPT_GROUP("Options:"),
@@ -125,8 +124,7 @@ static bool opts_valid(void)
 	    opts.retpoline		||
 	    opts.sls			||
 	    opts.stackval		||
-	    opts.static_call		||
-	    opts.uaccess) {
+	    opts.static_call) {
 		if (opts.dump_orc) {
 			ERROR("--dump can't be combined with other options");
 			return false;
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 190b2f6e360a..86f01f86cd13 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1030,9 +1030,6 @@ static void add_uaccess_safe(struct objtool_file *file)
 	struct symbol *func;
 	const char **name;
 
-	if (!opts.uaccess)
-		return;
-
 	for (name = uaccess_safe_builtin; *name; name++) {
 		func = find_symbol_by_name(file->elf, *name);
 		if (!func)
@@ -3919,25 +3916,24 @@ int check(struct objtool_file *file)
 		warnings += ret;
 	}
 
-	if (opts.stackval || opts.orc || opts.uaccess) {
-		ret = validate_functions(file);
-		if (ret < 0)
-			goto out;
-		warnings += ret;
+	ret = validate_functions(file);
+	if (ret < 0)
+		goto out;
+	warnings += ret;
 
-		ret = validate_unwind_hints(file, NULL);
+	ret = validate_unwind_hints(file, NULL);
+	if (ret < 0)
+		goto out;
+	warnings += ret;
+
+	if (!warnings) {
+		ret = validate_reachable_instructions(file);
 		if (ret < 0)
 			goto out;
 		warnings += ret;
+	}
 
-		if (!warnings) {
-			ret = validate_reachable_instructions(file);
-			if (ret < 0)
-				goto out;
-			warnings += ret;
-		}
-
-	} else if (opts.noinstr) {
+	if (opts.noinstr) {
 		ret = validate_noinstr_sections(file);
 		if (ret < 0)
 			goto out;
diff --git a/tools/objtool/include/objtool/builtin.h b/tools/objtool/include/objtool/builtin.h
index 280ea18b7f2b..8054f3dc7712 100644
--- a/tools/objtool/include/objtool/builtin.h
+++ b/tools/objtool/include/objtool/builtin.h
@@ -22,7 +22,6 @@ struct opts {
 	bool sls;
 	bool stackval;
 	bool static_call;
-	bool uaccess;
 
 	/* options: */
 	bool backtrace;

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

* Re: [GIT PULL] objtool changes for v5.19
  2022-05-24 17:53     ` Linus Torvalds
@ 2022-05-24 18:08       ` Peter Zijlstra
  2022-05-24 18:14         ` Josh Poimboeuf
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2022-05-24 18:08 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ingo Molnar, Linux Kernel Mailing List, Josh Poimboeuf,
	Thomas Gleixner, Borislav Petkov, Andrew Morton

On Tue, May 24, 2022 at 10:53:40AM -0700, Linus Torvalds wrote:
> On Mon, May 23, 2022 at 11:02 PM Ingo Molnar <mingo@kernel.org> wrote:
> >
> > Note that with your latest tree you'll get 3 new conflicts:
> 
> No problem, but the conflicts did make something clear: the objtool
> code should just get rid of the "--uaccess" flag that is now
> unconditional when CONFIG_X86_SMAP has been removed.
> 
> I didn't actually do that, and instead just did the mindless merge
> conflict resolution, but it might be a good idea.

Yes, I think there is patch pending for that, but given the total merge
pain we already had, I was waiting for all the dust to settle before
taking it further.

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

* Re: [GIT PULL] objtool changes for v5.19
  2022-05-24 18:08       ` Peter Zijlstra
@ 2022-05-24 18:14         ` Josh Poimboeuf
  0 siblings, 0 replies; 7+ messages in thread
From: Josh Poimboeuf @ 2022-05-24 18:14 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Linus Torvalds, Ingo Molnar, Linux Kernel Mailing List,
	Thomas Gleixner, Borislav Petkov, Andrew Morton

On Tue, May 24, 2022 at 08:08:05PM +0200, Peter Zijlstra wrote:
> On Tue, May 24, 2022 at 10:53:40AM -0700, Linus Torvalds wrote:
> > On Mon, May 23, 2022 at 11:02 PM Ingo Molnar <mingo@kernel.org> wrote:
> > >
> > > Note that with your latest tree you'll get 3 new conflicts:
> > 
> > No problem, but the conflicts did make something clear: the objtool
> > code should just get rid of the "--uaccess" flag that is now
> > unconditional when CONFIG_X86_SMAP has been removed.
> > 
> > I didn't actually do that, and instead just did the mindless merge
> > conflict resolution, but it might be a good idea.
> 
> Yes, I think there is patch pending for that, but given the total merge
> pain we already had, I was waiting for all the dust to settle before
> taking it further.

Actually I think we should go the other direction by keeping '--uaccess'
and adding CONFIG_HAVE_UACCESS_VALIDATION or so.   The main point of
that objtool rewrite was to make all the features modular so other
arches could port them piecemeal.

-- 
Josh

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

* Re: [GIT PULL] objtool changes for v5.19
  2022-05-23 16:32 [GIT PULL] objtool changes for v5.19 Ingo Molnar
  2022-05-24  5:34 ` Ingo Molnar
@ 2022-05-24 19:53 ` pr-tracker-bot
  1 sibling, 0 replies; 7+ messages in thread
From: pr-tracker-bot @ 2022-05-24 19:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, linux-kernel, Peter Zijlstra, Josh Poimboeuf,
	Thomas Gleixner, Borislav Petkov, Andrew Morton

The pull request you sent on Mon, 23 May 2022 18:32:36 +0200:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git objtool-core-2022-05-23

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/22922deae13fc8d3769790c2eb388e9afce9771d

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

end of thread, other threads:[~2022-05-24 19:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 16:32 [GIT PULL] objtool changes for v5.19 Ingo Molnar
2022-05-24  5:34 ` Ingo Molnar
2022-05-24  6:02   ` Ingo Molnar
2022-05-24 17:53     ` Linus Torvalds
2022-05-24 18:08       ` Peter Zijlstra
2022-05-24 18:14         ` Josh Poimboeuf
2022-05-24 19:53 ` pr-tracker-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.