#
364c014d |
|
26-May-2024 |
Warner Losh <imp@FreeBSD.org> |
cross-tools: fts has different types for cmp routine fts has different types for its compare rotuine. Other systems, not 4.4BSD based, have a non-const version. Before we tested against __GLIBC__, but now we test against __linux__ because that's Linux's API and musl doesn't define __GLIBC__. In addition, link against libftl on this platform since musl doesn't include ftl routines in libc, but rather in libftl. Co-authored-by: Val Packett <val@packett.cool> Sponsored by: Netflix Pull Request: https://github.com/freebsd/freebsd-src/pull/1066 Reviewed by: val_packett.cool Differential Revision: https://reviews.freebsd.org/D45349
|
#
ec8a394d |
|
11-Apr-2024 |
Elyes Haouas <ehaouas@noos.fr> |
usr.sbin: Remove repeated words Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/887
|
#
75464941 |
|
15-Mar-2024 |
Jessica Clarke <jrtc27@FreeBSD.org> |
kldxref: Fix bootstrapping on macOS with Clang 16 / Apple Clang 15 macOS, like Linux, does not include an outer const qualifier for its fts_open callback arguments, so -Wincompatible-function-pointer-types also picks this up and breaks the build now Clang 16 makes it an error by default. Extend the existing Linux support to fix this. MFC after: 1 week
|
#
f4613af4 |
|
02-Feb-2024 |
Mina Galić <freebsd@igalic.co> |
kldxref: Fix maketempfile function's way of finding the root dir Rather than assuming that the "root" is passed as directory and will be marked by a trailing slash, we just assume that the directory, which has been checked previously to be a directory, is a directory. This fixes an inconsistency between `kldxref /boot/modules`, which tries to create the temp file in `/boot/`, and `kldxref /boot/modules/`, which tries to create it in `/boot/modules/` itself. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1093
|
#
2b92b754 |
|
28-Jan-2024 |
Warner Losh <imp@FreeBSD.org> |
kldxref: Be more conservative about what we reject. kldxref anything whose name doesn't end in .ko or that has no dots (eg the kernel). Sponsored by: Netflix Reviewed by: jrtc27, jhb Differential Revision: https://reviews.freebsd.org/D43507
|
#
30887c7d |
|
02-Jan-2024 |
Alex Richardson <arichardson@FreeBSD.org> |
kldxref: fix bootstrapping on Linux with Clang 16 The glibc fts_open() callback type does not have the second const qualifier and it appears that Clang 16 errors by default for mismatched function pointer types. Add an ifdef to handle this case.
|
#
0299afdf |
|
12-Dec-2023 |
John Baldwin <jhb@FreeBSD.org> |
kldxref: Make use of libelf to be a portable cross tool This allows kldxref to operate on kernel objects from any architecture, not just the native architecture. In particular, this will permit generating linker.hints files as part of a cross-arch release build. - elf.c is a new file that includes various wrappers around libelf including routines to read ELF data structures such as program and section headers and ELF relocations into the "generic" forms described in <gelf.h>. This file also provides routines for converting a linker set into an array of addresses (GElf_Addr) as well as reading architecture-specific mod_* structures and converting them into "generic" Gmod_* forms where pointers are replaced with addresses. - The various architecture-specific reloc handlers now use GElf_* types for most values (including GElf_Rel and GElf_Rela for relocation structures) and use routines from <sys/endian.h> to read and write target values. A new linker set matches reloc handlers to specific ELF (class, encoding, machine) tuples. - The bits of kldxref.c that write out linker.hints now use the encoding (ELFDATA2[LM]SB) of the first file encountered in a directory to set the endianness of the output file. Input files with a different architecture in the same directory are skipped with a warning. In addition, the initial version record for the file must be deferred until the first record is finished since the architecture of the output file is not known until then. - Various places that used 'sizeof(void *)' throughout now use 'elf_pointer_size()' to determine the size of a pointer in the target architecture. Tested by: amd64 binary on both amd64 and i386 /boot/kernel Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42966
|
#
c40fa3dc |
|
12-Dec-2023 |
John Baldwin <jhb@FreeBSD.org> |
kldxref: Refactor PNP entry parsing, no functional change - Add a free_pnp_list to complement parse_pnp_list. Add freeing of 'new_desc' which was previously leaked. - Move body of loop that checked a single pnp list element against a table entry into a parse_pnp_entry function to reduce indentation and split parse_entry into a smaller function. - Similarly, split out a record_pnp_info function from parse_entry which builds the pnp_list and walks a table. Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42965
|
#
4a3cf5f3 |
|
12-Dec-2023 |
John Baldwin <jhb@FreeBSD.org> |
Stop #defining FREEBSD_ELF This was originally used (along with FREEBSD_AOUT) to prefer the use of ELF in various tools instead of a.out as part of the a.out to ELF transition in the 3.x days. The last use of it was removed from <link.h> in commit 66422f5b7a1a6055f0b2358268eb902aab6e2e3e back in 2002, but various files still #define it. Reviewed by: kevans, imp, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42964
|
#
b3e76948 |
|
16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: two-line .h pattern Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
#
773c13c6 |
|
25-Feb-2023 |
Mina Galić <freebsd@igalic.co> |
kldxref: skip .pkgsave files This should help people transitioning from traditional setups to pkgbase experience a lot less friction. We do this by skipping all files containing two dots. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/661 Differential Revision: https://reviews.freebsd.org/D27959
|
#
d7751071 |
|
20-May-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
kldxref: do not error out if specified path is not directory, for -d mode kldxref(8) is the only tool that can dump FreeBSD kernel module metadata, with the -d option. But the command line requirements for that are inconvenient, since parser requires that argv[1] is a directory containing whole set of modules to generate xref file. For -d, allow argv[0] to be a regular file, now it is possible to do e.g. $ kldxref -d /boot/kernel/ufs.ko to see only ufs.ko metadata. Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30368
|
#
a98fa52e |
|
15-Oct-2020 |
Jessica Clarke <jrtc27@FreeBSD.org> |
kldxref: Avoid buffer overflows in parse_pnp_list 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
|
#
9c1fa7a4 |
|
27-May-2019 |
Conrad Meyer <cem@FreeBSD.org> |
kldxref(8): Sort MDT_MODULE info first in linker.hints output 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
|
#
517a1827 |
|
26-Sep-2018 |
Warner Losh <imp@FreeBSD.org> |
Relax syntax requirements of source string 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)
|
#
ee150a33 |
|
14-Jul-2018 |
Warner Losh <imp@FreeBSD.org> |
Use EF_SEG_READ_STRING instead of EF_SEG_READ when reading strings. 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@
|
#
a35ddaca |
|
16-Feb-2018 |
Warner Losh <imp@FreeBSD.org> |
Fixup minor nits in the PNP_INFO protocol. Sponsored by: Netflix
|
#
e2d0802c |
|
17-Jan-2018 |
Ed Maste <emaste@FreeBSD.org> |
kldxref: improve style(9) 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
|
#
da67e6e6 |
|
16-Jan-2018 |
Ed Maste <emaste@FreeBSD.org> |
kldxref: handle modules with md_cval at the end of allocated sections 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
|
#
df57947f |
|
18-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
spdx: initial adoption of licensing ID tags. 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
|
#
bf6911cd |
|
23-Aug-2016 |
Marcelo Araujo <araujo@FreeBSD.org> |
Use roundup2() from sys/param.h.
|
#
1dcace5b |
|
15-May-2016 |
Marcelo Araujo <araujo@FreeBSD.org> |
Use NULL instead of 0 for pointers. MFC after: 2 weeks.
|
#
493b2041 |
|
10-Dec-2015 |
Warner Losh <imp@FreeBSD.org> |
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
|
#
113a1a21 |
|
02-Oct-2015 |
Ed Maste <emaste@FreeBSD.org> |
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
|
#
b03747e9 |
|
14-Jan-2015 |
Warner Losh <imp@FreeBSD.org> |
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
|
#
e808299c |
|
19-Dec-2014 |
Warner Losh <imp@FreeBSD.org> |
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.
|
#
5d452cea |
|
16-Oct-2013 |
Jilles Tjoelker <jilles@FreeBSD.org> |
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
|
#
6d9cb20b |
|
04-Oct-2013 |
Jilles Tjoelker <jilles@FreeBSD.org> |
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
|
#
ac8e1396 |
|
05-Jun-2013 |
Xin LI <delphij@FreeBSD.org> |
Remove unneeded reference to link.h (sys/link_elf.h). MFC after: 2 weeks
|
#
a7d5f7eb |
|
19-Oct-2010 |
Jamie Gritton <jamie@FreeBSD.org> |
A new jail(8) with a configuration file, to replace the work currently done by /etc/rc.d/jail.
|
#
fe0506d7 |
|
09-Mar-2010 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Create the altix project branch. The altix project will add support for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting is a two-module system, consisting of a base compute module and a CPU expansion module. SGI's NUMAFlex architecture can be an excellent platform to test CPU affinity and NUMA-aware features in FreeBSD.
|
#
9cb138bb |
|
06-Jan-2009 |
Luigi Rizzo <luigi@FreeBSD.org> |
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
|
#
ddce5818 |
|
30-Nov-2008 |
Luigi Rizzo <luigi@FreeBSD.org> |
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
|
#
d7f03759 |
|
19-Oct-2008 |
Ulf Lilleengen <lulf@FreeBSD.org> |
- Import the HEAD csup code which is the basis for the cvsmode work.
|
#
2fdfd0fe |
|
05-Aug-2006 |
Warner Losh <imp@FreeBSD.org> |
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....
|
#
77a6f8ac |
|
04-Aug-2006 |
Marcel Moolenaar <marcel@FreeBSD.org> |
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.
|
#
9ceddbd5 |
|
29-Jul-2006 |
Marcel Moolenaar <marcel@FreeBSD.org> |
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.
|
#
9f5529b4 |
|
11-Nov-2005 |
Ruslan Ermilov <ru@FreeBSD.org> |
Skip .symbols files.
|
#
4a8b7e33 |
|
26-Aug-2004 |
Ian Dowse <iedowse@FreeBSD.org> |
Add support for reading ELF relocatable object file format modules.
|
#
9772dc2a |
|
26-Aug-2004 |
Ian Dowse <iedowse@FreeBSD.org> |
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.
|
#
cb40c7d1 |
|
01-Jun-2004 |
Ruslan Ermilov <ru@FreeBSD.org> |
Fixed manpage's synopsis, and synchronized it with the program's usage().
|
#
b7abc67e |
|
29-Apr-2004 |
Maxim Sobolev <sobomax@FreeBSD.org> |
Check that specified in the command line path is actually a directory, otherwise we are risking to coredump later on.
|
#
76798703 |
|
15-Mar-2004 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
Remove bogus (void **) casts. This unbreaks the -O2 build.
|
#
1eed250a |
|
20-Jan-2003 |
Jake Burkholder <jake@FreeBSD.org> |
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
|
#
d3974088 |
|
22-Apr-2002 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
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}/.
|
#
8c7911eb |
|
03-Jan-2002 |
John Baldwin <jhb@FreeBSD.org> |
Remove unnecessary machine/bootinfo.h includes. Submitted by: jake
|
#
87e5cd7c |
|
09-Dec-2001 |
Mike Heffner <mikeh@FreeBSD.org> |
WARNS=2 cleanup. PR: bin/32567 MFC after: 2 weeks
|
#
9c6f9240 |
|
10-Sep-2001 |
Peter Wemm <peter@FreeBSD.org> |
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)
|