[PATCH v2 0/3] objtool: noinstr validation for static branches/calls

Josh Poimboeuf posted 3 patches 1 year, 2 months ago
include/linux/jump_label.h              | 30 ++++++--
include/linux/objtool.h                 |  7 ++
include/linux/static_call.h             | 19 +++++
tools/objtool/Documentation/objtool.txt | 34 +++++++++
tools/objtool/check.c                   | 92 ++++++++++++++++++++++---
tools/objtool/include/objtool/check.h   |  1 +
tools/objtool/include/objtool/elf.h     |  1 +
tools/objtool/include/objtool/special.h |  1 +
tools/objtool/special.c                 | 18 ++++-
9 files changed, 187 insertions(+), 16 deletions(-)
[PATCH v2 0/3] objtool: noinstr validation for static branches/calls
Posted by Josh Poimboeuf 1 year, 2 months ago
v2:
- Add some fixes reported by kbuild.


FWIW, this reports the following static keys:

  - sched_clock_running
  - __sched_clock_stable
  - mds_idle_clear
  - vmx_l1d_flush_cond
  - stack_erasing_bypass

and the following static calls:

  - pv_sched_clock
  - x86_idle

(not necessarily an exhaustive list, just the ones I've seen)


Josh Poimboeuf (3):
  jump_label: Add annotations for validating noinstr usage
  static_call: Add read-only-after-init static calls
  objtool: Add noinstr validation for static branches/calls

 include/linux/jump_label.h              | 30 ++++++--
 include/linux/objtool.h                 |  7 ++
 include/linux/static_call.h             | 19 +++++
 tools/objtool/Documentation/objtool.txt | 34 +++++++++
 tools/objtool/check.c                   | 92 ++++++++++++++++++++++---
 tools/objtool/include/objtool/check.h   |  1 +
 tools/objtool/include/objtool/elf.h     |  1 +
 tools/objtool/include/objtool/special.h |  1 +
 tools/objtool/special.c                 | 18 ++++-
 9 files changed, 187 insertions(+), 16 deletions(-)

-- 
2.47.0
Re: [PATCH v2 0/3] objtool: noinstr validation for static branches/calls
Posted by Josh Poimboeuf 1 year, 2 months ago
On Tue, Nov 26, 2024 at 08:47:39PM -0800, Josh Poimboeuf wrote:
> v2:
> - Add some fixes reported by kbuild.
> 
> 
> FWIW, this reports the following static keys:
> 
>   - sched_clock_running
>   - __sched_clock_stable
>   - mds_idle_clear
>   - vmx_l1d_flush_cond
>   - stack_erasing_bypass

    - perf_lopwr_cb

> and the following static calls:
> 
>   - pv_sched_clock
>   - x86_idle

-- 
Josh
Re: [PATCH v2 0/3] objtool: noinstr validation for static branches/calls
Posted by Valentin Schneider 1 year, 2 months ago
On 27/11/24 17:35, Josh Poimboeuf wrote:
> On Tue, Nov 26, 2024 at 08:47:39PM -0800, Josh Poimboeuf wrote:
>> v2:
>> - Add some fixes reported by kbuild.
>> 
>> 
>> FWIW, this reports the following static keys:
>> 
>>   - sched_clock_running
>>   - __sched_clock_stable
>>   - mds_idle_clear
>>   - vmx_l1d_flush_cond
>>   - stack_erasing_bypass
>

sched_clock_running, __sched_clock_stable and mds_idle_clear are already
covered in v3

vmx_l1d_flush_cond is modified
- at init via __init vmx_init()
- via a module parameter write ending in vmentry_l1d_flush_set()
So either init or user/admin action, IMO that's a "don't touch it"
scenario.

stack_erasing_bypass is modified only via a sysctl write, so IMO same
argument.


>> and the following static calls:
>> 
>>   - pv_sched_clock
>>   - x86_idle
>     - perf_lopwr_cb

All of these are only ever modified at __init, so they can be made
__ro_after_init.

>
> -- 
> Josh
Re: [PATCH v2 0/3] objtool: noinstr validation for static branches/calls
Posted by Valentin Schneider 1 year, 2 months ago
On 26/11/24 20:47, Josh Poimboeuf wrote:
> v2:
> - Add some fixes reported by kbuild.
>
>
> FWIW, this reports the following static keys:
>
>   - sched_clock_running
>   - __sched_clock_stable
>   - mds_idle_clear
>   - vmx_l1d_flush_cond
>   - stack_erasing_bypass
>
> and the following static calls:
>
>   - pv_sched_clock
>   - x86_idle
>

And you event did the static calls, sweet! Thanks a ton Josh, lemme catch
up with emails and then I'll look into these.