#
7ef5c19b |
|
31-Mar-2024 |
Mark Johnston <markj@FreeBSD.org> |
kern linker: Don't invoke dtors without having invoked ctors I have a kernel module which fails to load because of an unrecognized relocation type. link_elf_load_file() fails before the module's ctors are invoked and it calls linker_file_unload(), which causes the module's dtors to be executed, resulting in a kernel panic. Add a flag to the linker file to ensure that dtors are not invoked if unloading due to an error prior to ctors being invoked. At the moment I only implemented this for link_elf_obj.c since link_elf.c doesn't invoke dtors, but I refactored link_elf.c to make them more similar. Fixes: 9e575fadf491 ("link_elf_obj: Invoke fini callbacks") Reviewed by: zlei, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D44559
|
#
c21bc6f3 |
|
21-Mar-2024 |
Bojan Novković <bnovkov@FreeBSD.org> |
ddb: Add CTF-based pretty printing Add basic CTF support and a CTF-powered pretty-printer to ddb. The db_ctf.* files expose a basic interface for fetching type data for ELF symbols, interacting with the CTF string table, and translating type identifiers to type data. The db_pprint.c file uses those interfaces to implement a pretty-printer for all kernel ELF symbols. The pretty-printer works with symbol names and arbitrary addresses: pprint struct thread 0xffffffff8194ad90 Pretty-printing currently only works after the root filesystem gets mounted because the CTF info is not available during early boot. Differential Revision: https://reviews.freebsd.org/D37899 Approved by: markj (mentor)
|
#
eccde5f4 |
|
20-Feb-2024 |
Warner Losh <imp@FreeBSD.org> |
sys/kern: Remove a few sys/cdefs.h around some elf things These sys/cdefs.h are no longer needed. Remove them in advance of other work in this area. Sponsored by: Netflix
|
#
cf7974fd |
|
20-Sep-2023 |
Zhenlei Huang <zlei@FreeBSD.org> |
sysctl: Update 'master' copy of vnet SYSCTLs on kernel environment variables change Complete phase three of 3da1cf1e88f8. With commit 110113bc086f, vnet sysctl variables can be loader tunable but the feature is limited. When the kernel modules have been initialized, any changes (e.g. via kenv) to kernel environment variable will not affect subsequently created VNETs. This change relexes the limitation by listening on kernel environment variable's set / unset events, and then update the 'master' copy of vnet SYSCTL or restore it to its initial value. With this change, TUNABLE_XXX_FETCH can be greately eliminated for vnet loader tunables. Reviewed by: glebius Fixes: 110113bc086f sysctl(9): Enable vnet sysctl variables to be loader tunable MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D41825
|
#
205821a7 |
|
09-Sep-2023 |
Zhenlei Huang <zlei@FreeBSD.org> |
kernel linker: Eliminate unneeded vnet propagation The module preload happens before vnet0 creation, at this moment the vnet list is empty thus invoking vnet_data_copy() during preload is a noop. With recent change 110113bc086f, for dynamic module load, aka via kldload, linker will do vnet propagation right after registering sysctls which happens after module load, then previous propagation (during module load) is redundant. No functional change intended. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D39852
|
#
110113bc |
|
09-Sep-2023 |
Zhenlei Huang <zlei@FreeBSD.org> |
sysctl(9): Enable vnet sysctl variables to be loader tunable Complete phase two of 3da1cf1e88f8. In 3da1cf1e88f8, the meaning of the flag CTLFLAG_TUN is extended to automatically check if there is a kernel environment variable which shall initialize the SYSCTL during early boot. It works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTLs which belong to VNETs. This change extends the meaning further, to allow it also works for the SYSCTLs which belong to VNETs. A typical usage is ``` VNET_DEFINE_STATIC(int, foo) = 0; SYSCTL_INT(_net, OID_AUTO, foo, CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(foo), 0, "Description of the foo loader tunable"); ``` Note that the implementation has a limitation. It behaves the same way as that of non-vnet loader tunables. That is, after the kernel or modules being initialized, any changes (e.g. via kenv) to kernel environment variable will not affect the corresponding vnet variable of subsequently created VNETs. To overcome it, we can use TUNABLE_XXX_FETCH to fetch the kernel environment variable into those vnet variables during vnet constructing. This change will fix the following SYSCTLs those belong to VNETs and have CTLFLAG_TUN flag: ``` net.add_addr_allfibs net.bpf.optimize_writers net.inet.tcp.fastopen.ccache_buckets net.link.bridge.inherit_mac net.link.bridge.ipfw_arp net.link.bridge.log_stp net.link.bridge.pfil_bridge net.link.bridge.pfil_local_phys net.link.bridge.pfil_member net.link.bridge.pfil_onlyip net.link.lagg.default_use_flowid net.link.lagg.default_use_numa net.link.lagg.default_flowid_shift net.link.lagg.lacp.debug net.link.lagg.lacp.default_strict_mode ``` Although the following vnet SYSCTLs have CTLFLAG_TUN flag, theirs values are re-fetched via TUNABLE_XXX_FETCH, thus are not affected by this change. ``` net.inet.ip.reass_hashsize net.inet.tcp.hostcache.cachelimit net.inet.tcp.hostcache.hashsize net.inet.tcp.hostcache.bucketlimit net.inet.tcp.syncache.bucketlimit net.inet.tcp.syncache.cachelimit net.inet.tcp.syncache.hashsize net.key.spdcache.maxentries net.key.spdcache.threshold ``` In memoriam: hselasky Discussed with: hselasky, glebius Fixes: 3da1cf1e88f8 Extend the meaning of the CTLFLAG_TUN flag ... MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D39638
|
#
685dc743 |
|
16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
#
4d846d26 |
|
10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
|
#
bb92cd7b |
|
24-Mar-2022 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: NDFREE(&nd, NDF_ONLY_PNBUF) -> NDFREE_PNBUF(&nd)
|
#
ecd8245e |
|
07-Nov-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
Kernel linkers: add emergency sysctl to restore old behavior allowing linking to static symbols from other files. Default the new settings to true, delaying the change of the kernel linker behavior for other day. Suggested by: emaste PR: 207898 Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32878
|
#
95c20faf |
|
07-Nov-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
kernel linker: do not read debug symbol tables for non-debug symbols In particular, this prevents resolving locals from other files. To access debug symbol tables, add LINKER_LOOKUP_DEBUG_SYMBOL and LINKER_DEBUG_SYMBOL_VALUES kobj methods, which are allowed to use any types of present symbols in all tables. PR: 207898 Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32878
|
#
c37c6f99 |
|
08-Dec-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
Style Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32878
|
#
7e1d3eef |
|
25-Nov-2021 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: remove the unused thread argument from NDINIT* See b4a58fbf640409a1 ("vfs: remove cn_thread") Bump __FreeBSD_version to 1400043.
|
#
b11e6fd7 |
|
25-Nov-2021 |
Mark Johnston <markj@FreeBSD.org> |
link_elf_obj: Process global ifunc relocs after other global relocs This is needed to ensure that resolvers that reference global symbols return correct results. Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33120
|
#
a7e4eb14 |
|
07-Nov-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
Kernel linkers: some style Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D32878
|
#
9e575fad |
|
29-Jul-2021 |
Mark Johnston <markj@FreeBSD.org> |
link_elf_obj: Invoke fini callbacks This is required for KASAN: when a module is unloaded, poisoned regions (e.g., pad areas between global variables) are left as such, so if they are reused as KLDs are loaded, false positives can arise. Reported by: pho, Jenkins Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31339
|
#
4aa157dd |
|
16-Mar-2021 |
Mark Johnston <markjdb@gmail.com> |
link_elf_obj: Add a case missing from 5e6989ba4f26 Fixes: 5e6989ba4f26 MFC after: 3 days Sponsored by: The FreeBSD Foundation
|
#
5e6989ba |
|
04-Mar-2021 |
Mark Johnston <markj@FreeBSD.org> |
link_elf_obj: Handle init_array sections in KLDs Reuse existing handling for .ctors, print a warning if multiple constructor sections are present. Destructors are not handled as of yet. This is required for KASAN. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29049
|
#
0659df6f |
|
12-Jan-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
vm_map_protect: allow to set prot and max_prot in one go. This prevents a situation where other thread modifies map entries permissions between setting max_prot, then relocking, then setting prot, confusing the operation outcome. E.g. you can get an error that is not possible if operation is performed atomic. Also enable setting rwx for max_prot even if map does not allow to set effective rwx protection. Reviewed by: brooks, markj (previous version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28117
|
#
d80126a6 |
|
19-Oct-2020 |
Mark Johnston <markj@FreeBSD.org> |
link_elf_obj: Colour VM objects This will cause the VM to back sufficiently large .text sections, such as those in zfs.ko or amdgpu.ko on amd64, with superpage mappings when possible. Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26802
|
#
44c705cf |
|
07-Oct-2020 |
Mitchell Horne <mhorne@FreeBSD.org> |
Handle kmod local relocation failures gracefully It is possible for elf_reloc_local() to fail in the unlikely case of an unsupported relocation type. If this occurs, do not continue to process the file. Reviewed by: kib, markj (earlier version) MFC after: 1 week Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26701
|
#
fbf2a778 |
|
08-Sep-2020 |
Konstantin Belousov <kib@FreeBSD.org> |
Convert allocations of the phys pager to vm_pager_allocate(). Future changes would require additional initialization of OBJT_PHYS objects, and vm_object_allocate() is not suitable for it. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D24652
|
#
6fed89b1 |
|
01-Sep-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
kern: clean up empty lines in .c and .h files
|
#
3ff65f71 |
|
30-Jan-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
Remove duplicated empty lines from kern/*.c No functional changes.
|
#
b249ce48 |
|
03-Jan-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: drop the mostly unused flags argument from VOP_UNLOCK Filesystems which want to use it in limited capacity can employ the VOP_UNLOCK_FLAGS macro. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D21427
|
#
f822c9e2 |
|
18-Oct-2019 |
Mark Johnston <markj@FreeBSD.org> |
Apply mapping protections to preloaded kernel modules on amd64. With an upcoming change the amd64 kernel will map preloaded files RW instead of RWX, so the kernel linker must adjust protections appropriately using pmap_change_prot(). Reviewed by: kib MFC after: 1 month Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21860
|
#
1d9eae9f |
|
18-Oct-2019 |
Mark Johnston <markj@FreeBSD.org> |
Apply mapping protections to .o kernel modules. Use the section flags to derive mapping protections. When multiple sections overlap within a page, the union of their protections must be applied. With r353701 the .text and .rodata sections are padded to ensure that this does not happen on amd64. Reviewed by: kib MFC after: 1 month Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21896
|
#
092bacb2 |
|
17-Oct-2019 |
Mark Johnston <markj@FreeBSD.org> |
Clean up some nits in link_elf_(un)load_file(). - Remove a redundant assignment of ef->address. - Don't return a Mach error number to the caller if vm_map_find() fails. - Use ptoa() and fix style. MFC after: 2 weeks Sponsored by: Netflix
|
#
6d775f0b |
|
16-Oct-2019 |
Mark Johnston <markj@FreeBSD.org> |
Use KOBJMETHOD_END in the kernel linker. MFC after: 1 week
|
#
5131cba6 |
|
02-Oct-2019 |
Mark Johnston <markj@FreeBSD.org> |
Use OBJT_PHYS VM objects for kernel modules. OBJT_DEFAULT incurs some unnecessary overhead given that kernel module pages cannot be paged out. Reviewed by: alc, kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21862
|
#
22bbc4b2 |
|
08-Aug-2019 |
Xin LI <delphij@FreeBSD.org> |
Convert DDB_CTF to use newer version of ZLIB. PR: 229763 Submitted by: Yoshihiro Ota <ota j email ne jp> Differential Revision: https://reviews.freebsd.org/D21176
|
#
f6e5ddff |
|
03-Jun-2019 |
Konstantin Belousov <kib@FreeBSD.org> |
Remove dead check. We already handled the case when symstrindex < 0 at line 680. Reported by: danfe using PVS-studio Sponsored by: The FreeBSD Foundation MFC after: 1 week
|
#
9afc5684 |
|
30-Oct-2018 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
Fix mips build after r339931. I erroneously thought that it was two 64bit platforms which use link_elf_obj.c. PR: 228854 Reported by: ci.f.o. MFC after: 3 days X-MFC with: r339931 Pointyhat to: bz
|
#
0f823b64 |
|
30-Oct-2018 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
As a follow-up to r339930 and various reports implement logging in case we fail during module load because the pcpu or vnet module sections are full. We did return a proper error but not leaving any indication to the user as to what the actual problem was. Even worse, on 12/13 currently we are seeing an unrelated error (ENOSYS instead of ENOSPC, which gets skipped over in kern_linker.c) to be printed which made problem diagnostics even harder. PR: 228854 MFC after: 3 days
|
#
36716fe2e |
|
22-Aug-2018 |
Mark Johnston <markj@FreeBSD.org> |
Prepare the kernel linker to handle PC-relative ifunc relocations. The boot-time ifunc resolver assumes that it only needs to apply IRELATIVE relocations to PLT entries. With an upcoming optimization, this assumption no longer holds, so add the support required to handle PC-relative relocations targeting GNU_IFUNC symbols. - Provide a custom symbol lookup routine that can be used in early boot. The default lookup routine uses kobj, which is not functional at that point. - Apply all existing relocations during boot rather than filtering IRELATIVE relocations. - Ensure that we continue to apply ifunc relocations in a second pass when loading a kernel module. Reviewed by: kib MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D16749
|
#
8f941950 |
|
07-Aug-2018 |
Konstantin Belousov <kib@FreeBSD.org> |
Followup to r337430: only call elf_reloc_ifunc on x86. Sponsored by: The FreeBSD Foundation MFC after: 1 week
|
#
289ead7c |
|
07-Aug-2018 |
Konstantin Belousov <kib@FreeBSD.org> |
Add missed handling of local relocs against ifunc target in the obj modules. Reported and tested by: wulf Sponsored by: The FreeBSD Foundation MFC after: 1 week
|
#
bf923a55 |
|
19-Jul-2018 |
Mark Johnston <markj@FreeBSD.org> |
Delete an XXX comment addressed by r336505. X-MFC with: r336505 Sponsored by: The FreeBSD Foundation
|
#
73624a80 |
|
19-Jul-2018 |
Mark Johnston <markj@FreeBSD.org> |
Provide the full module path to preload_delete_name(). The basename will never match against the preload metadata, so these calls previously had no effect. Reviewed by: kib, royger MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D16330
|
#
f912a970 |
|
29-May-2018 |
Ed Maste <emaste@FreeBSD.org> |
link_elf_obj: correct an error message Previously we'd report that a file has "no valid symbol table" if it in fact had two or more. Change the message to report that there must be exactly one.
|
#
891cf3ed |
|
18-May-2018 |
Ed Maste <emaste@FreeBSD.org> |
Use NULL for SYSINIT's last arg, which is a pointer type Sponsored by: The FreeBSD Foundation
|
#
7035cf14 |
|
03-May-2018 |
Konstantin Belousov <kib@FreeBSD.org> |
Implement support for ifuncs in the kernel linker. Required MD bits are only provided for x86. Reviewed by: jhb (previous version, as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D13838
|
#
15746ef4 |
|
05-Feb-2018 |
John Baldwin <jhb@FreeBSD.org> |
Ignore relocation tables for non-memory-resident sections. As a followup to r328101, ignore relocation tables for ELF object sections that are not memory resident. For modules loaded by the loader, ignore relocation tables whose associated section was not loaded by the loader (sh_addr is zero). For modules loaded at runtime via kldload(2), ignore relocation tables whose associated section is not marked with SHF_ALLOC. Reported by: Mori Hiroki <yamori813@yahoo.co.jp>, adrian Tested on: mips, mips64 MFC after: 1 month Sponsored by: DARPA / AFRL
|
#
d821d364 |
|
21-Jan-2018 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
Unsign some values related to allocation. When allocating memory through malloc(9), we always expect the amount of memory requested to be unsigned as a negative value would either stand for an error or an overflow. Unsign some values, found when considering the use of mallocarray(9), to avoid unnecessary casting. Also consider that indexes should be of at least the same size/type as the upper limit they pretend to index. MFC after: 3 weeks
|
#
58c4aee0 |
|
17-Jan-2018 |
John Baldwin <jhb@FreeBSD.org> |
Require the SHF_ALLOC flag for program sections from kernel object modules. ELF object files can contain program sections which are not supposed to be loaded into memory (e.g. .comment). Normally the static linker uses these flags to decide which sections are allocated to loadable program segments in ELF binaries and shared objects (including kernels on all architectures and kernel modules on architectures other than amd64). Mapping ELF object files (such as amd64 kernel modules) into memory directly is a bit of a grey area. ELF object files are intended to be used as inputs to the static linker. As a result, there is not a standardized definition for what the memory layout of an ELF object should be (none of the section headers have valid virtual memory addresses for example). The kernel and loader were not checking the SHF_ALLOC flag but loading any program sections with certain types such as SHT_PROGBITS. As a result, the kernel and loader would load into RAM some sections that weren't marked with SHF_ALLOC such as .comment that are not loaded into RAM for kernel modules on other architectures (which are implemented as ELF shared objects). Aside from possibly requiring slightly more RAM to hold a kernel module this does not affect runtime correctness as the kernel relocates symbols based on the layout it uses. Debuggers such as gdb and lldb do not extract symbol tables from a running process or kernel. Instead, they replicate the memory layout of ELF executables and shared objects and use that to construct their own symbol tables. For executables and shared objects this works fine. For ELF objects the current logic in kgdb (and probably lldb based on a simple reading) assumes that only sections with SHF_ALLOC are memory resident when constructing a memory layout. If the debugger constructs a different memory layout than the kernel, then it will compute different addresses for symbols causing symbols in the debugger to appear to have the wrong values (though the kernel itself is working fine). The current port of mdb does not check SHF_ALLOC as it replicates the kernel's logic in its existing kernel support. The bfd linker sorts the sections in ELF object files such that all of the allocated sections (sections with SHF_ALLOCATED) are placed first followed by unallocated sections. As a result, when kgdb composed a memory layout using only the allocated sections, this layout happened to match the layout used by the kernel and loader. The lld linker does not sort the sections in ELF object files and mixed allocated and unallocated sections. This resulted in kgdb composing a different memory layout than the kernel and loader. We could either patch kgdb (and possibly in the future lldb) to use custom handling when generating memory layouts for kernel modules that are ELF objects, or we could change the kernel and loader to check SHF_ALLOCATED. I chose the latter as I feel we shouldn't be loading things into RAM that the module won't use. This should mostly be a NOP when linking with bfd but will allow the existing kgdb to work with amd64 kernel modules linked with lld. Note that we only require SHF_ALLOC for "program" sections for types like SHT_PROGBITS and SHT_NOBITS. Other section types such as symbol tables, string tables, and relocations must also be loaded and are not marked with SHF_ALLOC. Reported by: np Reviewed by: kib, emaste MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D13926
|
#
8a36da99 |
|
27-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
sys/kern: adoption of SPDX licensing ID tags. 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.
|
#
a344babf |
|
08-Mar-2017 |
Gleb Smirnoff <glebius@FreeBSD.org> |
Reduce stack usage in link_elf_load_file(), allocating struct nameidata. This function may be called recursively, when a module pulls its dependencies. Under certain circumstances, e.g. quad chain of dependencies and presence of dtrace we may run out of stack.
|
#
e3043798 |
|
29-Apr-2016 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
sys/kern: spelling fixes in comments. No functional change.
|
#
b85f65af |
|
15-Apr-2016 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
kern: for pointers replace 0 with NULL. These are mostly cosmetical, no functional change. Found with devel/coccinelle.
|
#
b715d9af |
|
08-Apr-2016 |
Konstantin Belousov <kib@FreeBSD.org> |
Use the ABI-prescribed name for SHT_X86_64_UNWIND in the loader and kernel linker, after the r297686. Sponsored by: The FreeBSD Foundation
|
#
3cfce8e4 |
|
07-Mar-2016 |
Konstantin Belousov <kib@FreeBSD.org> |
Convert all panics from the link_elf_obj kernel linker for object files format into printfs and errors to caller. Some leaks of resources are there, but the same leaks are present in other error pathes. With the change, the kernel at least boots even when module with unexpected or corrupted ELF structure is preloaded. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
|
#
13f28d96 |
|
05-Mar-2016 |
Konstantin Belousov <kib@FreeBSD.org> |
In the link_elf_obj.c, handle sections of type SHT_AMD64_UNWIND same as SHT_PROGBITS. This is needed after the clang 3.8 import, which generates that type for .eh_frame section, which had SHT_PROGBITS type before. Reported by: Nikolai Lifanov <lifanov@mail.lifanov.com> PR: 207729 Tested by: dim (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
|
#
0be1e0e8 |
|
10-Feb-2016 |
Konstantin Belousov <kib@FreeBSD.org> |
Remove useless checks for NULL before calling free(9), in the kernel elf linkers. Found by: Related PVS-Studio diagnostic Sponsored by: The FreeBSD Foundation MFC after: 1 week
|
#
cff8c6f2 |
|
19-Sep-2015 |
Konstantin Belousov <kib@FreeBSD.org> |
Add support for weak symbols to the kernel linkers. It means that linkers no longer raise an error when undefined weak symbols are found, but relocate as if the symbol value was 0. Note that we do not repeat the mistake of userspace dynamic linker of making the symbol lookup prefer non-weak symbol definition over the weak one, if both are available. In fact, kernel linker uses the first definition found, and ignores duplicates. Signature of the elf_lookup() and elf_obj_lookup() functions changed to split result/error code and the symbol address returned. Otherwise, it is impossible to return zero address as the symbol value, to MD relocation code. This explains the mechanical changes in elf_machdep.c sources. The powerpc64 R_PPC_JMP_SLOT handler did not checked error from the lookup() call, the patch leaves the code as is (untested). Reported by: glebius Sponsored by: The FreeBSD Foundation MFC after: 1 week
|
#
d9db5225 |
|
22-Apr-2015 |
Craig Rodrigues <rodrigc@FreeBSD.org> |
Move zlib.c from net to libkern. It is not network-specific code and would be better as part of libkern instead. Move zlib.h and zutil.h from net/ to sys/ Update includes to use sys/zlib.h and sys/zutil.h instead of net/ Submitted by: Steve Kiernan stevek@juniper.net Obtained from: Juniper Networks, Inc. GitHub Pull Request: https://github.com/freebsd/freebsd/pull/28 Relnotes: yes
|
#
2832cd54 |
|
02-Apr-2015 |
Konstantin Belousov <kib@FreeBSD.org> |
Speed up symbol lookup for the amd64 kernel modules. Amd64 uses relocatable object files as the modules format. It is good WRT not having unneeded overhead for PIC code, in particular, due to absence of useless GOT and PLT. But the cost is that the module linking process cannot use hash to speed up the symbol lookup, and that each reference to the symbol requiring a relocation, instead of single-place relocation in GOT. Cache the successfull symbol lookup results in the module symbol table, using the newly allocated SHN_FBSD_CACHED value from SHN_LOOS-HIOS range as an indicator. The SHN_FBSD_CACHED together with the non-existent definition of the found symbol are reverted after successfull relocations, which is done under kld_sx lock, so it should not be visible to other consumers of the symbol table. Submitted by: Conrad Meyer Differential Revision: https://reviews.freebsd.org/D1718 MFC after: 3 weeks
|
#
0067051f |
|
20-Oct-2014 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Fully support constructors for the purpose of code coverage analysis. This involves: 1. Have the loader pass the start and size of the .ctors section to the kernel in 2 new metadata elements. 2. Have the linker backends look for and record the start and size of the .ctors section in dynamically loaded modules. 3. Have the linker backends call the constructors as part of the final work of initializing preloaded or dynamically loaded modules. Note that LLVM appends the priority of the constructors to the name of the .ctors section. Not so when compiling with GCC. The code currently works for GCC and not for LLVM. Submitted by: Dmitry Mikulin <dmitrym@juniper.net> Obtained from: Juniper Networks, Inc.
|
#
edb572a3 |
|
09-Sep-2013 |
John Baldwin <jhb@FreeBSD.org> |
Add a mmap flag (MAP_32BIT) on 64-bit platforms to request that a mapping use an address in the first 2GB of the process's address space. This flag should have the same semantics as the same flag on Linux. To facilitate this, add a new parameter to vm_map_find() that specifies an optional maximum virtual address. While here, fix several callers of vm_map_find() to use a VMFS_* constant for the findspace argument instead of TRUE and FALSE. Reviewed by: alc Approved by: re (kib)
|
#
5050aa86 |
|
22-Oct-2012 |
Konstantin Belousov <kib@FreeBSD.org> |
Remove the support for using non-mpsafe filesystem modules. In particular, do not lock Giant conditionally when calling into the filesystem module, remove the VFS_LOCK_GIANT() and related macros. Stop handling buffers belonging to non-mpsafe filesystems. The VFS_VERSION is bumped to indicate the interface change which does not result in the interface signatures changes. Conducted and reviewed by: attilio Tested by: pho
|
#
526d0bd5 |
|
20-Feb-2012 |
Konstantin Belousov <kib@FreeBSD.org> |
Fix found places where uio_resid is truncated to int. Add the sysctl debug.iosize_max_clamp, enabled by default. Setting the sysctl to zero allows to perform the SSIZE_MAX-sized i/o requests from the usermode. Discussed with: bde, das (previous versions) MFC after: 1 month
|
#
4104e835 |
|
13-Jan-2012 |
Oleksandr Tymoshenko <gonzo@FreeBSD.org> |
Fix kernel modules loading for MIPS64 kernel: On amd64, link_elf_obj.c must specify KERNBASE rather than VM_MIN_KERNEL_ADDRESS to vm_map_find() because kernel loadable modules must be mapped for execution in the same upper region of the kernel map as the kernel code and data segments. For MIPS32 KERNBASE lies below KVA area (it's less than VM_MIN_KERNEL_ADDRESS) so basically vm_map_find got whole KVA to look through. On MIPS64 it's not the case because KERNBASE is set to the very end of XKSEG, well out of KVA bounds, so vm_map_find always fails. We should use VM_MIN_KERNEL_ADDRESS as a base for vm_map_find. Details obtained from: alc@
|
#
fa2835d2 |
|
16-Apr-2011 |
Dmitry Chagin <dchagin@FreeBSD.org> |
Remove malloc(9) return value checks when M_WAITOK is used. MFC after: 2 Week
|
#
5f67450d |
|
14-Nov-2010 |
Dimitry Andric <dim@FreeBSD.org> |
Similar to sys/net/vnet.h, define the linker set name for sys/sys/pcpu.h as a macro, and use it instead of literal strings.
|
#
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.
|
#
f1d2d305 |
|
02-Oct-2010 |
Konstantin Belousov <kib@FreeBSD.org> |
Release the vnode lock and close the linker file vnode earlier in the linker_load_file methods. The change is that the consequent linker_file_unload() call is not under the vnode lock anymore. This prevents the LOR between kernel linker sx xlock and vnode lock, because linker_file_unload() relocks kernel linker lock. MFC after: 2 weeks
|
#
676799a0 |
|
23-Jul-2010 |
Andriy Gapon <avg@FreeBSD.org> |
completely ignore zero-sized elf sections in modules of elf object type (amd64) Current code doesn't check size of elf sections and may perform needless actions of zero-sized memory allocation and similar. The bigger issue is that alignment requirement of a zero-sized section gets effectively applied to the next section if it has smaller alignment requirement. But other tools, like gdb and consequently kgdb, completely ignore zero-sized sections and thus may map symbols to addresses differently. Zero-sized sections are not typical in general. Their typical (only, even) cause in FreeBSD modules is inline assembly that creates custom sections which is found in pcpu.h and vnet.h. Mere inclusion of one of those header files produces a custom section in elf output. If there is no actual use for the section in a given module, then the section remains empty. Better solution is to avoid creating zero-sized sections altogether, which is in plans. Preloaded modules are handled in boot code (load_elf_obj.c), while dynamically loaded modules are handled by kernel (link_elf_obj.c). Based on code by: np MFC after: 3 weeks
|
#
6f3c6327 |
|
17-Feb-2010 |
Neel Natu <neel@FreeBSD.org> |
Kernel module support for mips. Reviewed by: gonzo Tested by: Alexandr Rybalko (ray@dlink.ua)
|
#
17ef1feb |
|
20-Jul-2009 |
Robert Watson <rwatson@FreeBSD.org> |
Add macros VNET_SETNAME and VNET_SYMPREFIX, and expose to userspace if _WANT_VNET is defined. This way we don't need separate definitions in libkvm. Reviewed by: bz Approved by: re (vimage blanket)
|
#
cd2b95a2 |
|
15-Jul-2009 |
Robert Watson <rwatson@FreeBSD.org> |
r195699 introduced an assertion regarding when progbits data in kernel modules was present, which turns out to be false in some situations. Back out the assertion. Reported by: Luiz Otavio O Souza <lists.br at gmail.com>, Florian Smeets <flo at kasimir.com> Approved by: re (kensmith) (implicit)
|
#
eddfbb76 |
|
14-Jul-2009 |
Robert Watson <rwatson@FreeBSD.org> |
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator (DPCPU), as suggested by Peter Wemm, and implement a new per-virtual network stack memory allocator. Modify vnet to use the allocator instead of monolithic global container structures (vinet, ...). This change solves many binary compatibility problems associated with VIMAGE, and restores ELF symbols for virtualized global variables. Each virtualized global variable exists as a "reference copy", and also once per virtual network stack. Virtualized global variables are tagged at compile-time, placing the in a special linker set, which is loaded into a contiguous region of kernel memory. Virtualized global variables in the base kernel are linked as normal, but those in modules are copied and relocated to a reserved portion of the kernel's vnet region with the help of a the kernel linker. Virtualized global variables exist in per-vnet memory set up when the network stack instance is created, and are initialized statically from the reference copy. Run-time access occurs via an accessor macro, which converts from the current vnet and requested symbol to a per-vnet address. When "options VIMAGE" is not compiled into the kernel, normal global ELF symbols will be used instead and indirection is avoided. This change restores static initialization for network stack global variables, restores support for non-global symbols and types, eliminates the need for many subsystem constructors, eliminates large per-subsystem structures that caused many binary compatibility issues both for monitoring applications (netstat) and kernel modules, removes the per-function INIT_VNET_*() macros throughout the stack, eliminates the need for vnet_symmap ksym(2) munging, and eliminates duplicate definitions of virtualized globals under VIMAGE_GLOBALS. Bump __FreeBSD_version and update UPDATING. Portions submitted by: bz Reviewed by: bz, zec Discussed with: gnn, jamie, jeff, jhb, julian, sam Suggested by: peter Approved by: re (kensmith)
|
#
50c202c5 |
|
23-Jun-2009 |
Jeff Roberson <jeff@FreeBSD.org> |
Implement a facility for dynamic per-cpu variables. - Modules and kernel code alike may use DPCPU_DEFINE(), DPCPU_GET(), DPCPU_SET(), etc. akin to the statically defined PCPU_*. Requires only one extra instruction more than PCPU_* and is virtually the same as __thread for builtin and much faster for shared objects. DPCPU variables can be initialized when defined. - Modules are supported by relocating the module's per-cpu linker set over space reserved in the kernel. Modules may fail to load if there is insufficient space available. - Track space available for modules with a one-off extent allocator. Free may block for memory to allocate space for an extent. Reviewed by: jhb, rwatson, kan, sam, grehan, marius, marcel, stas
|
#
e76f11f4 |
|
11-Jun-2009 |
Andriy Gapon <avg@FreeBSD.org> |
strict kobj signatures: linker_if fixes in symtab_get method symtab parameter is made constant as this reflects actual intention and usage of the method Reviewed by: imp, current@ Approved by: jhb (mentor)
|
#
bcf11e8d |
|
05-Jun-2009 |
Robert Watson <rwatson@FreeBSD.org> |
Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERIC and used in a large number of files, but also because an increasing number of incorrect uses of MAC calls were sneaking in due to copy-and-paste of MAC-aware code without the associated opt_mac.h include. Discussed with: pjd
|
#
00a5db46 |
|
26-May-2009 |
Stacey Son <sson@FreeBSD.org> |
Add the ksyms(4) pseudo driver. The ksyms driver allows a process to get a quick snapshot of the kernel's symbol table including the symbols from any loaded modules (the symbols are all merged into one symbol table). Unlike like other implementations, this ksyms driver maps memory in the process memory space to store the snapshot at the time /dev/ksyms is opened. It also checks to see if the process has already a snapshot open and won't allow it to open /dev/ksyms it again until it closes first. This prevents kernel and process memory from being exhausted. Note that /dev/ksyms is used by the lockstat(1) command. Reviewed by: gallatin kib (freebsd-arch) Approved by: gnn (mentor)
|
#
a1d7ce03 |
|
10-Feb-2009 |
Attilio Rao <attilio@FreeBSD.org> |
Scanning all the formats for binary translation of modules loading can result in errors for a format loading but subsequent correct recognizing for another format. File format loading functions should avoid printing any additional informations but just returning appropriate (and different between each other) error condition, characterizing different informations. Additively, the linker should handle appropriately different format loading errors. While a general mechanism is desired, fix a simple and common case on amd64: file type is not recognized for link elf and confuses the linker. Printout an error if all the registered linker classes can't recognize and load the module. Reviewed by: jhb Sponsored by: Sandvine Incorporated
|
#
d7f03759 |
|
19-Oct-2008 |
Ulf Lilleengen <lulf@FreeBSD.org> |
- Import the HEAD csup code which is the basis for the cvsmode work.
|
#
4f7afc20 |
|
03-Aug-2008 |
Konstantin Belousov <kib@FreeBSD.org> |
Calling linker_load_dependencies() while holding the module' vnode lock may cause a LOR between kld_sx lock and vnode lock. linker_load_dependencies() drops kld_sx, and another thread may attempt to load the same kld. Reported and tested by: pjd MFC after: 1 week
|
#
b474c780 |
|
11-Jul-2008 |
David E. O'Brien <obrien@FreeBSD.org> |
Improve readability and cscope searches a little bit by not using the same variable name in closely related (but not conflicting) contexts.
|
#
552f9f63 |
|
08-Jul-2008 |
Edwin Groothuis <edwin@FreeBSD.org> |
Improve the output of kldload(8) to show which module can't be loaded. Was: kldload: Unsupported file type Is now: kldload: /boot/modules/test.ko: Unsupported file type PR: kern/121276 Submitted by: Edwin Groothuis <edwin@mavetju.org> Approved by: bde (mentor) MFC after: 1 week
|
#
ac68d1c9 |
|
20-Jun-2008 |
Alan Cox <alc@FreeBSD.org> |
Enforce the mapping of kernel loadable modules in the uppermost 2GB of the kernel virtual address space on amd64.
|
#
a2024a3e |
|
22-May-2008 |
John Birrell <jb@FreeBSD.org> |
Add hooks for the Compact C Type Format (CTF) data to be attached to the elf files. This is complicated by the fact that the actual CTF parsing has to be done in CDDL'd code, so the BSD licensed code only knows about the opaque data which it must be able to free.
|
#
1f49b573 |
|
15-Mar-2008 |
Ruslan Ermilov <ru@FreeBSD.org> |
Fix panic on e.g. "kldload /dev/null". PR: kern/121427 Reviewed by: sem MFC after: 3 days
|
#
22db15c0 |
|
13-Jan-2008 |
Attilio Rao <attilio@FreeBSD.org> |
VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used in conjuction with 'thread' argument passing which is always curthread. Remove the unuseful extra-argument and pass explicitly curthread to lower layer functions, when necessary. KPI results broken by this change, which should affect several ports, so version bumping and manpage update will be further committed. Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com>
|
#
30d239bc |
|
24-Oct-2007 |
Robert Watson <rwatson@FreeBSD.org> |
Merge first in a series of TrustedBSD MAC Framework KPI changes from Mac OS X Leopard--rationalize naming for entry points to the following general forms: mac_<object>_<method/action> mac_<object>_check_<method/action> The previous naming scheme was inconsistent and mostly reversed from the new scheme. Also, make object types more consistent and remove spaces from object types that contain multiple parts ("posix_sem" -> "posixsem") to make mechanical parsing easier. Introduce a new "netinet" object type for certain IPv4/IPv6-related methods. Also simplify, slightly, some entry point names. All MAC policy modules will need to be recompiled, and modules not updates as part of this commit will need to be modified to conform to the new KPI. Sponsored by: SPARTA (original patches against Mac OS X) Obtained from: TrustedBSD Project, Apple Computer
|
#
9e223287 |
|
31-May-2007 |
Konstantin Belousov <kib@FreeBSD.org> |
Revert UF_OPENING workaround for CURRENT. Change the VOP_OPEN(), vn_open() vnode operation and d_fdopen() cdev operation argument from being file descriptor index into the pointer to struct file. Proposed and reviewed by: jhb Reviewed by: daichi (unionfs) Approved by: re (kensmith)
|
#
7226306e |
|
30-Nov-2006 |
Konstantin Belousov <kib@FreeBSD.org> |
Linker set support depends on the magic __start_<section> and __stop_<section> symbols generated by the static linker for elf sections. This is done only for the final link, and not for ld -r. Augment elf_obj in-kernel linker by recognizing such special symbols, and resolving them to the start and end of the section automatically. As result, linker sets on amd64 could be used in the same way as on other architectures, without explicit calls to linker_file_lookup_set(). Requested by: rdivacky No objections from: peter, jhb
|
#
aed55708 |
|
22-Oct-2006 |
Robert Watson <rwatson@FreeBSD.org> |
Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.h begun with a repo-copy of mac.h to mac_framework.h. sys/mac.h now contains the userspace and user<->kernel API and definitions, with all in-kernel interfaces moved to mac_framework.h, which is now included across most of the kernel instead. This change is the first step in a larger cleanup and sweep of MAC Framework interfaces in the kernel, and will not be MFC'd. Obtained from: TrustedBSD Project Sponsored by: SPARTA
|
#
70f37788 |
|
21-Jun-2006 |
John Baldwin <jhb@FreeBSD.org> |
Replace the kld_mtx mutex with a kld_sx sx lock and expand it's scope to protect all linker-related data structures including the contents of linker file objects and the any linker class data as well. Considering how rarely the linker is used I just went with the simple solution of single-threading the whole thing rather than expending a lot of effor on something more fine-grained and complex. Giant is still explicitly acquired while registering and deregistering sysctl's as well as in the elf linker class while calling kmupetext(). The rest of the linker runs without Giant unless it has to acquire Giant while loading files from a non-MPSAFE filesystem.
|
#
62d615d5 |
|
20-Jun-2006 |
John Baldwin <jhb@FreeBSD.org> |
Conditionally acquire Giant around VFS operations.
|
#
757686b1 |
|
17-Dec-2005 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Make our ELF64 type definitions match standards. In particular this means: o Remove Elf64_Quarter, o Redefine Elf64_Half to be 16-bit, o Redefine Elf64_Word to be 32-bit, o Add Elf64_Xword and Elf64_Sxword for 64-bit entities, o Use Elf_Size in MI code to abstract the difference between Elf32_Word and Elf64_Word. o Add Elf_Ssize as the signed counterpart of Elf_Size. MFC after: 2 weeks
|
#
7f1ef325 |
|
27-Aug-2005 |
Alan Cox <alc@FreeBSD.org> |
Handle vm_map_wire()'s failure.
|
#
45e31b60 |
|
27-Aug-2005 |
Alan Cox <alc@FreeBSD.org> |
Eliminate an unneeded reference on a vm object. If, in fact, the nearby vm_map_find() fails, then the excess reference causes the vm object to be leaked. Reviewed by: tegge
|
#
70b7ffee |
|
28-Aug-2004 |
Ian Dowse <iedowse@FreeBSD.org> |
Add support for completing the installation of ELF relocatable object format modules that were read in by the loader. Loading modules via the loader should now work on the amd64 platform.
|
#
65a311fc |
|
13-Jul-2004 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Give kldunload a -f(orce) argument. Add a MOD_QUIESCE event for modules. This should return error (EBUSY) of the module is in use. MOD_UNLOAD should now only fail if it is impossible (as opposed to inconvenient) to unload the module. Valid reasons are memory references into the module which cannot be tracked down and eliminated. When kldunloading, we abandon if MOD_UNLOAD fails, and if -force is not given, MOD_QUIESCE failing will also prevent the unload. For backwards compatibility, we treat EOPNOTSUPP from MOD_QUIESCE as success. Document that modules should return EOPNOTSUPP for unknown events.
|
#
5b201fdc |
|
28-Jun-2004 |
Peter Wemm <peter@FreeBSD.org> |
Wrap long line.
|
#
a8774e39 |
|
15-Jun-2004 |
Peter Wemm <peter@FreeBSD.org> |
Change strategy based on a suggestion from Ian Dowse. Instead of trying to keep track of different section base addresses at a symbol-by-symbol level, just set the symbol values at load time.
|
#
1cab0c85 |
|
14-Jun-2004 |
Peter Wemm <peter@FreeBSD.org> |
Fix symbol lookups between modules. This caused modules that depend on other modules to explode. eg: snd_ich->snd_pcm and umass->usb. The problem was that I was using the unified base address of the module instead of finding the start address of the section in question.
|
#
add21e17 |
|
14-Jun-2004 |
Peter Wemm <peter@FreeBSD.org> |
Insurance: cause a proper symbol lookup failure for symbol entries that reference unknown sections.. rather than returning a small value.
|
#
4cec6f5d |
|
17-May-2004 |
Peter Wemm <peter@FreeBSD.org> |
If a symbol has section+offset definitions provided, always use instead of doing a name lookup for global symbols. This fixes the snd_pcm module.
|
#
82d0d1a0 |
|
17-May-2004 |
Peter Wemm <peter@FreeBSD.org> |
Remove leftover padding variables. Convert some silent 'ignore programmer error' cases into panics Remove 'align' field from section table (no longer needed)
|
#
20947801 |
|
17-May-2004 |
Peter Wemm <peter@FreeBSD.org> |
Clean up the code some more. Unify the text/data (progbits) and bss (nobits) tables to simplify some code. Try and shorten some of the very wide lines. Somewhere along the way, I think I fixed the memory corruption that caused panics after going multiuser.
|
#
872e9216 |
|
16-May-2004 |
Peter Wemm <peter@FreeBSD.org> |
Oops, use the generic ELF_ST_BIND() macro instead of ELF64_ST_BIND. Submitted by: marks
|
#
e9eabf59 |
|
30-Apr-2004 |
Peter Wemm <peter@FreeBSD.org> |
Checkpoint commit for an alternative WIP kernel module loader that isn't as dependent on binutils features/quirks as the current one. This one loads plain .o files without having to mess with shared object mode. This happens to be essential on amd64, because binutils hasn't implemented all the quirks/features that we need for producing the hack non-PIC shared objects. As it turned out, .o format isn't all that inconvenient after all. It looks like the ability to use the same .o files for linking directly into a static kernel or loading as a module might be worth it. It is still very much a work-in-progress, but it is almost usable. Other changes are still needed in order to use it though, these have not been committed yet. There is still a memory corruption/overrun bug somewhere. For example, test modules load and work, but the machine explodes a few minutes later in vm_forkproc() or the like. Notable missing things include kldxref support, and loader(8) support. I wanted to figure out a working baseline set of code first.
|
#
abd498aa |
|
11-Aug-2003 |
Bruce M Simpson <bms@FreeBSD.org> |
Add the mlockall() and munlockall() system calls. - All those diffs to syscalls.master for each architecture *are* necessary. This needed clarification; the stub code generation for mlockall() was disabled, which would prevent applications from linking to this API (suggested by mux) - Giant has been quoshed. It is no longer held by the code, as the required locking has been pushed down within vm_map.c. - Callers must specify VM_MAP_WIRE_HOLESOK or VM_MAP_WIRE_NOHOLES to express their intention explicitly. - Inspected at the vmstat, top and vm pager sysctl stats level. Paging-in activity is occurring correctly, using a test harness. - The RES size for a process may appear to be greater than its SIZE. This is believed to be due to mappings of the same shared library page being wired twice. Further exploration is needed. - Believed to back out of allocations and locks correctly (tested with WITNESS, MUTEX_PROFILING, INVARIANTS and DIAGNOSTIC). PR: kern/43426, standards/54223 Reviewed by: jake, alc Approved by: jake (mentor) MFC after: 2 weeks
|
#
7c89f162 |
|
27-Jul-2003 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Add fdidx argument to vn_open() and vn_open_cred() and pass -1 throughout.
|
#
677b542e |
|
10-Jun-2003 |
David E. O'Brien <obrien@FreeBSD.org> |
Use __FBSDID().
|
#
87b1831f |
|
12-May-2003 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Bail out if there were not two loadable sections. Add XXX comment about one other issue. Approved by: re/rwatson.
|
#
67db8b23 |
|
05-Apr-2003 |
Peter Wemm <peter@FreeBSD.org> |
Search for "elf32 kernel" (and elf64) and "elf32 module" (and elf64) as well as "elf kernel" and "elf module". This is a precursor to x86-64 support in the i386 loader so it can load an elf64 x86-64 kernel.
|
#
a163d034 |
|
18-Feb-2003 |
Warner Losh <imp@FreeBSD.org> |
Back out M_* changes, per decision of the TRB. Approved by: trb
|
#
44956c98 |
|
21-Jan-2003 |
Alfred Perlstein <alfred@FreeBSD.org> |
Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0. Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
|
#
7251b4bf |
|
20-Jan-2003 |
Jake Burkholder <jake@FreeBSD.org> |
Resolve relative relocations in klds before trying to parse the module's metadata. This fixes module dependency resolution by the kernel linker on sparc64, where the relocations for the metadata are different than on other architectures; the relative offset is in the addend of an Elf_Rela record instead of the original value of the location being patched. Also fix printf formats in debug code. Submitted by: Hartmut Brandt <brandt@fokus.gmd.de> PR: 46732 Tested on: alpha (obrien), i386, sparc64
|
#
a3df768b |
|
19-Nov-2002 |
Robert Watson <rwatson@FreeBSD.org> |
Merge kld access control checks from the MAC tree: these access control checks permit policy modules to augment the system policy for permitting kld operations. This permits policies to limit access to kld operations based on credential (and other) properties, as well as to perform checks on the kld being loaded (integrity, etc). Approved by: re Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
|
#
1aeb23cd |
|
19-Oct-2002 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Add two hooks to signal module load and module unload to MD code. The primary reason for this is to allow MD code to process machine specific attributes, segments or sections in the ELF file and update machine specific state accordingly. An immediate use of this is in the ia64 port where unwind information is updated to allow debugging and tracing in/across modules. Note that this commit does not add the functionality to the ia64 port. See revision 1.9 of ia64/ia64/elf_machdep.c. Validated on: alpha, i386, ia64
|
#
c143d6c2 |
|
19-Oct-2002 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Reduce code duplication by moving the common actions in link_elf_init(), link_elf_link_preload_finish() and link_elf_load_file() to link_elf_link_common_finish(). Since link_elf_init() did initializations as a side-effect of doing the common actions, keep the initialization in that function. Consequently, link_elf_add_gdb() is now also called to insert the very first link_map() (ie the kernel).
|
#
1720979b |
|
19-Oct-2002 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Non-functional change in preparation of the next commit: Move link_elf_add_gdb(), link_elf_delete_gdb() and link_elf_error() near the top of the file. The *_gdb() functions are moved inside the #ifdef DDB already present there.
|
#
f5b07e11 |
|
18-Oct-2002 |
Marcel Moolenaar <marcel@FreeBSD.org> |
In link_elf_load_file(), when SPARSE_MAPPING is defined and we cannot allocate ef->object, we freed ef before bailing out with an error. This is wrong because ef=lf and when we have an error and lf is non-NULL (which holds if we try to alloc ef->object), we free lf and thus ef as part of the bailing-out.
|
#
47f75012 |
|
14-Oct-2002 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Fix kernel module loading on ia64. Cross-module function calls were improperly relocated due to faulty logic in lookup_fdesc() in elf_machdep.c. The symbol index (symidx) was bogusly used for load modules other than the one the relocation applied to. This resulted in bogus bindings and consequently runtime failures. The fix is to use the symbol index only for the module being relocated and to use the symbol name for look-ups in the modules in the dependent list. As such, we need a function to return the symbol name given the linker file and symbol index.
|
#
37c84183 |
|
28-Sep-2002 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Be consistent about "static" functions: if the function is marked static in its prototype, mark it static at the definition too. Inspired by: FlexeLint warning #512
|
#
169d513c |
|
27-Sep-2002 |
Jake Burkholder <jake@FreeBSD.org> |
Add a workaround for what seems to be confusion between binutils and the sparc v9 ABI. The Elf_Rela records for local symbols appear to already have the symbol's value added in to the addend field, even though the ABI specifies we need to lookup the symbol and add its value too. This breaks text relocations in klds because the symbol's value is added twice, and the resulting address points off into nowhere land, so for now just use the addend. Tested by: rwatson
|
#
66422f5b |
|
16-Sep-2002 |
Peter Wemm <peter@FreeBSD.org> |
Initiate deorbit burn for the i386-only a.out related support. Moves are under way to move the remnants of the a.out toolchain to ports. As the comment in src/Makefile said, this stuff is deprecated and one should not expect this to remain beyond 4.0-REL. It has already lasted WAY beyond that. Notable exceptions: gcc - I have not touched the a.out generation stuff there. ldd/ldconfig - still have some code to interface with a.out rtld. old as/ld/etc - I have not removed these yet, pending their move to ports. some includes - necessary for ldd/ldconfig for now. Tested on: i386 (extensively), alpha
|
#
b17c50db |
|
28-Aug-2002 |
Jake Burkholder <jake@FreeBSD.org> |
Unrot SPARSE_MAPPING code (vm_map_pageable -> vm_map_wire).
|
#
5cf87418 |
|
23-Aug-2002 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Work around a GCC optimization bug on ia64: In link_elf_symbol_values(), a pointer to a symbol is given and we have to find the containing symbol table. We do this by bounds checking. For some strange reason (ie I haven't found the root cause) the first test succeeded for said symbol, implying that the symbol came from the .dynsym table. In reality however the symbol actually resided in the .symtab table. Needless to say that all that was returned was junk. The upper bounds check was: (symptr - baseptr) < symtab_size This has been rewritten to: symptr < (baseptr + symtab_size) As a side-effect, slightly more optimal (and still correct :-) code can be generated on ia64.
|
#
c6d6cf17 |
|
22-Aug-2002 |
Peter Wemm <peter@FreeBSD.org> |
s/sus/sys/ in the a.out kernel case. Submitted by: julian
|
#
f9980387 |
|
22-Aug-2002 |
Peter Wemm <peter@FreeBSD.org> |
Instead of nlist.h and link.h, use sys/nlist_aout.h and sys/link_elf.h This avoids reaching out into userland sources (or worse: /usr/include!) for building the kernel.
|
#
9ca43589 |
|
15-Aug-2002 |
Robert Watson <rwatson@FreeBSD.org> |
In order to better support flexible and extensible access control, make a series of modifications to the credential arguments relating to file read and write operations to cliarfy which credential is used for what: - Change fo_read() and fo_write() to accept "active_cred" instead of "cred", and change the semantics of consumers of fo_read() and fo_write() to pass the active credential of the thread requesting an operation rather than the cached file cred. The cached file cred is still available in fo_read() and fo_write() consumers via fp->f_cred. These changes largely in sys_generic.c. For each implementation of fo_read() and fo_write(), update cred usage to reflect this change and maintain current semantics: - badfo_readwrite() unchanged - kqueue_read/write() unchanged pipe_read/write() now authorize MAC using active_cred rather than td->td_ucred - soo_read/write() unchanged - vn_read/write() now authorize MAC using active_cred but VOP_READ/WRITE() with fp->f_cred Modify vn_rdwr() to accept two credential arguments instead of a single credential: active_cred and file_cred. Use active_cred for MAC authorization, and select a credential for use in VOP_READ/WRITE() based on whether file_cred is NULL or not. If file_cred is provided, authorize the VOP using that cred, otherwise the active credential, matching current semantics. Modify current vn_rdwr() consumers to pass a file_cred if used in the context of a struct file, and to always pass active_cred. When vn_rdwr() is used without a file_cred, pass NOCRED. These changes should maintain current semantics for read/write, but avoid a redundant passing of fp->f_cred, as well as making it more clear what the origin of each credential is in file descriptor read/write operations. Follow-up commits will make similar changes to other file descriptor operations, and modify the MAC framework to pass both credentials to MAC policy modules so they can implement either semantic for revocation. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
|
#
d297ad16 |
|
24-Apr-2002 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Don't use the symbol name to lookup the symbol value when we can use the symbol index defined by the relocation. The elf_lookup() support function is to be used by elf_reloc() when symbol lookups need to be done. The elf_lookup() function operates on the symbol index and will do a symbol name based lookup when such is required, otherwise it uses the symbol index directly. This solves the problem seen on ia64 where the symbol hash table does not contain local symbols and a symbol name based lookup would fail for those symbols. Don't pass the symbol name to elf_reloc(), as it isn't used any more.
|
#
84201059 |
|
21-Apr-2002 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Add function link_elf_get_gp(), specific to ia64 for now, to get the DT_PLTGOT value. On ia64 this is the value of GP. We need this to construct function descriptors, but the elf file structure is not exported to MD code. Note that the name of the function is based on the meaning that DT_PLTGOT has on ia64. This may differ on other architectures. As such, link_elf_get_gp() has a high level of MD to it. Renaming the function to describe what DT_* value is returned makes it generic, but also makes the MD code less clear and if we only need this on ia64, then a general name for a specific function doesn't help. In short: I don't know what is "right" at this time, so I'll go with what I have.
|
#
a854ed98 |
|
27-Feb-2002 |
John Baldwin <jhb@FreeBSD.org> |
Simple p_ucred -> td_ucred changes to start using the per-thread ucred reference.
|
#
7b9716ba |
|
16-Nov-2001 |
Ian Dowse <iedowse@FreeBSD.org> |
Fix a number of misspellings of "dependency" and "dependencies" in comments and function names. PR: kern/8589 Submitted by: Rajesh Vaidheeswarran <rv@fore.com>
|
#
bb9fe9dd |
|
30-Oct-2001 |
Brian Feldman <green@FreeBSD.org> |
Add the sysctl "kern.function_list", which currently exports all function symbols in the kernel in a list of C strings, with an extra nul-termination at the end. This sysctl requires addition of a new linker operation. Now, linker_file_t's need to respond to "each_function_name" to export their function symbols. Note that the sysctl doesn't currently allow distinguishing multiple symbols with the same name from different modules, but could quite easily without a change to the linker operation. This will be a nicety to have when it can be used. Obtained from: NAI Labs CBOSS project Funded by: DARPA
|
#
08d68dda |
|
30-Oct-2001 |
Brian Feldman <green@FreeBSD.org> |
Also, machine/profile.h should be necessary for the function prototype of kmupetext().
|
#
f99502a4 |
|
30-Oct-2001 |
Brian Feldman <green@FreeBSD.org> |
Use kmupetext() for ELF KLDs to allow for increased text segment size. Obtained from: NAI Labs CBOSS project Funded by: DARPA
|
#
de1792cb |
|
15-Sep-2001 |
Doug Rabson <dfr@FreeBSD.org> |
The ia64 kernel is now linked dynamically so parse its _DYNAMIC structure.
|
#
b40ce416 |
|
12-Sep-2001 |
Julian Elischer <julian@FreeBSD.org> |
KSE Milestone 2 Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
|
#
ed6c3888 |
|
10-Sep-2001 |
Peter Wemm <peter@FreeBSD.org> |
Fix a warning. l_name is managed by us and is malloc/free'ed. It is the userland declaration of l_name that is inconvenient for us.
|
#
c92c4c8f |
|
02-Sep-2001 |
Peter Wemm <peter@FreeBSD.org> |
Unindent a if (1) { that was left behind in the last commit. (commits were seperated to not obscure the real change)
|
#
00dda5e8 |
|
02-Sep-2001 |
Peter Wemm <peter@FreeBSD.org> |
Argh. Make the ia64 kernel work in all situations. For some reason, and I still dont know why, this was not failing on the non-kse kernel. It certainly should have since things were using linker_kernel_file unconditionally. This has highlighted a different problem though that means that trying to do a kldload on a non-dynamic kernel will implode.
|
#
c214e663 |
|
10-Aug-2001 |
Bill Paul <wpaul@FreeBSD.org> |
Fix some of the GDB linkage setup. The l_name member of the gdb linkage structure is always free()ed yet only sometimes malloc()ed. In particular, it was simply set to point to l_filename from the a linker_file_t in link_elf_link_preload_finish(). The l_filename had been malloc()ed inside the kern_linker.c module and was being free()ed twice: once by link_elf_unload_file() and again by linker_file_unload(), leading to a panic. How to duplicate the problem: - Pre-load a kernel module from the loader, i.e. if_sis.ko - Boot system - Attempt to unload module with kldunload if_sis - Bewm The problem here is that the case where the module was loaded with kldload after system boot would work correctly, so this bug went unnoticed until I stubbed my toe on it just now. (Also, you can only trip this bug if you compile a kernel with options DDB, but that's the default now.) Fix: remember to malloc() a separate copy of the module name for the l_name member of the gdb linkage structure in three places where the linkage structure can be initialized.
|
#
bcc92693 |
|
06-Aug-2001 |
Brian Feldman <green@FreeBSD.org> |
Previously, the ELF linker would always just store the pointer to a filename passed in via the module loader functions in the GDB "sharedlibrary" support structures. This isn't good, since the pointer would become stale in almost every case (not the pre-loaded case, of course). Change this to malloc()ed copy of the string and finally fix the reason that gdb -k's "sharedlibrary" command stopped working. Obtained from: LOMAC/FreeBSD (cf. NAI Labs)
|
#
7e510298 |
|
30-Jul-2001 |
Jake Burkholder <jake@FreeBSD.org> |
Use a machine dependent type, Elf_Hashelt, for the elements of the elf dynamic symbol table buckets and chains. The sparc64 toolchain uses 32 bit .hash entries, unlike other 64 bits architectures (alpha), which use 64 bit entries. Discussed with: dfr, jdp
|
#
0cddd8f0 |
|
04-Jul-2001 |
Matthew Dillon <dillon@FreeBSD.org> |
With Alfred's permission, remove vm_mtx in favor of a fine-grained approach (this commit is just the first stage). Also add various GIANT_ macros to formalize the removal of Giant, making it easy to test in a more piecemeal fashion. These macros will allow us to test fine-grained locks to a degree before removing Giant, and also after, and to remove Giant in a piecemeal fashion via sysctl's on those subsystems which the authors believe can operate without Giant.
|
#
f41325db |
|
13-Jun-2001 |
Peter Wemm <peter@FreeBSD.org> |
With this commit, I hereby pronounce gensetdefs past its use-by date. Replace the a.out emulation of 'struct linker_set' with something a little more flexible. <sys/linker_set.h> now provides macros for accessing elements and completely hides the implementation. The linker_set.h macros have been on the back burner in various forms since 1998 and has ideas and code from Mike Smith (SET_FOREACH()), John Polstra (ELF clue) and myself (cleaned up API and the conversion of the rest of the kernel to use it). The macros declare a strongly typed set. They return elements with the type that you declare the set with, rather than a generic void *. For ELF, we use the magic ld symbols (__start_<setname> and __stop_<setname>). Thanks to Richard Henderson <rth@redhat.com> for the trick about how to force ld to provide them for kld's. For a.out, we use the old linker_set struct. NOTE: the item lists are no longer null terminated. This is why the code impact is high in certain areas. The runtime linker has a new method to find the linker set boundaries depending on which backend format is in use. linker sets are still module/kld unfriendly and should never be used for anything that may be modular one day. Reviewed by: eivind
|
#
c0b824f9 |
|
02-Jun-2001 |
Dima Dorfman <dd@FreeBSD.org> |
Include sys/mutex.h to silence a warning.
|
#
23955314 |
|
18-May-2001 |
Alfred Perlstein <alfred@FreeBSD.org> |
Introduce a global lock for the vm subsystem (vm_mtx). vm_mtx does not recurse and is required for most low level vm operations. faults can not be taken without holding Giant. Memory subsystems can now call the base page allocators safely. Almost all atomic ops were removed as they are covered under the vm mutex. Alpha and ia64 now need to catch up to i386's trap handlers. FFS and NFS have been tested, other filesystems will need minor changes (grabbing the vm lock when twiddling page properties). Reviewed (partially) by: jake, jhb
|
#
fb919e4d |
|
01-May-2001 |
Mark Murray <markm@FreeBSD.org> |
Undo part of the tangle of having sys/lock.h and sys/mutex.h included in other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
|
#
d6df01d8 |
|
25-Feb-2001 |
Peter Wemm <peter@FreeBSD.org> |
Make this compile in a.out mode. link.h has extra dependencies for a.out.
|
#
7cc0979f |
|
08-Dec-2000 |
David Malone <dwmalone@FreeBSD.org> |
Convert more malloc+bzero to malloc+M_ZERO. Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
|
#
ca29467e |
|
05-Oct-2000 |
John Baldwin <jhb@FreeBSD.org> |
Correct a warning where the r_debug_state() dummy function used to trigger a breakpoint in the kernel didn't use the proper argument list. To avoid having to include the userland link.h header everyhwere that sys/linker.h is used, make r_debug_state() a static function in link_elf.c as well.
|
#
ff2d7ae5 |
|
29-Sep-2000 |
Doug Rabson <dfr@FreeBSD.org> |
Don't support dynamic linking on ia64 for now - the tools can't cope.
|
#
9548091b |
|
05-Sep-2000 |
Boris Popov <bp@FreeBSD.org> |
Ignore ELF files with 'interpreter' section because KLDs doesn't contain it. Reviewed by: peter
|
#
e6796b67 |
|
03-Jul-2000 |
Kirk McKusick <mckusick@FreeBSD.org> |
Move the truncation code out of vn_open and into the open system call after the acquisition of any advisory locks. This fix corrects a case in which a process tries to open a file with a non-blocking exclusive lock. Even if it fails to get the lock it would still truncate the file even though its open failed. With this change, the truncation is done only after the lock is successfully acquired. Obtained from: BSD/OS
|
#
2c9b67a8 |
|
30-Apr-2000 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Remove unneeded #include <vm/vm_zone.h> Generated by: src/tools/tools/kerninclude
|
#
54823af2 |
|
29-Apr-2000 |
Peter Wemm <peter@FreeBSD.org> |
First round implementation of a fine grain enhanced module to module version dependency system. This isn't quite finished, but it is at a useful stage to do a functional checkpoint. Highlights: - version and dependency metadata is gathered via linker sets, so things are handled the same for static kernels and code built to live in a kld. - The dependencies are at module level (versus at file level). - Dependencies determine kld symbol search order - this means that you cannot link against symbols in another file unless you depend on it. This is so that you cannot accidently unload the target out from underneath the ones referencing it. - It is flexible enough that we can put tags in #include files and macros so that we can get decent hooks for enforcing recompiles on incompatable ABI changes. eg: if we change struct proc, we could force a recompile for all kld's that reference the proc struct. - Tangled dependency references at boot time are sorted. Files are relocated once all their dependencies are already relocated. Caveats: - Loader support is incomplete, but has been worked on seperately. - Actual enforcement of the version number tags is not active yet - just the module dependencies are live. The actual structure of versioning hasn't been agreed on yet. (eg: major.minor, or whatever) - There is some backwards compatability for old modules without metadata but I'm not sure how good it is. This is based on work originally done by Boris Popov (bp@freebsd.org), but I'm not sure he'd recognize much of it now. Don't blame him. :-) Also, ideas have been borrowed from Mike Smith.
|
#
ef83592d |
|
29-Apr-2000 |
Peter Wemm <peter@FreeBSD.org> |
Do not use uprintf() for link time error messages. This has unpleasant consequences when it happens in the preload support, before curproc or the tty system exist.
|
#
326e27d8 |
|
24-Apr-2000 |
Doug Rabson <dfr@FreeBSD.org> |
* Rewrite to use kobj(9) instead of hard-coded function tables. * Report link errors to stdout with uprintf() so that the user can see what went wrong (PR kern/9214). * Add support code to allow module symbols to be loaded into GDB using the debugger's "sharedlibrary" command.
|
#
586453fe |
|
24-Dec-1999 |
Bruce Evans <bde@FreeBSD.org> |
Fixed a cast of a pointer to an integer of a possibly different size. Fixed casts of non-`void *' pointers to uintptr_t. Fixed related style bugs. This file uses perfectly non-KNF formatting for casts.
|
#
762e6b85 |
|
15-Dec-1999 |
Eivind Eklund <eivind@FreeBSD.org> |
Introduce NDFREE (and remove VOP_ABORTOP)
|
#
b5abfb70 |
|
28-Nov-1999 |
Peter Wemm <peter@FreeBSD.org> |
Fix an embarresing mistake in the kld symbol lookup for DDB. It should now correctly do a traceback when crashing inside a KLD module. PR: 15014 Submitted by: Vladimir N. Silyaev <vns@delta.odessa.ua>
|
#
923502ff |
|
29-Oct-1999 |
Poul-Henning Kamp <phk@FreeBSD.org> |
useracc() the prequel: Merge the contents (less some trivial bordering the silly comments) of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>. This puts the #defines for the vm_inherit_t and vm_prot_t types next to their typedefs. This paves the road for the commit to follow shortly: change useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE} as argument.
|
#
d1f088da |
|
11-Oct-1999 |
Peter Wemm <peter@FreeBSD.org> |
Trim unused options (or #ifdef for undoc options). Submitted by: phk
|
#
c3aac50f |
|
27-Aug-1999 |
Peter Wemm <peter@FreeBSD.org> |
$Id$ -> $FreeBSD$
|
#
d009ccfa |
|
23-Aug-1999 |
Bruce Evans <bde@FreeBSD.org> |
Cast pointers to uintptr_t instead of casting them to u_long, and/or vice versa. Cosmetic.
|
#
4173e420 |
|
08-May-1999 |
Peter Wemm <peter@FreeBSD.org> |
Use KERNBASE for the load address of the kernel rather than magic constants as it seems to work.. (at least on i386/elf).
|
#
cacd1f6a |
|
29-Jan-1999 |
Bruce Evans <bde@FreeBSD.org> |
Cast to `const char *' instead of to c_caddr_t. This is part of terminating c_caddr_t with extreme prejudice. Here we depended on the "opaque" type c_caddr_t being precisely `const char *' to do unportable pointer arithmetic.
|
#
8aef1712 |
|
27-Jan-1999 |
Matthew Dillon <dillon@FreeBSD.org> |
Fix warnings in preparation for adding -Wall -Wcast-qual to the kernel compile
|
#
fe08c21a |
|
27-Jan-1999 |
Matthew Dillon <dillon@FreeBSD.org> |
Fix warnings in preparation for adding -Wall -Wcast-qual to the kernel compile. This commit includes significant work to proper handle const arguments for the DDB symbol routines.
|
#
d254af07 |
|
27-Jan-1999 |
Matthew Dillon <dillon@FreeBSD.org> |
Fix warnings in preparation for adding -Wall -Wcast-qual to the kernel compile
|
#
149a155c |
|
25-Jan-1999 |
Doug Rabson <dfr@FreeBSD.org> |
Don't try to call SYSUNINIT functions if there was a link error. Reviewed by: Peter Wemm <peter@netplex.com.au>
|
#
a13ddfb6 |
|
31-Dec-1998 |
Peter Wemm <peter@FreeBSD.org> |
When loading something that has undefined symbols, it would be helpful to know what they were..
|
#
caab6e90 |
|
06-Nov-1998 |
Peter Wemm <peter@FreeBSD.org> |
Don't put aggregate structs 4K large on the kernel stack, especially when we can recurse when loading dependencies and that the kstack is limited to something like 6 or 7KB. Having a single dependency caused an instant double panic, and I stronly suspect some of the other strange "events" that I have seen are possibly as a result of taking a couple of interrupts with a large chunk of the stack already in use. While here, fix a minor logic hiccup in a sanity check.
|
#
84e40f56 |
|
04-Nov-1998 |
Peter Wemm <peter@FreeBSD.org> |
The handle for the kernel is common. With this fix, ELF kernels can load a.out kld modules, and a.out kernels can load ELF kld modules.
|
#
f5ef029e |
|
25-Oct-1998 |
Poul-Henning Kamp <phk@FreeBSD.org> |
Nitpicking and dusting performed on a train. Removes trivial warnings about unused variables, labels and other lint.
|
#
aa855a59 |
|
15-Oct-1998 |
Peter Wemm <peter@FreeBSD.org> |
*gulp*. Jordan specifically OK'ed this.. This is the bulk of the support for doing kld modules. Two linker_sets were replaced by SYSINIT()'s. VFS's and exec handlers are self registered. kld is now a superset of lkm. I have converted most of them, they will follow as a seperate commit as samples. This all still works as a static a.out kernel using LKM's.
|
#
434bf653 |
|
15-Oct-1998 |
Peter Wemm <peter@FreeBSD.org> |
- bzero() after malloc() bug fix - look up relocation symbol names in correct table bugfix. - remove unused (initialized to 0) variable and conditional free() of it.
|
#
ca65d5c7 |
|
13-Oct-1998 |
Peter Wemm <peter@FreeBSD.org> |
Load the full symbol tables if they are present. This means that ddb and tracebacks have access to local symbols. This is particularly important for the Alpha.
|
#
2d636ab0 |
|
12-Oct-1998 |
Peter Wemm <peter@FreeBSD.org> |
Only print kernel entry point during load. Drastically quieten down the verbose load progress messages. They were more useful for debugging than anything, but are beyond a joke when loading a few dozen modules. Simplify the ELF extended symbol table load format. Just take the main symbol table and the string table that corresponds. This is what we will be getting local symbols from. (needed for the alpha stack tracebacks). Use the (optional) full symbol tables in lookups. This means we have to furhter distinguish between symbols that can come from the dynamic linking table and the complete table. The alpha boot code now needs to be adapted as ddb/db_elf.c cannot use the simpler format. I have not implemented loading the extended symbol tables from the syscall interface yet, just for preloaded modules. I am not sure about the symbol resolution. I *think* it's possible that a local symbol can be found in preference to a global, depending on the search sequence and dependency tree.
|
#
de78ca7e |
|
09-Oct-1998 |
Peter Wemm <peter@FreeBSD.org> |
Fully implement KLD and preloading. - seperate unload for preloaded linker objects. - Don't build a kernel object if running as an a.out kernel. - extract the real kernel name rather than hardwiring "kernel" for kldstat. (sysctl kern.bootfile getst the full name via bootinfo) - use real addresses on the kernel "module" rather than fictitious ones. - preloaded module support - search module path for file modules. - symbols are checked to see if they are in the right containing file before using their indexes into string tables. This is to help ddb since it only supplies a pointer to an opaque symbol and there is no telling which file/object/module/whatever it came from.
|
#
fe3db7c7 |
|
11-Sep-1998 |
Doug Rabson <dfr@FreeBSD.org> |
Implement dynamic loading for ELF.
|
#
a4f67738 |
|
24-Aug-1998 |
Doug Rabson <dfr@FreeBSD.org> |
Add partial KLD support for ELF. The module loading is not written yet.
|