aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/sumversion.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-07-18kbuild: remove the first line of *.mod filesMasahiro Yamada1-7/+2
The current format of *.mod is like this: line 1: directory path to the .ko file line 2: a list of objects linked into this module line 3: unresolved symbols (only when CONFIG_TRIM_UNUSED_KSYMS=y) Now that *.mod and *.ko are created in the same directory, the line 1 provides no valuable information. It can be derived by replacing the extension .mod with .ko. In fact, nobody uses the first line any more. Cut down the first line. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-07-18kbuild: create *.mod with full directory path and remove MODVERDIRMasahiro Yamada1-13/+3
While descending directories, Kbuild produces objects for modules, but do not link final *.ko files; it is done in the modpost. To keep track of modules, Kbuild creates a *.mod file in $(MODVERDIR) for every module it is building. Some post-processing steps read the necessary information from *.mod files. This avoids descending into directories again. This mechanism was introduced in 2003 or so. Later, commit 551559e13af1 ("kbuild: implement modules.order") added modules.order. So, we can simply read it out to know all the modules with directory paths. This is easier than parsing the first line of *.mod files. $(MODVERDIR) has a flat directory structure, that is, *.mod files are named only with base names. This is based on the assumption that the module name is unique across the tree. This assumption is really fragile. Stephen Rothwell reported a race condition caused by a module name conflict: https://lkml.org/lkml/2019/5/13/991 In parallel building, two different threads could write to the same $(MODVERDIR)/*.mod simultaneously. Non-unique module names are the source of all kind of troubles, hence commit 3a48a91901c5 ("kbuild: check uniqueness of module names") introduced a new checker script. However, it is still fragile in the build system point of view because this race happens before scripts/modules-check.sh is invoked. If it happens again, the modpost will emit unclear error messages. To fix this issue completely, create *.mod with full directory path so that two threads never attempt to write to the same file. $(MODVERDIR) is no longer needed. Since modules with directory paths are listed in modules.order, Kbuild is still able to find *.mod files without additional descending. I also killed cmd_secanalysis; scripts/mod/sumversion.c computes MD4 hash for modules with MODULE_VERSION(). When CONFIG_DEBUG_SECTION_MISMATCH=y, it occurs not only in the modpost stage, but also during directory descending, where sumversion.c may parse stale *.mod files. It would emit 'No such file or directory' warning when an object consisting a module is renamed, or when a single-obj module is turned into a multi-obj module or vice versa. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Nicolas Pitre <nico@fluxnic.net>
2018-05-03modpost: delete stale commentRasmus Villemoes1-8/+1
Commit 7840fea200cd ("kbuild: Fix computing srcversion for modules") fixed the comment above parse_source_files to refer to the new source_ line, but left this one behind that could still give the impression that drivers/net/dummy.c appears in the deps_ variable. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2014-06-10kbuild: trivial - use tabs for code indent where possibleMasahiro Yamada1-2/+2
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-11-06kbuild: replace unbounded sprintf call in modpostKees Cook1-1/+1
The modpost tool could overflow its stack buffer if someone was running with an insane shell environment. Regardless, it's technically a bug, so this fixes it to truncate the string instead of seg-faulting. Found by Coverity. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2011-03-13kbuild: Fix computing srcversion for modulesMichal Marek1-2/+17
Recent change to fixdep: commit b7bd182176960fdd139486cadb9962b39f8a2b50 Author: Michal Marek <mmarek@suse.cz> Date: Thu Feb 17 15:13:54 2011 +0100 fixdep: Do not record dependency on the source file itself changed the format of the *.cmd files without realizing that it is also used by modpost. Put the path to the source file to the file back, in a special variable, so that modpost sees all source files when calculating srcversion for modules. Reported-and-tested-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-21trivial: remove references to non-existent include/linux/config.hMarkus Heidelberg1-2/+0
Ignore drivers/staging/ since it is very likely that new drivers introduce it again. Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2008-10-29kbuild: prevent modpost from looking for a .cmd file for a static library linked into a moduleAshutosh Naik1-1/+11
This fixes a compile time warning which occurs whenever a static library is linked into a kernel module. MODPOST tries to look for a ".<modulename>.cmd" file to look for its dependencies, but that file doesn't exist or get generated for static libraries. This patch prevents modpost from looking for a .cmd file when a module is linked with a static library [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Ashutosh Naik <ashutosh.naik@gmail.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-05-19kbuild: include limits.h in sumversion.c for PATH_MAXMike Frysinger1-0/+1
POSIX says limits.h defines PATH_MAX so we should include it (which fixes compiling on some systems like OS X). Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-05-02kbuild: do not emit src version warning for non-modulesSam Ravnborg1-3/+2
modpost is now called with .o files that are not modules. So do not warn if there is no corresponding .mod file listing .o files (in .tmp_versions/). Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-02-19kbuild: do not segfault in modpost if MODVERDIR is not definedSam Ravnborg1-3/+6
A combination of calling modpost with option -a and MODVERDIR undefined caused segmentation fault. So provide a default value and accept the error messages it generates instead. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-02-19kbuild: use warn()/fatal() consistent in modpostSam Ravnborg1-14/+9
modpost.c provides warn() and fatal() - so use them all over the place. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2005-07-27[PATCH] kbuild: signed char fixes for scriptsJ.A. Magallon1-4/+4
This time I did not break anything... and they shut up gcc4 ;) Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2005-04-16Linux-2.6.12-rc2Linus Torvalds1-0/+498
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!