Skip to content

kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYM

Quentin Perret linux-kbuild lkml 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest3 patches 1 replyIn review
  2. v53 patches 5 repliesSuperseded
  3. v43 patches 9 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v33 patches10 repliesSuperseded
v21 patch8 repliesSuperseded
v11 patch5 repliesSuperseded

Changes in v6 from the cover letter

- made permission checks on the whitelist file more robust (Masahiro)
- better style/identation in Makefile (Masahiro)

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYMSinit/Kconfig scripts/adjust_autoksyms.sh+25 -00 replies
2/3kbuild: split adjust_autoksyms.sh in two partsscripts/adjust_autoksyms.sh scripts/gen_autoksyms.sh+55 -320 replies
3/3kbuild: generate autoksyms.h earlyMakefile scripts/gen_autoksyms.sh+7 -30 replies

Reviews trailers per patch

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

PatchJessica YuNicolas PitreMatthias Maennich
1/3A-b A-b T-b R-b
2/3A-b T-b R-b
3/3A-b T-b R-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 3 reviewers.

Read the v6 thread

Cover letter [PATCH v6 0/3] kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYM

The current norm on Android and many other systems is for vendors to introduce significant changes to their downstream kernels, and to contribute very little (if any) code back upstream. The Generic Kernel Image (GKI) project in Android attempts to improve the status-quo by having a unique kernel for all android devices of the same architecture, regardless of the SoC vendor. The key idea is to make all interested parties agree on a common solution, and contribute their code upstream to make it available to use by the wider community.

The kernel-to-drivers ABI on Android devices varies significantly from one vendor kernel to another today because of changes to exported symbols, dependencies on vendor symbols, and surely other things. The first step for GKI is to try and put some order into this by agreeing on one version of the ABI that works for everybody.

For practical reasons, we need to reduce the ABI surface to a subset of the exported symbols, simply to make the problem realistically solvable, but there is currently no upstream support for this use-case.

As such, this series attempts to improve the situation by enabling users to specify a symbol 'whitelist' at compile time. Any symbol specified in this whitelist will be kept exported when CONFIG_TRIM_UNUSED_KSYMS is set, even if it has no in-tree user. The whitelist is defined as a simple text file, listing symbols, one per line.

v6:
- made permission checks on the whitelist file more robust (Masahiro)
- better style/identation in Makefile (Masahiro)

v5:
- made sure to be POSIX-compliant (+ tested with dash and posh)
- added failure path if the whitelist path is incorrect (Matthias, Nicolas)
- collected Acked-By (and other) tags from Nicolas and Matthias

v4:
- removed [[]] bash-specific pattern from the scripts (Nicolas)
- use $CONFIG_SHELL consistently in all patches (Masahiro)
- added shortlog for initial generation of autoksyms.h (Masahiro)
- added comment on how 'eval' expands the whitelist path (Masahiro)

v3:
- added a cover letter to explain why this is in fact an attempt to help upstream in the long term (Christoph)
- made path relative to the kernel source tree (Matthias)
- made the Kconfig help text less confusing (Jessica)
- added patch 02 and 03 to optimize build time when a whitelist is provided

v2:
- make sure to quote the whitelist path properly (Nicolas)

Quentin Perret (3):
kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYMS
kbuild: split adjust_autoksyms.sh in two parts
kbuild: generate autoksyms.h early

 Makefile                    |  7 +++--
 init/Kconfig                | 13 ++++++++++
 scripts/adjust_autoksyms.sh | 24 +++--------------
 scripts/gen_autoksyms.sh    | 52 +++++++++++++++++++++++++++++++++++++
 4 files changed, 74 insertions(+), 22 deletions(-)
 create mode 100755 scripts/gen_autoksyms.sh
Signature · 1 line
2.25.1.481.gfbce0eb801-goog