Skip to content

ftrace: Introduce PERMANENT ftrace_ops flag

Miroslav Benes linux-kselftest live-patching lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 11 repliesIn review
  2. v21 patch 11 repliesSuperseded
  3. v13 patches 11 repliesSuperseded

Changes in v3 from the cover letter

- ftrace_enabled explicitly set to true
- selftest from Joe Lawrence (I just split it to two patches)
- typo fix

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3ftrace: Introduce PERMANENT ftrace_ops flagDocumentation/trace/ftrace-uses.rst Documentation/trace/ftrace.rst include/linux/ftrace.h +2 more+37 -42 replies
2/3selftests/livepatch: Make dynamic debug setup and restore generictools/testing/selftests/livepatch/functions.sh tools/testing/selftests/livepatch/test-callbacks.sh tools/testing/selftests/livepatch/test-livepatch.sh +1 more+16 -123 replies
3/3selftests/livepatch: Test interaction with ftrace_enabledtools/testing/selftests/livepatch/Makefile tools/testing/selftests/livepatch/functions.sh tools/testing/selftests/livepatch/test-ftrace.sh+80 -24 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchPetr MladekKamalesh Babulal
1/3R-b R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/3] ftrace: Introduce PERMANENT ftrace_ops flag

Livepatch uses ftrace for redirection to new patched functions. It means that if ftrace is disabled, all live patched functions are disabled as well. Toggling global 'ftrace_enabled' sysctl thus affect it directly. It is not a problem per se, because only administrator can set sysctl values, but it still may be surprising.

Introduce PERMANENT ftrace_ops flag to amend this. If the FTRACE_OPS_FL_PERMANENT is set on any ftrace ops, the tracing cannot be disabled by disabling ftrace_enabled. Equally, a callback with the flag set cannot be registered if ftrace_enabled is disabled.

v2->v3:
- ftrace_enabled explicitly set to true
- selftest from Joe Lawrence (I just split it to two patches)
- typo fix

v1->v2:
- different logic, proposed by Joe Lawrence

Joe Lawrence (2):
selftests/livepatch: Make dynamic debug setup and restore generic selftests/livepatch: Test interaction with ftrace_enabled

Miroslav Benes (1):
ftrace: Introduce PERMANENT ftrace_ops flag

 Documentation/trace/ftrace-uses.rst           |  8 +++
 Documentation/trace/ftrace.rst                |  4 +-
 include/linux/ftrace.h                        |  3 +
 kernel/livepatch/patch.c                      |  3 +-
 kernel/trace/ftrace.c                         | 23 ++++++-
 tools/testing/selftests/livepatch/Makefile    |  3 +-
 .../testing/selftests/livepatch/functions.sh  | 34 +++++++---
 .../selftests/livepatch/test-callbacks.sh     |  2 +-
 .../selftests/livepatch/test-ftrace.sh        | 65 +++++++++++++++++++
 .../selftests/livepatch/test-livepatch.sh     |  2 +-
 .../selftests/livepatch/test-shadow-vars.sh   |  2 +-
 11 files changed, 132 insertions(+), 17 deletions(-)
 create mode 100755 tools/testing/selftests/livepatch/test-ftrace.sh
Signature · 1 line
2.23.0