summaryrefslogtreecommitdiff
path: root/usr.sbin/kldxref
Commit message (Collapse)AuthorAgeFilesLines
* kldxref: Avoid buffer overflows in parse_pnp_listJessica Clarke2020-10-151-20/+25
| | | | | | | | | | | | | | | | | We convert a string like "W32:vendor/device" into "I:vendor;I:device", where the output is longer than the input, but only allocate space equal to the length of the input, leading to a buffer overflow. Instead use open_memstream so we get a safe dynamically-grown buffer. Found by: CHERI Reviewed by: imp, jhb (mentor) Approved by: imp, jhb (mentor) Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D26637 Notes: svn path=/head/; revision=366736
* Bump kldxref's MAXSEGS to 16, to stop complaints about the kernelDimitry Andric2020-08-201-1/+1
| | | | | | | | | | | | supposedly having too many segments, when lld 11 links it. Such kernels should load just fine. Note that we may still do some tweaking of our kernel linker scripts, to lower the number of segments, although the exact benefit is not entirely clear. Notes: svn path=/head/; revision=364435
* - Cleanups related to sparc64 removal.Yoshihiro Takahashi2020-07-281-71/+0
| | | | | | | | | | - Remove remains of sparc64 files. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D25831 Notes: svn path=/head/; revision=363644
* pkgbase: Put a lot of binaries and lib in FreeBSD-runtimeEmmanuel Vadot2019-09-051-0/+1
| | | | | | | | | | | | All of them are needed to be able to boot to single user and be able to repair a existing FreeBSD installation so put them directly into FreeBSD-runtime. Reviewed by: bapt, gjb Differential Revision: https://reviews.freebsd.org/D21503 Notes: svn path=/head/; revision=351855
* kldxref(8): Sort MDT_MODULE info first in linker.hints outputConrad Meyer2019-05-271-8/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | MDT_MODULE info is required to be ordered before any other MDT metadata for a given kld because it serves as an implicit record boundary between distinct klds for linker.hints consumers. kldxref(8) has previously relied on the assumption that MDT_MODULE was ordered relative to other module metadata in kld objects by source code ordering. However, C does not require implementations to emit file scope objects in any particular order, and it seems that GCC 6.4.0 and/or binutils 2.32 ld may reorder emitted objects with respect to source code ordering. So: just take two passes over a given .ko's module metadata, scanning for the MDT_MODULE on the first pass and the other metadata on subsequent passes. It's not super expensive and not exactly a performance-critical piece of code. This ensures MDT_MODULE is always ordered before MDT_PNP_INFO and other MDTs, regardless of compiler/linker movement. As a fringe benefit, it removes the requirement that care be taken to always order MODULE_PNP_INFO after DRIVER_MODULE in source code. Reviewed by: emaste, imp Differential Revision: https://reviews.freebsd.org/D20405 Notes: svn path=/head/; revision=348309
* Parse MIPS relocations to unbreak kldxref on MIPS.John Baldwin2019-04-241-0/+99
| | | | | | | | | | | | | | Parse the R_MIPS_32 and R_MIPS_64 relocations. Both Elf_Rel and Elf_Rela relocations are handled since O32 MIPS uses Elf_Rel while N64 uses Elf_Rela. Note that R_MIPS_32 is only handled for 32-bit mips and R_MIPS_64 for 64-bit. N32 is untested. Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D19870 Notes: svn path=/head/; revision=346651
* Fix kldxref on PowerPC64Leandro Lupori2019-02-272-3/+10
| | | | | | | | | | | | | | | | | | When using kldxref on kernel modules built with clang8 + lld8, kldxref would be unable to find the modules metadata information, because PowerPC64 was using the ef_nop.c implementation of ef_reloc(). When GNU LD was used, it was also relocating the metadata section of the .ko file. LLD does not do this, but only generate dynamic relocations for it. With minor changes, ef_powerpc.c can now work for PowerPC64 too. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D19370 Notes: svn path=/head/; revision=344620
* kldxref: use appropriate Elf_Off type for offsetsEd Maste2018-11-091-18/+19
| | | | | | | | | | | Submitted by: Mitchell Horne <mhorne063@gmail.com> Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13957 Notes: svn path=/head/; revision=340285
* Add support for relocations in RISC-V kernel modules to kldxref.John Baldwin2018-10-081-0/+78
| | | | | | | | | | Reviewed by: br, markj Approved by: re (gjb) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D17415 Notes: svn path=/head/; revision=339242
* Relax syntax requirements of source stringWarner Losh2018-09-261-0/+4
| | | | | | | | | | | | The original spec for the strings describing the PNP info didn't allow spaces. Several times now people have broken the install by including them. Relax the syntax to allow them after the ; which is where people's muscle memory tends to put them. Approved by: re@ (gjb) Notes: svn path=/head/; revision=338952
* Use EF_SEG_READ_STRING instead of EF_SEG_READ when reading strings.Warner Losh2018-07-151-2/+2
| | | | | | | | | | | | | | | | | | | | Normally, we can get away with just reading the 1k buffer for the string, since the placement of the data is generally no where near the end of the file. However, it's possible that the string is within the last 1k of the file, in which case the read will fail, and we'll not produce the proper records needed for devmatch to work. By reading using EF_SEG_READ_STRING, we automatically work around these problems while still retaining safety. This fix a problem with devmatch where we wouldn't load certain modules (like ums). This didn't always happen (my tree didn't exhibit it, while nathan's did because his optimization options were more agressive). Reported by: nathanw@ Notes: svn path=/head/; revision=336302
* Fixup minor nits in the PNP_INFO protocol.Warner Losh2018-02-171-3/+3
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=329437
* Adjust format string to fix build.John Baldwin2018-01-181-1/+1
| | | | Notes: svn path=/head/; revision=328104
* Tidy some whitespace.John Baldwin2018-01-181-2/+2
| | | | Notes: svn path=/head/; revision=328103
* kldxref: additional sytle(9) cleanupEd Maste2018-01-171-16/+16
| | | | | | | | Reported by: kib (via comments in D13957) Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=328095
* kldxref: improve style(9)Ed Maste2018-01-175-226/+228
| | | | | | | | | | | | | | | | | | Address style issues including some previously raised in D13923. - Use designated initializers for structs - Always use bracketed return style - No initialization in declarations - Align function prototype names - Remove old commented code/unused includes Submitted by: Mitchell Horne <mhorne063@gmail.com> Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13943 Notes: svn path=/head/; revision=328094
* kldxref: handle modules with md_cval at the end of allocated sectionsEd Maste2018-01-164-2/+54
| | | | | | | | | | | | | | | | | | | Attempting to retrieve an md_cval string from a kernel module with kldxref would throw a offset error for modules created using lld, since this value would be placed at the end of all allocated sections. Add an ef_read_seg_string method to the ef interface, to allow reading strings of varying size without attempting to read beyond the segment's bounds. PR: 224875 Submitted by: Mitchell Horne <mhorne063@gmail.com> Reviewed by: cem, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13923 Notes: svn path=/head/; revision=328052
* kldxref: correct function names in warning messagesEd Maste2018-01-022-3/+3
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=327503
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-275-0/+10
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-183-3/+9
| | | | | | | | | | | | | | | | | | | | The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* kldxref: bump MAXSEGS to 3Ed Maste2017-02-101-1/+1
| | | | | | | | | | | | | | ld.bfd generates two PT_LOAD segments, but certain linkers or linker configurations generate three PT_LOAD segments (one additional for RELRO). PR: 216975 Reported by: Shawn Webb MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=313563
* kldxref: s/sections/segments/ in warning messageEd Maste2017-02-101-1/+1
| | | | | | | | | The message refers to program header segments, not sections. PR: 216975 Notes: svn path=/head/; revision=313562
* Use roundup2() from sys/param.h.Marcelo Araujo2016-08-231-1/+1
| | | | Notes: svn path=/head/; revision=304678
* Use NULL instead of 0 for pointers.Marcelo Araujo2016-05-161-1/+1
| | | | | | | MFC after: 2 weeks. Notes: svn path=/head/; revision=299878
* Add support for relocating AArch64 modules to kldxref. This fixes an errorAndrew Turner2016-01-131-0/+77
| | | | | | | | | | message where it fails to read the module as the unrelocated addresses are zero. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=293852
* Augment kldxref to find the new MODULE_PNP_INFO records now inWarner Losh2015-12-111-3/+344
| | | | | | | | | | modules, simplify them into a more normal form and write them to linker.hints. Differential Review: https://reviews.freebsd.org/D3461 Notes: svn path=/head/; revision=292078
* Add debug file extension to kldxref(8) after r288176Ed Maste2015-10-021-1/+4
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=288490
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-272-2/+5
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Merge head from 7/28Simon J. Gerraty2014-08-191-3/+3
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=270164
| * | Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * | Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * | Merge from headSimon J. Gerraty2014-05-081-8/+9
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265720
| * \ \ Merge headSimon J. Gerraty2014-04-281-1/+1
| |\ \ \ | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265044
| * \ \ \ Merge head@256284Simon J. Gerraty2013-10-131-1/+11
| |\ \ \ \ | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=256424
| * \ \ \ \ Merge from headSimon J. Gerraty2013-09-055-7/+1
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=255263
| * | | | | | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | | | | | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | | | | | Sync from headSimon J. Gerraty2012-11-041-4/+3
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=242545
| * | | | | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | | | | | | Reserve and ignore the a new module metadata type MDT_PNP_INFO forWarner Losh2015-01-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=277205
* | | | | | | | Bump the largest record we can cope with from 1k to 8k. Other users ofWarner Losh2014-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the hints file don't have any real limits, and longer records will need to be written shortly. Notes: svn path=/head/; revision=275940
* | | | | | | | Remove -fno-strict-alias, as it is no longer needed.Warner Losh2014-12-181-1/+0
| |_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | Notes: svn path=/head/; revision=275904
* | | | | | | use .Mt to mark up email addresses consistently (part2)Baptiste Daroussin2014-06-201-3/+3
| |_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR: 191174 Submitted by: Franco Fichtner <franco@lastsummer.de> Notes: svn path=/head/; revision=267668
* | | | | | kldxref: Clean up error reportingEd Maste2014-04-301-8/+9
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Omit "too many sections" warnings if the ELF file is not dynamically linked (and is therefore skipped anyway), and otherwise output it only once. An errant core file would previously cause kldxref to output a number of warnings. Also introduce a MAXSEGS #define and replace literal 2 with it, to make comparisons clear. Reviewed by: kib Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=265157
* | | | | kldxref: Add static keyword to the new function only used in the same file.Jilles Tjoelker2013-10-161-1/+1
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The WARNS level is not such that the omission broke the build. Reported by: mdf Notes: svn path=/head/; revision=256650
* | | | kldxref: Do not depend on the directory order.Jilles Tjoelker2013-10-041-1/+11
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=256060
* | | Use calloc().Xin LI2013-06-051-2/+1
| | | | | | | | | | | | | | | | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=251440