Skip to content

kallsyms: Prevent invalid access when showing module buildid

Petr Mladek bpf linux-modules linux-trace-kernel lkml 3 versions – Applied

Status from this message: [merged mm-nonmm-stable] kallsyms-prevent-module-removal-when-printing-module-name-and-buildid.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest7 patches 4 repliesApplied 7/7
  2. v27 patches 1 replySuperseded
  3. v16 patches 14 repliesSuperseded

Patches in v3 All 7 applied

#Subject and filesSizeRepliesApplied
1/7kallsyms: Clean up @namebuf initialization in kallsyms_lookup_buildid()kernel/kallsyms.c+6 -10 repliesApplied
2/7kallsyms: Clean up modname and modbuildid initialization in kallsyms_lookup_buildid()kernel/kallsyms.c+8 -40 repliesApplied
3/7module: Add helper function for reading module_buildid()include/linux/module.h kernel/module/kallsyms.c+11 -70 repliesApplied
4/7kallsyms: Cleanup code for appending the module buildidkernel/kallsyms.c+33 -90 repliesApplied
5/7kallsyms/bpf: Rename __bpf_address_lookup() to bpf_address_lookup()arch/arm64/net/bpf_jit_comp.c arch/powerpc/net/bpf_jit_comp.c include/linux/filter.h +2 more+10 -290 repliesApplied
6/7kallsyms/ftrace: Set module buildid in ftrace_mod_address_lookup()include/linux/ftrace.h kernel/kallsyms.c kernel/trace/ftrace.c+10 -50 repliesApplied
7/7kallsyms: Prevent module removal when printing module name and buildidkernel/kallsyms.c+3 -00 repliesApplied

Reviews trailers per patch

5 of 7 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAaron TomlinDaniel GomezPetr PavluAlexei StarovoitovSteven Rostedt (Google)
SeriesR-b
1/7R-b
2/7
3/7R-b R-b
4/7
5/7A-b
6/7R-b A-b
7/7R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/7] kallsyms: Prevent invalid access when showing module buildid

This patchset is cleaning up kallsyms code related to module buildid. It is fixing an invalid access when printing backtraces, see [v1] for more details:

+ 1st..4th patches are preparatory.

+ 5th and 6th patches are fixing bpf and ftrace related APIs.

+ 7th patch prevents a potential race.

Changes against [v2]:

+ Fixed typos in commit message [Alexei]

+ Added Acks [Alexei]

Changes against [v1]:

+ Added existing Reviewed-by tags.

+ Shuffled patches to update the kallsyms_lookup_buildid() initialization code 1st.

+ Initialized also *modname and *modbuildid in kallsyms_lookup_buildid().

+ Renamed __bpf_address_lookup() to bpf_address_lookup() and used it in kallsyms_lookup_buildid(). Did this instead of passing @modbuildid parameter just to clear it.

[v1] https://lore.kernel.org/r/[email protected]
[v2] https://lore.kernel.org/r/[email protected]

Petr Mladek (7):
kallsyms: Clean up @namebuf initialization in
kallsyms_lookup_buildid()
kallsyms: Clean up modname and modbuildid initialization in
kallsyms_lookup_buildid()
module: Add helper function for reading module_buildid()
kallsyms: Cleanup code for appending the module buildid kallsyms/bpf: Rename __bpf_address_lookup() to bpf_address_lookup() kallsyms/ftrace: Set module buildid in ftrace_mod_address_lookup()
kallsyms: Prevent module removal when printing module name and buildid

 arch/arm64/net/bpf_jit_comp.c   |  2 +-
 arch/powerpc/net/bpf_jit_comp.c |  2 +-
 include/linux/filter.h          | 26 ++----------
 include/linux/ftrace.h          |  6 ++-
 include/linux/module.h          |  9 ++++
 kernel/bpf/core.c               |  4 +-
 kernel/kallsyms.c               | 73 ++++++++++++++++++++++++---------
 kernel/module/kallsyms.c        |  9 +---
 kernel/trace/ftrace.c           |  5 ++-
 9 files changed, 81 insertions(+), 55 deletions(-)
Signature · 1 line
2.52.0