summaryrefslogtreecommitdiff
path: root/sys/modules/linux64
AgeCommit message (Collapse)Author
2025-08-23sys/modules: fix standalone build for multiple modulesShengYi Hung
Multiple Makefile miss opt_*.h and *_if.h header file. We fix it by running make in sys/modules to build all modules. Approved by: lwhsu (mentor), markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52062
2024-10-17Revert "modules: Add missing opt_*.h files for stand-alone compile"Warner Losh
This reverts commit 1a37caeb076b9d31e13c54691d7f1eeb589798bb. I'd overlooked 06c07e1203324bfe8ab4526c82dbb750864272d5 when I updated a branch I'd previously committed but not updated. My search for this in my tree before the commit was to a stale file... Sponsored by: Netflix
2024-10-12modules: Add missing opt_*.h files for stand-alone compileWarner Losh
Standalone compile that we at least create these opt_*.h files. Sponsored by: Netflix
2024-08-20sys/conf: Introduce NOSAN_CFLAGS and NOSAN_CAndrew Turner
To simplify disabling the kernel sanitizers in some files add NOSAN_CFLAGS and NOSAN_C variables. These are CFLAGS and NORMAL_C with the sanitizer flags removed. While here add MSAN_CFLAGS to simplify keeping KMSAN in kern_kcov.c Reviewed by: khng, brooks, imp, markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45498
2024-07-15Remove residual blank line at start of MakefileWarner Losh
This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
2024-06-05linux64: Fix the build on arm64 with bti checkingAndrew Turner
When we enable checking for BTI on arm64 we need to include an ELF note in all object files linked into a module. As using objcopy from a binary to an ELF object file doesn't add the note switch to using .incbin from an assembly file. This allows us to add the needed note without affecting the included object. Reviewed by: imp, kib, emaste Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45468
2024-01-12sanitizers: Avoid building genassym.c and genoffset.c with sanitizersMark Johnston
Some, particularly KASAN, may insert redzones around global symbols, resulting in incorrect offset definitions because genassym.sh (ab)uses symbol sizes to assign semantic meaning. (Ideally I would be able to define this pattern in one place, but I haven't found a way to define a GENSYM_CFLAGS that actually works for all of the consumers (kern.post.mk, kmod.mk, sys/conf/files*).) MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Juniper Networks, Inc.
2023-12-26sys: ${CFLAGS:N-flto} -> ${CFLAGS:N-flto*}Alex Xu (Hello71)
For the same reason as the original https://reviews.freebsd.org/D9659: -flto=<N>, -flto=full, and -flto=thin also produce the GIMPLE/bitcode which is not supported by genassym, so filter those out as well. Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/898
2023-08-16sys: Remove $FreeBSD$: one-line sh patternWarner Losh
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-07-22linux(4): Implement xattr syscallsDmitry Chagin
Reviewed by: Differential revision: https://reviews.freebsd.org/D35544 MFC after: 1 month
2023-02-14linux(4): Trim unused opt_usb.h from modules MakefilesDmitry Chagin
MFC after: 2 weeks
2023-02-12linux(4): Get rid of the opt_compat.h include.Dmitry Chagin
Since e013e369 COMPAT_LINUX, COMPAT_LINUX32 build options are removed, so include of opt_compat.h is no more needed. MFC after: 2 weeks
2022-11-02linux64: improve linux_support.s make rulesEd Maste
Previously we relied on the .s.o rule in share/mk/bsd.suffixes.mk to tell make that linux_support.o is built from linux_support.s, even though we do not use the .s.o rule to assemble it. Reviewed by: sjg MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35864
2022-11-02sys: use .S for assembly language files that use the preprocessorElliott Mitchell
Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/609 Differential Revision: https://reviews.freebsd.org/D35908
2022-10-29modules: Add missing opt_*.h files for stand-alone compileWarner Losh
Standalone compile that we at least create these opt_*.h files. Sponsored by: Netflix
2022-10-29linux, linux64: fix module loadMitchell Horne
The previous commit added references to to the syscallnames arrays, but failed to add the relevant source files to the module build. Thus, the modules failed to load due to missing symbols. Reported by: cy Fixes: 1da65dcb1c57 ("linux: populate sv_syscallnames in each sysentvec") Sponsored by: The FreeBSD Foundation
2022-10-29linux, linux64: improve SRCS formattingMitchell Horne
Sort the entries alphabetically, and list them with one entry per line. This makes the diffs much cleaner when adding or removing a new entry, as I will do in the next commit. MFC after: 1 week Sponsored by: The FreeBSD Foundation
2022-05-23linux(4); Move vdso_selector_x86.c to the linux_common moduleDmitry Chagin
MFC after: 2 weeks
2022-05-08linux(4): Implement vdso getcpu for x86.Dmitry Chagin
This is modeled after f2395455 (by kib@). MFC after: 2 weeks
2022-04-26linux(4): Add a simple rseq syscall implementation.Dmitry Chagin
To avoid annoyng messages from glibc-2.35 test suite add the simple implementation of rseq syscall which is do nothing for now. I plan to implement it if and when the API stabilizes. MFC after: 2 weeks
2021-11-18Fix some modules to export more used symbolsKonstantin Belousov
and remove non-present symbols that are now reported by kmod_syms.awk. Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32878
2021-07-26linux(4): Fix amd64 gcc build.Dmitry Chagin
Do not specify memory model and mregparm for amd64, it's only available on IA-32 architecture. Reported by: jhb, jrtc27 MFC after: 2 weeks
2021-07-20linux(4); Almost complete the vDSO.Dmitry Chagin
The vDSO (virtual dynamic shared object) is a small shared library that the kernel maps R/O into the address space of all Linux processes on image activation. The vDSO is a fully formed ELF image, shared by all processes with the same ABI, has no process private data. The primary purpose of the vDSO: - non-executable stack, signal trampolines not copied to the stack; - signal trampolines unwind, mandatory for the NPTL; - to avoid contex-switch overhead frequently used system calls can be implemented in the vDSO: for now gettimeofday, clock_gettime. The first two have been implemented, so add the implementation of system calls. System calls implemenation based on a native timekeeping code with some limitations: - ifunc can't be used, as vDSO r/o mapped to the process VA and rtld can't relocate symbols; - reading HPET memory is not implemented for now (TODO). In case on any error vDSO system calls fallback to the kernel system calls. For unimplemented vDSO system calls added prototypes which call corresponding kernel system call. Tested by: trasz (arm64) Differential revision: https://reviews.freebsd.org/D30900 MFC after: 2 weeks
2021-07-03linux(4): implement coredumps on arm64Edward Tomasz Napierala
Previously they only worked on amd64. Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30975
2021-06-30linux(4): implement coredump supportEdward Tomasz Napierala
Implement dumping core for Linux binaries on amd64, for both 32- and 64-bit executables. Some bits are still missing. This is based on a prototype by chuck@. Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30019
2021-03-24Get rid of i386 ref here as linux64 is a 64-bit module.Dmitry Chagin
Reviewed By: emaste, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29412
2021-01-21linux64: Don't pass unnecessary -S and -g to objcopyJessica Clarke
Since we use --input-type binary these options are rather meaningless. Both binutils and elftoolchain ignore the option in this case, but LLVM does not, and instead strips all symbols from the output file, causing missing symbols at run time if building with llvm-objcopy. Thus simply remove the options; the linux module has never included them for building its VDSO (added in r283407), but for some reason the original commit of linux64 (r283424) added them. These should however eventually be changed to use template assembly files as is now done for firmware and MFS_IMAGE. Reviewed by: emaste, trasz Differential Revision: https://reviews.freebsd.org/D27740
2020-11-05linux(4): Deduplicate unimpl/dummy syscall handlersConrad Meyer
No functional change. Reviewed by: emaste, trasz Differential Revision: https://reviews.freebsd.org/D27099 Notes: svn path=/head/; revision=367395
2020-08-25Pass -fuse-ld=/path/to/ld if ${LD} != "ld"Alex Richardson
This is needed so that setting LD/XLD is not ignored when linking with $CC instead of directly using $LD. Currently only clang accepts an absolute path for -fuse-ld= (Clang 12+ will add a new --ld-path flag), so we now warn when building with GCC and $LD != "ld" since that might result in the wrong linker being used. We have been setting XLD=/path/to/cheri/ld.lld in CheriBSD for a long time and used a similar version of this patch to avoid linking with /usr/bin/ld. This change is also required when building FreeBSD on an Ubuntu with Clang: In that case we set XCC=/usr/lib/llvm-10/bin/clang and since /usr/lib/llvm-10/bin/ does not contain a "ld" binary the build fails with `clang: error: unable to execute command: Executable "ld" doesn't exist!` unless we pass -fuse-ld=/usr/lib/llvm-10/bin/ld.lld. This change passes -fuse-ld instead of copying ${XLD} to WOLRDTMP/bin/ld since then we would have to ensure that this file does not exist while building the bootstrap tools. The cross-linker might not be compatible with the host linker (e.g. when building on macos: host-linker= Mach-O /usr/bin/ld, cross-linker=LLVM ld.lld). Reviewed By: brooks, emaste Differential Revision: https://reviews.freebsd.org/D26055 Notes: svn path=/head/; revision=364761
2020-08-11Allow overriding the tool used for stripping binariesAlex Richardson
Since the make variable STRIP is already used for other purposes, this uses STRIPBIN (which is also used for the same purpose by install(1). This allows using LLVM objcopy to strip binaries instead of the in-tree elftoolchain objcopy. We make use of this in CheriBSD since passing binaries generated by our toolchain to elftoolchain strip sometimes results in assertion failures. This allows working around https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248516 by specifying STRIPBIN=/path/to/llvm-strip Obtained from: CheriBSD Reviewed By: emaste, brooks Differential Revision: https://reviews.freebsd.org/D25988 Notes: svn path=/head/; revision=364119
2020-04-18More fixes to build the kernel with a compiler that defaults to -fno-commonAlex Richardson
Using the same approach as the last commit for the files used by genassym.sh. Obtained from: CheriBSD Notes: svn path=/head/; revision=360072
2019-08-25Replace -Werror with ${WERROR} in module buildsWarner Losh
Notes: svn path=/head/; revision=351497
2019-07-30linuxulator: rename linux_locore.s to .asmEd Maste
It is assembled using "${CC} -x assembler-with-cpp", which by convention (bsd.suffixes.mk) uses the .asm extension. This is a portion of the review referenced below (D18344). That review also renamed linux_support.s to .S, but that is a functional change (using the compiler's integrated assembler instead of as) and will be revisited separately. MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18344 Notes: svn path=/head/; revision=350451
2019-05-13Add warning to the Linuxulator makefiles that building it outside of aDmitry Chagin
kernel does not make sence. PR: 222861 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20179 Notes: svn path=/head/; revision=347540
2019-05-13Linuxulator depends on a fundamental kernel settings such as SMP. ManyDmitry Chagin
of them listed in opt_global.h which is not generated while building modules outside of a kernel and such modules never match real cofigured kernel. So, we should prevent our users from building obviously defective modules. Therefore, remove the root cause of the building of modules outside of a kernel - the possibility of building modules with DEBUG or KTR flags. And remove all of DEBUG printfs as it is incomplete and in threaded programms not informative, also a half of system call does not have DEBUG printf. For debuging Linux programms we have dtrace, ktr and ktrace ability. PR: 222861 Reviewed by: trasz MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20178 Notes: svn path=/head/; revision=347538
2019-05-06The build process generates assym.inc from genassym.o, so don't forgetDmitry Chagin
to clean genassym.o MFC after: 2 weeks Notes: svn path=/head/; revision=347196
2018-07-03All genassym.sh usage need offset.incBryan Drewery
Notes: svn path=/head/; revision=335910
2018-06-25linux64: add arm64 linuxulator build detailsEd Maste
The arm64 linuxulator needs different arguments for the objcopy invocation used to build the linux VDSO. These arguments are both arch- and OS-dependent, so I did not try to use some common setting for them. Reviewed by: imp Sponsored by: Turing Robotic Industries Differential Revision: https://reviews.freebsd.org/D16011 Notes: svn path=/head/; revision=335646
2018-06-12linux64: use linux output target for linux_vdso.soEd Maste
linux_vdso.so provides the vdso for the linuxulator's amd64 target and is mapped into a Linux binary's address space. Thus it should be a Linux-style .so, which has the ELF OS/ABI unset. It turns out that ELF Tool Chain elfcopy/objcopy also has a bug where the OS/ABI field is unset, regardless of the specified --output-target, so this change is a no-op with the default in-tree toolchain. This is a real fix when using external binutils, and the ELF Tool Chain bug will be fixed in the future. PR: 228934 Sponsored by: Turing Robotic Industries Notes: svn path=/head/; revision=334998
2018-04-06Move most of the contents of opt_compat.h to opt_global.h.Brooks Davis
opt_compat.h is mentioned in nearly 180 files. In-progress network driver compabibility improvements may add over 100 more so this is closer to "just about everywhere" than "only some files" per the guidance in sys/conf/options. Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of sys/compat/linux/*.c. A fake _COMPAT_LINUX option ensure opt_compat.h is created on all architectures. Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the set of compiled files. Reviewed by: kib, cem, jhb, jtl Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14941 Notes: svn path=/head/; revision=332122
2018-03-20Rename assym.s to assym.incEd Maste
assym is only to be included by other .s files, and should never actually be assembled by itself. Reviewed by: imp, bdrewery (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14180 Notes: svn path=/head/; revision=331254
2018-02-05Move assym.s to DPSRCS in linux modulesEd Maste
assym.s exists only to be included by other .s files, and should not actually be assembled by itself. Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=328883
2018-01-29Correct MD patch in linux64 module MakefileEd Maste
Reviewed by: imp Sponsored by: Turing Robotic Industries Inc. Differential Revision: https://reviews.freebsd.org/D14061 Notes: svn path=/head/; revision=328526
2017-06-04Revert r319053 due to lack of sence. As pointed out by kib@ opt_global.hDmitry Chagin
contains such fundamental settings as e.g. SMP option and fake opt_global.h almost never match real configured kernels. Reported by: kib@ Notes: svn path=/head/; revision=319570
2017-05-28On success, getrandom() Linux system call returns the number of bytes thatDmitry Chagin
were copied to the buffer supplied by the user. Also fix getrandom() if Linuxulator modules are built without the kernel. PR: 219464 Submitted by: Maciej Pasternacki Reported by: Maciej Pasternacki MFC after: 1 week Notes: svn path=/head/; revision=319053
2017-05-28Strip _binary_linux_locore_o_size from ${VDSO}.so as it is a low absoluteDmitry Chagin
symbol, and this breaks symbol lookup in ddb. Requested by: bde@ MFC after: 1 week Notes: svn path=/head/; revision=319052
2017-03-04sys/modules: normalize .CURDIR-relative paths to SRCTOPEnji Cooper
This simplifies make output/logic Tested with: `cd sys/modules; make ALL_MODULES=` on amd64 MFC after: 1 month Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314651
2017-02-21Exclude -flto when building *genassym.oEd Maste
The build process generates *assym.h using nm from *genassym.o (which is in turn created from *genassym.c). When compiling with link-time optimization (LTO) using -flto, .o files are LLVM bitcode, not ELF objects. This is not usable by genassym.sh, so remove -flto from those ${CC} invocations. Submitted by: George Rimar Reviewed by: dim MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D9659 Notes: svn path=/head/; revision=314054
2017-02-16Implement linux version of ptrace(2). It's nowhere near complete,Edward Tomasz Napierala
but it allows to use 64 bit linux strace(1) on 64 bit linux binaries. Reviewed by: dchagin (earlier version) MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9406 Notes: svn path=/head/; revision=313809
2016-07-27opt_apic.h is only used on i386.Bryan Drewery
MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=303415