Revision tags: release/14.2.0 |
|
#
968bcca2 |
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
libkldelf: add a private library for kernel/kld-related ELF parsing
The libkldelf library was originally a part of kldxref(8). It exposed ELF parsing helpers specialized in parsing KLDs and the kern
libkldelf: add a private library for kernel/kld-related ELF parsing
The libkldelf library was originally a part of kldxref(8). It exposed ELF parsing helpers specialized in parsing KLDs and the kernel executable. The library can be used to read metadata such as linker_set, mod_depend, mod_version and PNP match info, and raw data from the ELF.
To promote the reuse of the facilities the ELF parsing code is separated from kldxref(8) into a new private library.
For now, libkldelf's source files will be compiled into kldxref(8) directly if kldxref is built during bootstrapping phase. The reason is linking kldxref(8) against the libkldelf static library has an unwanted side effect which renders the linker sets inside the libkldelf implementation empty if the static library is not build by ld -r all the .o files into a single .o before producing the static library.
Sponsored by: Juniper Networks, Inc. Reviewed by: markj Suggested by: jrtc27, markj Differential Revision: https://reviews.freebsd.org/D46719
show more ...
|
#
50c64df2 |
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
Revert "libkldelf: add a private library for kernel/kld-related ELF parsing"
This reverts commit 0a2cfd653e86ac41c4e6e32a449d133c0ee6d677.
|
#
0a2cfd65 |
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
libkldelf: add a private library for kernel/kld-related ELF parsing
The libkldelf library was originally a part of kldxref(8). It exposed ELF parsing helpers specialized in parsing KLDs and the kern
libkldelf: add a private library for kernel/kld-related ELF parsing
The libkldelf library was originally a part of kldxref(8). It exposed ELF parsing helpers specialized in parsing KLDs and the kernel executable. The library can be used to read metadata such as linker_set, mod_depend, mod_version and PNP match info, and raw data from the ELF.
To promote the reuse of the facilities the ELF parsing code is separated from kldxref(8) into a new private library.
kldxref(8) is modified to link against the libkldelf library.
Sponsored by: Juniper Networks, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46719
show more ...
|
Revision tags: release/13.4.0 |
|
#
97c31cc8 |
| 12-Aug-2024 |
Jessica Clarke <jrtc27@FreeBSD.org> |
kldxref: Clarify ambiguous comment
This previously read, to me at least, as if the not only applied to ending with ".ko", not to the entire rest of the sentence, and thus the implementation looked w
kldxref: Clarify ambiguous comment
This previously read, to me at least, as if the not only applied to ending with ".ko", not to the entire rest of the sentence, and thus the implementation looked wrong. The history of D43507 however shows that the behaviour is as intended.
show more ...
|
Revision tags: release/14.1.0 |
|
#
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__, b
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
show more ...
|
#
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 |
| 16-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-pointe
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
show more ...
|
Revision tags: release/13.3.0 |
|
#
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
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
show more ...
|
#
2b92b754 |
| 29-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
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
show more ...
|
#
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 p
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.
show more ...
|
#
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 gen
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
show more ...
|
#
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 chec
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
show more ...
|
#
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
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
show more ...
|
Revision tags: release/14.0.0 |
|
#
b3e76948 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
Revision tags: release/13.2.0 |
|
#
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
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
show more ...
|
Revision tags: release/12.4.0, release/13.1.0, release/12.3.0 |
|
#
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 requireme
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
show more ...
|
Revision tags: release/13.0.0, release/12.2.0 |
|
#
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 t
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
show more ...
|
Revision tags: release/11.4.0, release/12.1.0, release/11.3.0 |
|
#
0269ae4c |
| 06-Jun-2019 |
Alan Somers <asomers@FreeBSD.org> |
MFHead @348740
Sponsored by: The FreeBSD Foundation
|
#
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
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
show more ...
|
Revision tags: release/12.0.0 |
|
#
01d4e214 |
| 05-Oct-2018 |
Glen Barber <gjb@FreeBSD.org> |
MFH r338661 through r339200.
Sponsored by: The FreeBSD Foundation
|
#
ce44d808 |
| 27-Sep-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r338731 through r338987.
|
#
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 th
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)
show more ...
|
#
ee150a33 |
| 15-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 ne
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@
show more ...
|
Revision tags: release/11.2.0 |
|
#
a35ddaca |
| 17-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 decla
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
show more ...
|