Commit Graph

25 Commits

Author SHA1 Message Date
Marcelo Araujo
bf6911cd08 Use roundup2() from sys/param.h. 2016-08-23 13:43:43 +00:00
Marcelo Araujo
1dcace5ba0 Use NULL instead of 0 for pointers.
MFC after:	2 weeks.
2016-05-16 01:12:56 +00:00
Warner Losh
493b2041d6 Augment kldxref to find the new MODULE_PNP_INFO records now in
modules, simplify them into a more normal form and write them to
linker.hints.

Differential Review: https://reviews.freebsd.org/D3461
2015-12-11 05:27:55 +00:00
Ed Maste
113a1a2139 Add debug file extension to kldxref(8) after r288176
After r288176 kernel debug files have the extension .debug.  They also
moved to /usr/lib/debug/boot/kernel by default so in the normal case
kldxref does not encounter them.  A src.conf(5) setting may be used to
continue installing them in /boot/kernel though, so have kldxref skip
.debug files in addition to .symbols files.

Reported by:	fabient
Sponsored by:	The FreeBSD Foundation
2015-10-02 13:16:06 +00:00
Warner Losh
b03747e983 Reserve and ignore the a new module metadata type MDT_PNP_INFO for
associating an optional PNP hint table with this module. In the
future, when these are added, these changes will silently ignore the
new type they would otherwise warn about. It will always be safe to
ignore this data. Get this into the builds today for some future
proofing.

MFC After: 3 days
2015-01-15 00:46:30 +00:00
Warner Losh
e808299c02 Bump the largest record we can cope with from 1k to 8k. Other users of
the hints file don't have any real limits, and longer records will
need to be written shortly.
2014-12-19 18:45:52 +00:00
Jilles Tjoelker
5d452cea64 kldxref: Add static keyword to the new function only used in the same file.
The WARNS level is not such that the omission broke the build.

Reported by:	mdf
2013-10-16 20:04:06 +00:00
Jilles Tjoelker
6d9cb20bd7 kldxref: Do not depend on the directory order.
Sort the filenames to get a consistent result between machines of the same
architecture.

Also, sort FTS_D entries after other entries so kldxref -R works properly in
the uncommon case that a directory contains both subdirectories and modules.
Previously, this may have happened to work, depending on the order of files
in the directory.

PR:		bin/182098
Submitted by:	Derek Schrock (original version)
Tested by:	Derek Schrock
Approved by:	re (delphij)
MFC after:	1 week
2013-10-04 21:25:55 +00:00
Xin LI
ac8e13960d Remove unneeded reference to link.h (sys/link_elf.h).
MFC after:	2 weeks
2013-06-05 21:55:20 +00:00
Luigi Rizzo
9cb138bb35 various cleanups including:
+ check a possible buffer overflow when creating a temp file,
  submitted by Christoph Mallon
+ remove stale struct definitions
+ clarify the use of dflag and remove useless checks

MFC after:	3 days
2009-01-06 14:23:38 +00:00
Luigi Rizzo
ddce581880 Make the linker.hints file have mode 644 instead of 600.
There is nothing secret in the file, and the missing read
permission breaks diskless operation.

MFC after:	4 weeks
2008-11-30 14:20:08 +00:00
Warner Losh
2fdfd0fee2 Use safe strlcpy rather than unsafe strncpy. After marcel's last fix,
there was still one overflow possible.  strlcpy is faster anyway
because it doesn't unexpectedly zero the entire length of the string
when copying short strings....
2006-08-05 18:22:11 +00:00
Marcel Moolenaar
77a6f8ac6f Fix (static) buffer overflow bug. The dest buffer is of size MAXPATHLEN,
so dest[MAXPATHLEN] falls outside the buffer.  This bug corrupted
arenas[0] defined in libc's malloc.c on PowerPC when kldxref is shared,
which triggered a delayed SIGSERV.
2006-08-04 21:28:42 +00:00
Marcel Moolenaar
9ceddbd532 Change maketempfile() to return a FILE* so as to eliminate the fopen()
that immediately follows the only call to it. maketempfile() uses
mkstemp(), so the temporary file has already been opened and using
fopen() again just opens the file twice. This also fixes the invalid
mode used on the fopen().
While here, assign NULL to fxref after fclose() because we test for
fxref being !NULL to determine if we have the (temporary) hints file
open.
2006-07-29 19:39:03 +00:00
Ruslan Ermilov
9f5529b45a Skip .symbols files. 2005-11-11 08:13:18 +00:00
Ian Dowse
4a8b7e33b7 Add support for reading ELF relocatable object file format modules. 2004-08-27 00:58:40 +00:00
Ian Dowse
9772dc2aff Call the file format specific code through a table of function
pointers and remove knowledge of the file format from kldxref.c.
This will make it possible to support more than one file format.
2004-08-27 00:51:21 +00:00
Ruslan Ermilov
cb40c7d188 Fixed manpage's synopsis, and synchronized it with the program's usage(). 2004-06-01 09:34:04 +00:00
Maxim Sobolev
b7abc67ea4 Check that specified in the command line path is actually a directory,
otherwise we are risking to coredump later on.
2004-04-30 00:20:58 +00:00
Dag-Erling Smørgrav
76798703a5 Remove bogus (void **) casts. This unbreaks the -O2 build. 2004-03-15 17:43:36 +00:00
Jake Burkholder
1eed250ad8 Fix kldxref on sparc64 by allowing non-trivial relocations to be performed
on variables read out of raw kld files.  Unlike other platforms the value
will be in an Elf_Rela, not in the data section of the elf file.

Submitted by:	Hartmut Brandt <brandt@fokus.gmd.de>
PR:		46730
Tested on:	alpha (obrien), i386, sparc64
2003-01-21 03:51:53 +00:00
Dag-Erling Smørgrav
d397408818 Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
2002-04-22 13:44:47 +00:00
John Baldwin
8c7911ebe2 Remove unnecessary machine/bootinfo.h includes.
Submitted by:	jake
2002-01-03 19:10:49 +00:00
Mike Heffner
87e5cd7c1a WARNS=2 cleanup.
PR:		bin/32567
MFC after:	2 weeks
2001-12-09 07:22:26 +00:00
Peter Wemm
9c6f92408c Add kldxref(8), for maintaining the linker.hints file for translating
module->pathname.ko.  It supports only ELF for now.

Submitted by:   bp  (with some minor tweaks)
2001-09-11 01:13:15 +00:00