Skip to content

Symbol namespaces

Martijn Coenen cocci kernel-janitors linux-amlogic linux-arch linux-aspeed linux-kbuild linux-m68k linux-mediatek linux-modules linux-samsung-soc linux-scsi linux-tegra linux-usb linux-watchdog lkml openbmc 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6export: explicitly align struct kernel_symbol.arch/m68k/include/asm/export.h arch/x86/include/asm/Kbuild arch/x86/include/asm/export.h +1 more+2 -60 replies
2/6module: add support for symbol namespaces.include/asm-generic/export.h include/linux/export.h include/linux/module.h +1 more+156 -2110 replies
3/6modpost: add support for checking symbol namespaces.scripts/mod/modpost.c scripts/mod/modpost.h+72 -50 replies
4/6modpost: add support for generating namespace dependencies.scripts/mod/modpost.c scripts/mod/modpost.h+55 -51 reply
5/6scripts: Coccinelle script for namespace dependencies.Makefile scripts/Makefile.modpost scripts/add_namespace.cocci +1 more+74 -10 replies
6/6RFC: USB: storage: move symbols into USB_STORAGE namespace.drivers/usb/storage/alauda.c drivers/usb/storage/cypress_atacb.c drivers/usb/storage/datafab.c +12 more+24 -102 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJoel Fernandes (Google)Martijn CoenenJulia LawallGreg Kroah-Hartman
SeriesR-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b A-b A-b A-b A-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b T-b
1/6
2/6
3/6
4/6
5/6
6/6

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

Read the v1 thread

Cover letter [PATCH 0/6] Symbol namespaces

As of Linux 4.17, there are more than 30000 exported symbols in the kernel. There seems to be some consensus amongst kernel devs that the export surface is too large, and hard to reason about.

Generally, these symbols fall in one of these categories:
1) Symbols actually meant for drivers
2) Symbols that are only exported because functionality is split over multiple modules, yet they really shouldn't be used by modules outside of their own subsystem
3) Symbols really only meant for in-tree use

When module developers try to upstream their code, it regularly turns out that they are using exported symbols that they really shouldn't be using. This problem is even bigger for drivers that are currently out-of-tree, which may be using many symbols that they shouldn't be using, and that break when those symbols are removed or modified.

This patch allows subsystem maintainers to partition their exported symbols into separate namespaces, and module authors to import such namespaces only when needed.

This allows subsystem maintainers to more easily limit availability of these namespaced symbols to other parts of the kernel. It can also be used to partition the set of exported symbols for documentation purposes; for example, a set of symbols that is really only used for debugging could be in a "SUBSYSTEM_DEBUG" namespace.

Martijn Coenen (6):
export: explicitly align struct kernel_symbol.
module: add support for symbol namespaces.
modpost: add support for checking symbol namespaces.
modpost: add support for generating namespace dependencies.
scripts: Coccinelle script for namespace dependencies.
RFC: USB: storage: move symbols into USB_STORAGE namespace.

 Makefile                            |  11 +++
 arch/m68k/include/asm/export.h      |   1 -
 arch/x86/include/asm/Kbuild         |   1 +
 arch/x86/include/asm/export.h       |   5 --
 drivers/usb/storage/alauda.c        |   1 +
 drivers/usb/storage/cypress_atacb.c |   1 +
 drivers/usb/storage/datafab.c       |   1 +
 drivers/usb/storage/ene_ub6250.c    |   1 +
 drivers/usb/storage/freecom.c       |   1 +
 drivers/usb/storage/isd200.c        |   1 +
 drivers/usb/storage/jumpshot.c      |   1 +
 drivers/usb/storage/karma.c         |   1 +
 drivers/usb/storage/onetouch.c      |   1 +
 drivers/usb/storage/realtek_cr.c    |   1 +
 drivers/usb/storage/sddr09.c        |   1 +
 drivers/usb/storage/sddr55.c        |   1 +
 drivers/usb/storage/shuttle_usbat.c |   1 +
 drivers/usb/storage/uas.c           |   1 +
 drivers/usb/storage/usb.c           |  20 ++---
 include/asm-generic/export.h        |   2 +-
 include/linux/export.h              |  84 ++++++++++++++-----
 include/linux/module.h              |  13 +++
 kernel/module.c                     |  79 ++++++++++++++++++
 scripts/Makefile.modpost            |   4 +-
 scripts/add_namespace.cocci         |  19 +++++
 scripts/mod/modpost.c               | 120 ++++++++++++++++++++++++++--
 scripts/mod/modpost.h               |   9 +++
 scripts/nsdeps                      |  41 ++++++++++
 28 files changed, 379 insertions(+), 44 deletions(-)
 delete mode 100644 arch/x86/include/asm/export.h
 create mode 100644 scripts/add_namespace.cocci
 create mode 100644 scripts/nsdeps
Signature · 1 line
2.18.0.203.gfac676dfb9-goog