Re: module: add debugging alias parsing support

From: Jessica Yu
Date: Thu Nov 30 2017 - 08:17:26 EST


+++ Luis R. Rodriguez [29/11/17 18:36 -0800]:
Debugging modules can often lead to an alias question. We purposely
don't have alias parsing support upstream as this is all dealt with
in userpace with the assumption that in-kernel we just process aliases
and userspace Does The Right Thing (TM) about aliases.

Obviously userspace can be buggy though, and it can lie to us. We
currently have no easy way to determine this. Parsing aliases is
an example debugging facility we can use to help with these sorts
of problems.

You can debug by adding to your dynamic debug:

GRUB_CMDLINE_LINUX_DEFAULT="dyndbg=\"func module_process_aliases +p;\" "

Upon boot for example here a few entries:

module ext4 num_aliases: 5
alias[0] = fs-ext4
alias[1] = ext3
alias[2] = fs-ext3
alias[3] = ext2
alias[4] = fs-ext2

module xfs num_aliases: 1
alias[0] = fs-xfs

module floppy num_aliases: 3
alias[0] = block-major-2-*
alias[1] = acpi*:PNP0700:*
alias[2] = pnp:dPNP0700*

module ata_piix num_aliases: 89
alias[0] = pci:v00008086d00008C81sv*sd*bc*sc*i*
alias[1] = pci:v00008086d00008C80sv*sd*bc*sc*i*
alias[2] = pci:v00008086d00008C89sv*sd*bc*sc*i*
alias[3] = pci:v00008086d00008C88sv*sd*bc*sc*i*
... etc ...

Suggested-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxx>

Hi Luis,

Just some quick questions - are there any plans to use these in-kernel
module aliases anywhere else? Or are you using them just for debugging?

And if it's only for debugging, what's the benefit of printing the
aliases in-kernel when one could already use modinfo to print the
exact same information (namely, in-kernel module name, which was
recently added by Kees, + aliases)? We're essentially parsing the
.modinfo section of the module binary in two different places, just
that this patchset does it in-kernel and modinfo does it from
userspace, so I'm curious why we want to bring this into the kernel as
well without any additional users..

Thanks!

Jessica