From 82d14e23e28c2ea36c523af4811e576f33b7765f Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Fri, 27 Nov 2020 20:16:00 +0100 Subject: [PATCH] Use `rustc` directly instead of `cargo` This is a big PR, but most of it is interdependent to the rest. - Shared Rust infrastructure: `libkernel`, `libmodule`, `libcore`, `liballoc`, `libcompiler_builtins`. + The Rust modules are now much smaller since they do not contain several copies of those libraries. Our example `.ko` on release is just 12 KiB, down from 1.3 MiB. For reference: `vmlinux` on release w/ Rust is 23 MiB (compressed: 2.1 MiB) `vmlinux` on release w/o Rust is 22 MiB (compressed: 1.9 MiB) i.e. the bulk is now shared. + Multiple builtin modules are now supported since their symbols do not collide against each other (fixes #9). + Faster compilation (less crates to compile & less repetition). + We achieve this by compiling all the shared code to `.rlib`s (and the `.so` for the proc macro). For loadable modules, we need to rely on the upcoming v0 Rust mangling scheme, plus we need to export the Rust symbols needed by the `.ko`s. - Simpler, flat file structure: now a small driver may only need a single file like `drivers/char/rust_example.rs`, like in C. + All the `rust/*` and `driver/char/rust_example/*` files moved to fit in the new structure: less files around. - Only `rust-lang/{rust,rust-bindgen,compiler-builtins}` as dependencies. + Also helps with the faster compilation. - Dependency handling integration with `Kbuild`/`fixdep`. + Changes to the Rust standard library, kernel headers (bindings), `rust/` source files, `.rs` changes, command-line changes, flag changes, etc. all trigger recompilation as needed. + Works as expected with parallel support (`-j`). - Automatic generation of the `exports.c` list: + Instead of manually handling the list, all non-local functions available in `core`, `alloc` and `kernel` are exported, so all modules should work, regardless of what they need, and without failing linking due to symbols in the manual list not existing (e.g. due to differences in config options). + They are a lot, though: * ~6k Rust symbols vs. ~4k C symbols in release. * However, 4k of those are `bindings_raw` (i.e. duplicated C ones), which shouldn't be exported. Thus we should look into making `bindings_raw` private to the crate (at the moment, the (first) Rust example requires `::default`). + Licensing: * `kernel`'s symbols are exported as GPL. * `core`'s and `alloc`'s symbols are exported as non-GPL so that third-parties can build Rust modules as long as they write their own kernel support infrastructure, i.e. without taking advantage of `kernel`. This seemed to make the most sense compared to other exports from the kernel, plus it follows more closely the original licence of the crates. - Support for GCC-compiled kernels. + The generated bindings do not have meaningful differences in our release config, between GCC 10.1 and Clang 11. + Other configs (e.g. our debug one) may add/remove types and functions. That is fine unless we use them form our bindings. + However, there are config options that may not work (e.g. the randstruct GCC plugin if we use one of those structs). - Proper `make clean` support. - Offline builds by default (there is no "online compilation" anymore; fixes #17). - No interleaved Cargo output (fixes #29). - No nightly dependency on Cargo's `build-std`; since now we manage the cross-compilation ourselves (should fix #27). - "Big" kallsyms symbol support: + I already raised ksym names from 128 to 256 back when I wrote the first integration. However, Rust symbols can be huge in debug/non-optimized, so I increased it again to 512; plus the module name from 56 to 248. + In turn, this required tuning the table format to support 2-byte lengths for ksyms. Compression at generation and kernel decompression is covered, although it may be the case that some script/tool also requires changes to understand the new table format. - Since now a kernel can be "Rust-enabled", a new `CONFIG_RUST` option is added to enable/disable it manually, regardless of whether one has `rustc` available or not (`CONFIG_HAS_RUST`). - Improved handling of `rustc` flags (`opt-level`, `debuginfo`, etc.), by default following what the user selected for C, but customizable through a Kconfig menu. As well as options for tweaking overflow checks, debug assertions, etc. - This rewrite of the Kbuild support is cleaner, i.e. less hacks in general handling paths (e.g. no more `shell readlink` for `O=`). - Duplicated the example driver 3 times so that we can test in the CI that 2 builtins and 2 loadables work, all at the same time. - Updated the quick start guide. - Updated CI `.config`s: + Add the new options and test with 2 builtins and 2 loadables. At the same time, remove the matrix test for builtin/loadable. + Updated with `toolchain` matrix support: now we test building with GCC, Clang or a full LLVM toolchain. + Debug: more things enabled (debuginfo, kgdb, unit testing, etc.) that mimic more what a developer would have. Running the CI will be slightly slower, but should be OK. Also enable `-C opt-level=0` to test that such an extreme works and also to see how much bloated everything becomes. + Release: disabled `EXPERT` and changed a few things to make it look more like a normal configuration. + Also update both configs to v5.10 and `LLVM=1` while I was at it. (I could have split a few of these ones off into another PR, but anyway it is for the CI only and I had already done it). - Less `extern crate`s needed since we pass it via `rustc` (closer to idiomatic 2018 edition Rust code). Things to note: - There is two more nightly features used: + The new Rust mangling scheme: we know it will be stable (and the default on, later on). + The binary dep-info output: if we remove all other nightly features, this one can easily go too. - The hack at `exports.c` to export symbols to loadable modules. - The hack at `allocator.rs` to get the `__rust_*()` functions. Signed-off-by: Miguel Ojeda --- .github/workflows/ci.yaml | 64 ++-- .github/workflows/kernel-debug.config | 188 +++++++--- .github/workflows/kernel-release.config | 341 +++++++++++------- .github/workflows/qemu-init.sh | 8 +- .github/workflows/qemu-initramfs.desc | 15 +- .gitignore | 4 +- Cargo.lock | 26 -- Cargo.toml | 10 - Documentation/rust/quick-start.rst | 116 +++--- Makefile | 91 ++--- arch/x86/rust/target.json | 1 + drivers/char/Kconfig | 44 ++- drivers/char/Makefile | 5 +- .../src/lib.rs => rust_example.rs} | 2 - drivers/char/rust_example/Cargo.toml | 16 - drivers/char/rust_example/Makefile | 3 - drivers/char/rust_example_2.rs | 52 +++ drivers/char/rust_example_3.rs | 52 +++ drivers/char/rust_example_4.rs | 52 +++ include/linux/kallsyms.h | 2 +- include/linux/moduleparam.h | 2 +- init/Kconfig | 25 +- kernel/kallsyms.c | 7 + kernel/livepatch/core.c | 6 +- lib/Kconfig.debug | 113 ++++++ rust/.gitignore | 4 + rust/Makefile | 104 +++++- rust/exports.c | 18 + rust/kernel/Cargo.toml | 13 - rust/kernel/allocator.rs | 54 +++ rust/kernel/{src => }/bindings.rs | 1 + rust/kernel/{src => }/bindings_helper.h | 1 + rust/kernel/{src => }/c_types.rs | 0 rust/kernel/{src => }/chrdev.rs | 0 rust/kernel/{src => }/error.rs | 0 rust/kernel/{src => }/file_operations.rs | 10 - rust/kernel/{src => }/lib.rs | 4 +- rust/kernel/{src => }/miscdev.rs | 0 rust/kernel/{src => }/prelude.rs | 3 + rust/kernel/{src => }/printk.rs | 0 rust/kernel/{src => }/random.rs | 0 rust/kernel/src/allocator.rs | 26 -- rust/kernel/{src => }/sysctl.rs | 0 rust/kernel/{src => }/types.rs | 0 rust/kernel/{src => }/user_ptr.rs | 0 rust/{module/src/lib.rs => module.rs} | 2 - rust/module/Cargo.toml | 12 - scripts/Makefile.build | 40 +- scripts/Makefile.lib | 31 +- scripts/kallsyms.c | 33 +- scripts/kconfig/confdata.c | 4 +- scripts/mod/modpost.c | 2 +- tools/include/linux/kallsyms.h | 2 +- tools/include/linux/lockdep.h | 2 +- tools/lib/perf/include/perf/event.h | 2 +- tools/lib/symbol/kallsyms.h | 2 +- 56 files changed, 1094 insertions(+), 521 deletions(-) delete mode 100644 Cargo.lock delete mode 100644 Cargo.toml rename drivers/char/{rust_example/src/lib.rs => rust_example.rs} (98%) delete mode 100644 drivers/char/rust_example/Cargo.toml delete mode 100644 drivers/char/rust_example/Makefile create mode 100644 drivers/char/rust_example_2.rs create mode 100644 drivers/char/rust_example_3.rs create mode 100644 drivers/char/rust_example_4.rs create mode 100644 rust/.gitignore create mode 100644 rust/exports.c delete mode 100644 rust/kernel/Cargo.toml create mode 100644 rust/kernel/allocator.rs rename rust/kernel/{src => }/bindings.rs (86%) rename rust/kernel/{src => }/bindings_helper.h (88%) rename rust/kernel/{src => }/c_types.rs (100%) rename rust/kernel/{src => }/chrdev.rs (100%) rename rust/kernel/{src => }/error.rs (100%) rename rust/kernel/{src => }/file_operations.rs (97%) rename rust/kernel/{src => }/lib.rs (98%) rename rust/kernel/{src => }/miscdev.rs (100%) rename rust/kernel/{src => }/prelude.rs (76%) rename rust/kernel/{src => }/printk.rs (100%) rename rust/kernel/{src => }/random.rs (100%) delete mode 100644 rust/kernel/src/allocator.rs rename rust/kernel/{src => }/sysctl.rs (100%) rename rust/kernel/{src => }/types.rs (100%) rename rust/kernel/{src => }/user_ptr.rs (100%) rename rust/{module/src/lib.rs => module.rs} (99%) delete mode 100644 rust/module/Cargo.toml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 79abf0f70940cc..af1ae7588d66bb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,8 +10,8 @@ jobs: strategy: matrix: - mode: [debug, release] - module: [builtin, loadable] + config: [debug, release] + toolchain: [gcc, clang, llvm] outputdir: [src, build] steps: @@ -20,29 +20,32 @@ jobs: - run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - run: sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main' - run: sudo apt-get update -y - - run: sudo apt-get install -y clang-11 libelf-dev qemu-system-x86 busybox-static + - run: sudo apt-get install -y clang-11 lld-11 libelf-dev qemu-system-x86 busybox-static - run: rustup default nightly-2020-08-27 - run: rustup component add rustfmt - run: rustup component add rust-src + - run: git clone --depth 1 --branch 0.1.36 https://github.com/rust-lang/compiler-builtins.git $(rustc --print sysroot)/lib/rustlib/src/compiler-builtins # Build - - run: cp .github/workflows/kernel-${{ matrix.mode }}.config .config - - - if: matrix.module == 'loadable' - run: sed -i -E 's/^(CONFIG_RUST_EXAMPLE=)(y)$/\1m/g' .config + - run: cp .github/workflows/kernel-${{ matrix.config }}.config .config - if: matrix.outputdir == 'build' run: mkdir build && mv .config build/.config - - if: matrix.outputdir == 'src' - run: make CC=clang-11 LLVM_CONFIG_PATH=llvm-config-11 -j3 - - if: matrix.outputdir == 'build' - run: make O=build CC=clang-11 LLVM_CONFIG_PATH=llvm-config-11 -j3 + - if: matrix.toolchain == 'gcc' && matrix.outputdir == 'src' + run: make -j3 + - if: matrix.toolchain == 'gcc' && matrix.outputdir == 'build' + run: make -j3 O=build + - if: matrix.toolchain == 'clang' && matrix.outputdir == 'src' + run: make -j3 LLVM_CONFIG_PATH=llvm-config-11 CC=clang-11 + - if: matrix.toolchain == 'clang' && matrix.outputdir == 'build' + run: make -j3 O=build LLVM_CONFIG_PATH=llvm-config-11 CC=clang-11 + - if: matrix.toolchain == 'llvm' && matrix.outputdir == 'src' + run: make -j3 LLVM_CONFIG_PATH=llvm-config-11 LLVM=1 + - if: matrix.toolchain == 'llvm' && matrix.outputdir == 'build' + run: make -j3 O=build LLVM_CONFIG_PATH=llvm-config-11 LLVM=1 # Run - - if: matrix.module == 'builtin' - run: sed -i '/rust_example/d' .github/workflows/qemu-initramfs.desc - - if: matrix.outputdir == 'build' run: sed -i 's:drivers/:build/drivers/:' .github/workflows/qemu-initramfs.desc @@ -52,28 +55,31 @@ jobs: run: build/usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img - if: matrix.outputdir == 'src' - run: qemu-system-x86_64 -kernel arch/x86/boot/bzImage -initrd qemu-initramfs.img -cpu Cascadelake-Server -smp 2 -nographic -no-reboot -append "console=ttyS0 ${{ matrix.module == 'builtin' && 'rust_example.my_i32=123321' || '' }}" | tee qemu-stdout.log + run: qemu-system-x86_64 -kernel arch/x86/boot/bzImage -initrd qemu-initramfs.img -cpu Cascadelake-Server -smp 2 -nographic -no-reboot -append "console=ttyS0 rust_example.my_i32=123321 rust_example_2.my_i32=234432" | tee qemu-stdout.log - if: matrix.outputdir == 'build' - run: qemu-system-x86_64 -kernel build/arch/x86/boot/bzImage -initrd qemu-initramfs.img -cpu Cascadelake-Server -smp 2 -nographic -no-reboot -append "console=ttyS0 ${{ matrix.module == 'builtin' && 'rust_example.my_i32=123321' || '' }}" | tee qemu-stdout.log + run: qemu-system-x86_64 -kernel build/arch/x86/boot/bzImage -initrd qemu-initramfs.img -cpu Cascadelake-Server -smp 2 -nographic -no-reboot -append "console=ttyS0 rust_example.my_i32=123321 rust_example_2.my_i32=234432" | tee qemu-stdout.log # Check - - run: grep -F 'Rust Example (init)' qemu-stdout.log - - run: "grep 'my_i32: \\+123321' qemu-stdout.log" - - if: matrix.module == 'loadable' - run: grep -F 'Rust Example (exit)' qemu-stdout.log + - run: grep -F '] Rust Example (init)' qemu-stdout.log + - run: grep -F '] [2] Rust Example (init)' qemu-stdout.log + - run: grep -F '] [3] Rust Example (init)' qemu-stdout.log + - run: grep -F '] [4] Rust Example (init)' qemu-stdout.log - # Report - - if: matrix.outputdir == 'src' && matrix.module == 'loadable' - run: ls -l drivers/char/rust_example/rust_example.ko - - if: matrix.outputdir == 'build' && matrix.module == 'loadable' - run: ls -l build/drivers/char/rust_example/rust_example.ko + - run: "grep -F '] my_i32: 123321' qemu-stdout.log" + - run: "grep -F '] [2] my_i32: 234432' qemu-stdout.log" + - run: "grep -F '] [3] my_i32: 345543' qemu-stdout.log" + - run: "grep -F '] [4] my_i32: 456654' qemu-stdout.log" + + - run: grep -F '] [3] Rust Example (exit)' qemu-stdout.log + - run: grep -F '] [4] Rust Example (exit)' qemu-stdout.log + # Report - if: matrix.outputdir == 'src' - run: ls -l vmlinux arch/x86/boot/bzImage + run: ls -l drivers/char/rust_example.o drivers/char/rust_example_3.ko rust/*.o vmlinux arch/x86/boot/bzImage - if: matrix.outputdir == 'build' - run: ls -l build/vmlinux build/arch/x86/boot/bzImage + run: ls -l build/drivers/char/rust_example.o build/drivers/char/rust_example_3.ko build/rust/*.o build/vmlinux build/arch/x86/boot/bzImage - if: matrix.outputdir == 'src' - run: size vmlinux + run: size drivers/char/rust_example.o drivers/char/rust_example_3.ko rust/*.o vmlinux - if: matrix.outputdir == 'build' - run: size build/vmlinux + run: size build/drivers/char/rust_example.o build/drivers/char/rust_example_3.ko build/rust/*.o build/vmlinux diff --git a/.github/workflows/kernel-debug.config b/.github/workflows/kernel-debug.config index de7c7905ecb3c4..48598b29cd848b 100644 --- a/.github/workflows/kernel-debug.config +++ b/.github/workflows/kernel-debug.config @@ -1,18 +1,22 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86 5.9.0-rc2 Kernel Configuration +# Linux/x86 5.10.0 Kernel Configuration # -CONFIG_CC_VERSION_TEXT="clang version 10.0.1" +CONFIG_CC_VERSION_TEXT="clang version 11.0.0 (https://github.com/llvm/llvm-project.git 176249bd6732a8044d457092ed932768724a6f06)" CONFIG_GCC_VERSION=0 -CONFIG_LD_VERSION=230000000 +CONFIG_LD_VERSION=0 CONFIG_CC_IS_CLANG=y -CONFIG_CLANG_VERSION=100001 +CONFIG_LD_IS_LLD=y +CONFIG_CLANG_VERSION=110000 +CONFIG_LLD_VERSION=110000 CONFIG_HAS_RUST=y CONFIG_RUSTC_VERSION=14800 -CONFIG_CARGO_VERSION=14800 CONFIG_CC_CAN_LINK=y CONFIG_CC_CAN_LINK_STATIC=y CONFIG_CC_HAS_ASM_GOTO=y +CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y +CONFIG_TOOLS_SUPPORT_RELR=y +CONFIG_CC_HAS_ASM_INLINE=y CONFIG_CONSTRUCTORS=y CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_TABLE_SORT=y @@ -148,6 +152,7 @@ CONFIG_INITRAMFS_SOURCE="" # CONFIG_BOOT_CONFIG is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_LD_ORPHAN_WARN=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_HAVE_PCSPKR_PLATFORM=y CONFIG_EXPERT=y @@ -199,10 +204,11 @@ CONFIG_SLUB=y # CONFIG_SLOB is not set # CONFIG_SLAB_MERGE_DEFAULT is not set # CONFIG_SLAB_FREELIST_RANDOM is not set -# CONFIG_SLAB_FREELIST_HARDENED is not set +CONFIG_SLAB_FREELIST_HARDENED=y # CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set CONFIG_SLUB_CPU_PARTIAL=y # CONFIG_PROFILING is not set +CONFIG_RUST=y CONFIG_TRACEPOINTS=y # end of General setup @@ -319,7 +325,6 @@ CONFIG_X86_RESERVE_LOW=64 CONFIG_X86_INTEL_TSX_MODE_OFF=y # CONFIG_X86_INTEL_TSX_MODE_ON is not set # CONFIG_X86_INTEL_TSX_MODE_AUTO is not set -# CONFIG_SECCOMP is not set # CONFIG_HZ_100 is not set # CONFIG_HZ_250 is not set # CONFIG_HZ_300 is not set @@ -328,13 +333,8 @@ CONFIG_HZ=1000 # CONFIG_KEXEC is not set # CONFIG_CRASH_DUMP is not set CONFIG_PHYSICAL_START=0x1000000 -CONFIG_RELOCATABLE=y -CONFIG_RANDOMIZE_BASE=y -CONFIG_X86_NEED_RELOCS=y +# CONFIG_RELOCATABLE is not set CONFIG_PHYSICAL_ALIGN=0x200000 -CONFIG_DYNAMIC_MEMORY_LAYOUT=y -CONFIG_RANDOMIZE_MEMORY=y -CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING=0x0 CONFIG_HOTPLUG_CPU=y # CONFIG_BOOTPARAM_HOTPLUG_CPU0 is not set # CONFIG_DEBUG_HOTPLUG_CPU0 is not set @@ -349,7 +349,6 @@ CONFIG_HAVE_LIVEPATCH=y CONFIG_ARCH_HAS_ADD_PAGES=y CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y -CONFIG_ARCH_ENABLE_THP_MIGRATION=y # # Power management and ACPI options @@ -395,7 +394,6 @@ CONFIG_ARCH_SUPPORTS_ACPI=y # CONFIG_FIRMWARE_MEMMAP is not set # CONFIG_FW_CFG_SYSFS is not set # CONFIG_GOOGLE_FIRMWARE is not set -CONFIG_EFI_EARLYCON=y # # Tegra firmware driver @@ -416,11 +414,14 @@ CONFIG_HOTPLUG_SMT=y CONFIG_GENERIC_ENTRY=y CONFIG_HAVE_OPROFILE=y CONFIG_OPROFILE_NMI_TIMER=y -# CONFIG_KPROBES is not set +CONFIG_KPROBES=y CONFIG_JUMP_LABEL=y # CONFIG_STATIC_KEYS_SELFTEST is not set +# CONFIG_STATIC_CALL_SELFTEST is not set +CONFIG_OPTPROBES=y CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_KRETPROBES=y CONFIG_HAVE_IOREMAP_PROT=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y @@ -453,7 +454,9 @@ CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y CONFIG_HAVE_CMPXCHG_LOCAL=y CONFIG_HAVE_CMPXCHG_DOUBLE=y +CONFIG_HAVE_ARCH_SECCOMP=y CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +# CONFIG_SECCOMP is not set CONFIG_HAVE_ARCH_STACKLEAK=y CONFIG_HAVE_STACKPROTECTOR=y CONFIG_STACKPROTECTOR=y @@ -484,9 +487,11 @@ CONFIG_STRICT_KERNEL_RWX=y CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y CONFIG_STRICT_MODULE_RWX=y CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y -CONFIG_ARCH_USE_MEMREMAP_PROT=y # CONFIG_LOCK_EVENT_COUNTS is not set CONFIG_ARCH_HAS_MEM_ENCRYPT=y +CONFIG_HAVE_STATIC_CALL=y +CONFIG_HAVE_STATIC_CALL_INLINE=y +CONFIG_ARCH_WANT_LD_ORPHAN_WARN=y # # GCOV-based kernel profiling @@ -554,9 +559,7 @@ CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_VIRT_TO_BUS=y # CONFIG_KSM is not set CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -CONFIG_TRANSPARENT_HUGEPAGE=y -CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y -# CONFIG_TRANSPARENT_HUGEPAGE_MADVISE is not set +# CONFIG_TRANSPARENT_HUGEPAGE is not set CONFIG_ARCH_WANTS_THP_SWAP=y # CONFIG_CLEANCACHE is not set # CONFIG_CMA is not set @@ -603,7 +606,9 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y # CONFIG_DEBUG_DRIVER is not set # CONFIG_DEBUG_DEVRES is not set # CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set +# CONFIG_PM_QOS_KUNIT_TEST is not set # CONFIG_TEST_ASYNC_DRIVER_PROBE is not set +# CONFIG_KUNIT_DRIVER_PE_TEST is not set CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_CPU_VULNERABILITIES=y # end of Generic Driver Options @@ -648,13 +653,6 @@ CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y # # Altera FPGA firmware download module (requires I2C) # - -# -# Intel MIC & related support -# -# CONFIG_VOP_BUS is not set -# end of Intel MIC & related support - # CONFIG_ECHO is not set # end of Misc devices @@ -736,9 +734,11 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1 # # Non-8250 serial port support # +# CONFIG_SERIAL_KGDB_NMI is not set # CONFIG_SERIAL_UARTLITE is not set CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_CONSOLE_POLL=y # CONFIG_SERIAL_LANTIQ is not set # CONFIG_SERIAL_SCCNXP is not set # CONFIG_SERIAL_ALTERA_JTAGUART is not set @@ -753,6 +753,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y # CONFIG_TRACE_SINK is not set # CONFIG_SERIAL_DEV_BUS is not set # CONFIG_TTY_PRINTK is not set +# CONFIG_VIRTIO_CONSOLE is not set # CONFIG_IPMI_HANDLER is not set # CONFIG_HW_RANDOM is not set # CONFIG_MWAVE is not set @@ -763,6 +764,9 @@ CONFIG_SERIAL_CORE_CONSOLE=y # CONFIG_TCG_TPM is not set # CONFIG_TELCLOCK is not set CONFIG_RUST_EXAMPLE=y +CONFIG_RUST_EXAMPLE_2=y +CONFIG_RUST_EXAMPLE_3=m +CONFIG_RUST_EXAMPLE_4=m # end of Character devices # CONFIG_RANDOM_TRUST_BOOTLOADER is not set @@ -791,7 +795,6 @@ CONFIG_RUST_EXAMPLE=y # CONFIG_PINCTRL is not set # CONFIG_GPIOLIB is not set # CONFIG_W1 is not set -# CONFIG_POWER_AVS is not set # CONFIG_POWER_RESET is not set # CONFIG_POWER_SUPPLY is not set # CONFIG_HWMON is not set @@ -898,7 +901,6 @@ CONFIG_RTC_MC146818_LIB=y # CONFIG_GREYBUS is not set # CONFIG_STAGING is not set # CONFIG_X86_PLATFORM_DEVICES is not set -# CONFIG_MFD_CROS_EC is not set # CONFIG_CHROME_PLATFORMS is not set # CONFIG_MELLANOX_PLATFORM is not set # CONFIG_COMMON_CLK is not set @@ -990,7 +992,7 @@ CONFIG_CLKBLD_I8253=y # CONFIG_BCM_KONA_USB2_PHY is not set # CONFIG_PHY_PXA_28NM_HSIC is not set # CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_PHY_INTEL_EMMC is not set +# CONFIG_PHY_INTEL_LGM_EMMC is not set # end of PHY Subsystem # CONFIG_POWERCAP is not set @@ -1093,11 +1095,11 @@ CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,appar # CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y -CONFIG_INIT_STACK_NONE=y -# CONFIG_INIT_STACK_ALL_PATTERN is not set +# CONFIG_INIT_STACK_NONE is not set +CONFIG_INIT_STACK_ALL_PATTERN=y # CONFIG_INIT_STACK_ALL_ZERO is not set -# CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set -# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set +CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y +CONFIG_INIT_ON_FREE_DEFAULT_ON=y # end of Memory initialization # end of Kernel hardening options # end of Security options @@ -1137,7 +1139,6 @@ CONFIG_CRC32_SLICEBY8=y # CONFIG_CRC8 is not set # CONFIG_RANDOM32_SELFTEST is not set # CONFIG_XZ_DEC is not set -CONFIG_XARRAY_MULTI=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HAS_DMA=y @@ -1146,17 +1147,16 @@ CONFIG_NEED_DMA_MAP_STATE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_SWIOTLB=y # CONFIG_DMA_API_DEBUG is not set +# CONFIG_CPUMASK_OFFSTACK is not set CONFIG_GLOB=y # CONFIG_GLOB_SELFTEST is not set # CONFIG_IRQ_POLL is not set CONFIG_HAVE_GENERIC_VDSO=y CONFIG_GENERIC_GETTIMEOFDAY=y CONFIG_GENERIC_VDSO_TIME_NS=y -CONFIG_FONT_SUPPORT=y -CONFIG_FONT_8x16=y -CONFIG_FONT_AUTOSELECT=y CONFIG_ARCH_HAS_PMEM_API=y CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE=y +CONFIG_ARCH_HAS_COPY_MC=y CONFIG_ARCH_STACKWALK=y CONFIG_STACKDEPOT=y # CONFIG_STRING_SELFTEST is not set @@ -1184,36 +1184,55 @@ CONFIG_DEBUG_BUGVERBOSE=y # # Compile-time checks and compiler options # -# CONFIG_DEBUG_INFO is not set +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_INFO_REDUCED is not set +# CONFIG_DEBUG_INFO_COMPRESSED is not set +# CONFIG_DEBUG_INFO_SPLIT is not set +CONFIG_DEBUG_INFO_DWARF4=y +# CONFIG_DEBUG_INFO_BTF is not set +# CONFIG_GDB_SCRIPTS is not set CONFIG_ENABLE_MUST_CHECK=y CONFIG_FRAME_WARN=2048 # CONFIG_STRIP_ASM_SYMS is not set -# CONFIG_READABLE_ASM is not set +CONFIG_READABLE_ASM=y # CONFIG_HEADERS_INSTALL is not set # CONFIG_DEBUG_SECTION_MISMATCH is not set # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set -# CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_32B is not set +CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_32B=y CONFIG_STACK_VALIDATION=y +CONFIG_VMLINUX_VALIDATION=y # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set # end of Compile-time checks and compiler options # # Generic Kernel Debugging Instruments # -# CONFIG_MAGIC_SYSRQ is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +CONFIG_MAGIC_SYSRQ_SERIAL=y +CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE="" CONFIG_DEBUG_FS=y # CONFIG_DEBUG_FS_ALLOW_ALL is not set # CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set CONFIG_DEBUG_FS_ALLOW_NONE=y CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set +CONFIG_KGDB=y +CONFIG_KGDB_HONOUR_BLOCKLIST=y +CONFIG_KGDB_SERIAL_CONSOLE=y +# CONFIG_KGDB_TESTS is not set +# CONFIG_KGDB_LOW_LEVEL_TRAP is not set +# CONFIG_KGDB_KDB is not set +CONFIG_ARCH_HAS_EARLY_DEBUG=y CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y CONFIG_UBSAN=y CONFIG_UBSAN_TRAP=y CONFIG_UBSAN_BOUNDS=y +CONFIG_UBSAN_LOCAL_BOUNDS=y CONFIG_UBSAN_MISC=y CONFIG_UBSAN_SANITIZE_ALL=y # CONFIG_TEST_UBSAN is not set +CONFIG_HAVE_ARCH_KCSAN=y +CONFIG_HAVE_KCSAN_COMPILER=y # end of Generic Kernel Debugging Instruments CONFIG_DEBUG_KERNEL=y @@ -1252,18 +1271,18 @@ CONFIG_DEBUG_KMEMLEAK_MEM_POOL_SIZE=16000 # CONFIG_DEBUG_KMEMLEAK_TEST is not set # CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF is not set CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y -# CONFIG_DEBUG_STACK_USAGE is not set +CONFIG_DEBUG_STACK_USAGE=y CONFIG_SCHED_STACK_END_CHECK=y CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y CONFIG_DEBUG_VM=y CONFIG_DEBUG_VM_VMACACHE=y CONFIG_DEBUG_VM_RB=y CONFIG_DEBUG_VM_PGFLAGS=y -# CONFIG_DEBUG_VM_PGTABLE is not set +CONFIG_DEBUG_VM_PGTABLE=y CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y CONFIG_DEBUG_VIRTUAL=y CONFIG_DEBUG_MEMORY_INIT=y -# CONFIG_DEBUG_PER_CPU_MAPS is not set +CONFIG_DEBUG_PER_CPU_MAPS=y CONFIG_HAVE_ARCH_KASAN=y CONFIG_HAVE_ARCH_KASAN_VMALLOC=y CONFIG_CC_HAS_KASAN_GENERIC=y @@ -1276,7 +1295,8 @@ CONFIG_KASAN_OUTLINE=y # CONFIG_KASAN_STACK_ENABLE is not set CONFIG_KASAN_STACK=0 CONFIG_KASAN_VMALLOC=y -# CONFIG_TEST_KASAN is not set +# CONFIG_KASAN_KUNIT_TEST is not set +# CONFIG_TEST_KASAN_MODULE is not set # end of Memory Debugging CONFIG_DEBUG_SHIRQ=y @@ -1329,6 +1349,8 @@ CONFIG_DEBUG_ATOMIC_SLEEP=y # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_LOCK_TORTURE_TEST is not set # CONFIG_WW_MUTEX_SELFTEST is not set +# CONFIG_SCF_TORTURE_TEST is not set +# CONFIG_CSD_LOCK_WAIT_DEBUG is not set # end of Lock Debugging (spinlocks, mutexes, etc...) CONFIG_TRACE_IRQFLAGS=y @@ -1348,13 +1370,13 @@ CONFIG_DEBUG_NOTIFIERS=y CONFIG_BUG_ON_DATA_CORRUPTION=y # end of Debug kernel data structures -# CONFIG_DEBUG_CREDENTIALS is not set +CONFIG_DEBUG_CREDENTIALS=y # # RCU Debugging # CONFIG_PROVE_RCU=y -# CONFIG_RCU_PERF_TEST is not set +# CONFIG_RCU_SCALE_TEST is not set # CONFIG_RCU_TORTURE_TEST is not set # CONFIG_RCU_REF_SCALE_TEST is not set CONFIG_RCU_CPU_STALL_TIMEOUT=21 @@ -1384,7 +1406,6 @@ CONFIG_TRACING=y CONFIG_TRACING_SUPPORT=y # CONFIG_FTRACE is not set # CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KCSAN=y CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y # CONFIG_STRICT_DEVMEM is not set @@ -1404,7 +1425,7 @@ CONFIG_HAVE_MMIOTRACE_SUPPORT=y CONFIG_IO_DELAY_NONE=y # CONFIG_DEBUG_BOOT_PARAMS is not set # CONFIG_CPA_DEBUG is not set -# CONFIG_DEBUG_ENTRY is not set +CONFIG_DEBUG_ENTRY=y # CONFIG_DEBUG_NMI_SELFTEST is not set # CONFIG_X86_DEBUG_FPU is not set CONFIG_UNWINDER_ORC=y @@ -1414,13 +1435,74 @@ CONFIG_UNWINDER_ORC=y # # Kernel Testing and Coverage # -# CONFIG_KUNIT is not set +CONFIG_KUNIT=y +# CONFIG_KUNIT_DEBUGFS is not set +# CONFIG_KUNIT_TEST is not set +# CONFIG_KUNIT_EXAMPLE_TEST is not set +# CONFIG_KUNIT_ALL_TESTS is not set # CONFIG_NOTIFIER_ERROR_INJECTION is not set +CONFIG_FUNCTION_ERROR_INJECTION=y # CONFIG_FAULT_INJECTION is not set CONFIG_ARCH_HAS_KCOV=y CONFIG_CC_HAS_SANCOV_TRACE_PC=y # CONFIG_KCOV is not set -# CONFIG_RUNTIME_TESTING_MENU is not set +CONFIG_RUNTIME_TESTING_MENU=y +# CONFIG_LKDTM is not set +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_TEST_MIN_HEAP is not set +# CONFIG_TEST_SORT is not set +# CONFIG_KPROBES_SANITY_TEST is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_REED_SOLOMON_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_STRSCPY is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_BITMAP is not set +# CONFIG_TEST_UUID is not set +# CONFIG_TEST_XARRAY is not set +# CONFIG_TEST_OVERFLOW is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_TEST_HASH is not set +# CONFIG_TEST_IDA is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_BITOPS is not set +# CONFIG_TEST_VMALLOC is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_FIND_BIT_BENCHMARK is not set +# CONFIG_BITFIELD_KUNIT is not set +# CONFIG_SYSCTL_KUNIT_TEST is not set +# CONFIG_LIST_KUNIT_TEST is not set +# CONFIG_LINEAR_RANGES_TEST is not set +# CONFIG_BITS_TEST is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_TEST_DEBUG_VIRTUAL is not set +# CONFIG_TEST_MEMCAT_P is not set +# CONFIG_TEST_STACKINIT is not set +# CONFIG_TEST_MEMINIT is not set +# CONFIG_TEST_FREE_PAGES is not set +# CONFIG_TEST_FPU is not set # CONFIG_MEMTEST is not set # end of Kernel Testing and Coverage + +# +# Rust hacking +# +CONFIG_RUST_DEBUG_ASSERTIONS=y +CONFIG_RUST_OVERFLOW_CHECKS=y +# CONFIG_RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C is not set +CONFIG_RUST_OPT_LEVEL_0=y +# CONFIG_RUST_OPT_LEVEL_1 is not set +# CONFIG_RUST_OPT_LEVEL_2 is not set +# CONFIG_RUST_OPT_LEVEL_3 is not set +# CONFIG_RUST_OPT_LEVEL_S is not set +# CONFIG_RUST_OPT_LEVEL_Z is not set +CONFIG_RUST_CODEGEN_UNITS=1 +# end of Rust hacking # end of Kernel hacking diff --git a/.github/workflows/kernel-release.config b/.github/workflows/kernel-release.config index 870f0f5e4caa3e..158584f7479946 100644 --- a/.github/workflows/kernel-release.config +++ b/.github/workflows/kernel-release.config @@ -1,18 +1,22 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86 5.9.0-rc2 Kernel Configuration +# Linux/x86 5.10.0 Kernel Configuration # -CONFIG_CC_VERSION_TEXT="clang version 10.0.1" +CONFIG_CC_VERSION_TEXT="clang version 11.0.0 (https://github.com/llvm/llvm-project.git 176249bd6732a8044d457092ed932768724a6f06)" CONFIG_GCC_VERSION=0 -CONFIG_LD_VERSION=230000000 +CONFIG_LD_VERSION=0 CONFIG_CC_IS_CLANG=y -CONFIG_CLANG_VERSION=100001 +CONFIG_LD_IS_LLD=y +CONFIG_CLANG_VERSION=110000 +CONFIG_LLD_VERSION=110000 CONFIG_HAS_RUST=y CONFIG_RUSTC_VERSION=14800 -CONFIG_CARGO_VERSION=14800 CONFIG_CC_CAN_LINK=y CONFIG_CC_CAN_LINK_STATIC=y CONFIG_CC_HAS_ASM_GOTO=y +CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y +CONFIG_TOOLS_SUPPORT_RELR=y +CONFIG_CC_HAS_ASM_INLINE=y CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_TABLE_SORT=y CONFIG_THREAD_INFO_IN_TASK=y @@ -41,6 +45,7 @@ CONFIG_KERNEL_GZIP=y # CONFIG_KERNEL_ZSTD is not set CONFIG_DEFAULT_INIT="" CONFIG_DEFAULT_HOSTNAME="(none)" +# CONFIG_SWAP is not set # CONFIG_SYSVIPC is not set # CONFIG_WATCH_QUEUE is not set # CONFIG_CROSS_MEMORY_ATTACH is not set @@ -73,6 +78,7 @@ CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK=y +CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y # # Timers subsystem @@ -96,6 +102,7 @@ CONFIG_PREEMPT_VOLUNTARY=y CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set # CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_PSI is not set # end of CPU/Task time and stats accounting @@ -129,6 +136,11 @@ CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y CONFIG_CC_HAS_INT128=y CONFIG_ARCH_SUPPORTS_INT128=y # CONFIG_CGROUPS is not set +CONFIG_NAMESPACES=y +# CONFIG_UTS_NS is not set +# CONFIG_TIME_NS is not set +# CONFIG_USER_NS is not set +# CONFIG_PID_NS is not set # CONFIG_CHECKPOINT_RESTORE is not set # CONFIG_SCHED_AUTOGROUP is not set # CONFIG_SYSFS_DEPRECATED is not set @@ -145,61 +157,62 @@ CONFIG_INITRAMFS_SOURCE="" # CONFIG_BOOT_CONFIG is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_LD_ORPHAN_WARN=y +CONFIG_SYSCTL=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_HAVE_PCSPKR_PLATFORM=y -CONFIG_EXPERT=y -# CONFIG_MULTIUSER is not set -# CONFIG_SGETMASK_SYSCALL is not set -# CONFIG_SYSFS_SYSCALL is not set -# CONFIG_FHANDLE is not set -# CONFIG_POSIX_TIMERS is not set +# CONFIG_EXPERT is not set +CONFIG_MULTIUSER=y +CONFIG_SGETMASK_SYSCALL=y +CONFIG_SYSFS_SYSCALL=y +CONFIG_FHANDLE=y +CONFIG_POSIX_TIMERS=y CONFIG_PRINTK=y CONFIG_PRINTK_NMI=y CONFIG_BUG=y -# CONFIG_PCSPKR_PLATFORM is not set +CONFIG_ELF_CORE=y +CONFIG_PCSPKR_PLATFORM=y CONFIG_BASE_FULL=y -# CONFIG_FUTEX is not set -# CONFIG_EPOLL is not set -# CONFIG_SIGNALFD is not set -# CONFIG_TIMERFD is not set -# CONFIG_EVENTFD is not set -# CONFIG_SHMEM is not set -# CONFIG_AIO is not set -# CONFIG_IO_URING is not set -# CONFIG_ADVISE_SYSCALLS is not set -# CONFIG_MEMBARRIER is not set +CONFIG_FUTEX=y +CONFIG_FUTEX_PI=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_IO_URING=y +CONFIG_ADVISE_SYSCALLS=y +CONFIG_MEMBARRIER=y CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y CONFIG_KALLSYMS_BASE_RELATIVE=y # CONFIG_BPF_SYSCALL is not set CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y # CONFIG_USERFAULTFD is not set CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y -# CONFIG_RSEQ is not set +CONFIG_RSEQ=y # CONFIG_EMBEDDED is not set CONFIG_HAVE_PERF_EVENTS=y -# CONFIG_PC104 is not set # # Kernel Performance Events And Counters # CONFIG_PERF_EVENTS=y -# CONFIG_DEBUG_PERF_USE_VMALLOC is not set # end of Kernel Performance Events And Counters -# CONFIG_VM_EVENT_COUNTERS is not set -# CONFIG_SLUB_DEBUG is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y # CONFIG_COMPAT_BRK is not set # CONFIG_SLAB is not set CONFIG_SLUB=y -# CONFIG_SLOB is not set # CONFIG_SLAB_MERGE_DEFAULT is not set # CONFIG_SLAB_FREELIST_RANDOM is not set -# CONFIG_SLAB_FREELIST_HARDENED is not set +CONFIG_SLAB_FREELIST_HARDENED=y # CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set -# CONFIG_SLUB_CPU_PARTIAL is not set +CONFIG_SLUB_CPU_PARTIAL=y # CONFIG_PROFILING is not set +CONFIG_RUST=y # end of General setup CONFIG_64BIT=y @@ -214,8 +227,10 @@ CONFIG_ARCH_MMAP_RND_BITS_MIN=28 CONFIG_ARCH_MMAP_RND_BITS_MAX=32 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 +CONFIG_GENERIC_ISA_DMA=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_ARCH_HAS_CPU_RELAX=y CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y @@ -238,7 +253,7 @@ CONFIG_CC_HAS_SANE_STACKPROTECTOR=y # # Processor type and features # -# CONFIG_ZONE_DMA is not set +CONFIG_ZONE_DMA=y CONFIG_SMP=y CONFIG_X86_FEATURE_NAMES=y CONFIG_X86_MPPARSE=y @@ -262,15 +277,13 @@ CONFIG_X86_MINIMUM_CPU_FAMILY=64 CONFIG_X86_DEBUGCTLMSR=y CONFIG_IA32_FEAT_CTL=y CONFIG_X86_VMX_FEATURE_NAMES=y -# CONFIG_PROCESSOR_SELECT is not set CONFIG_CPU_SUP_INTEL=y CONFIG_CPU_SUP_AMD=y CONFIG_CPU_SUP_HYGON=y CONFIG_CPU_SUP_CENTAUR=y CONFIG_CPU_SUP_ZHAOXIN=y CONFIG_HPET_TIMER=y -# CONFIG_DMI is not set -# CONFIG_MAXSMP is not set +CONFIG_DMI=y CONFIG_NR_CPUS_RANGE_BEGIN=2 CONFIG_NR_CPUS_RANGE_END=512 CONFIG_NR_CPUS_DEFAULT=64 @@ -289,7 +302,9 @@ CONFIG_X86_IO_APIC=y # CONFIG_PERF_EVENTS_AMD_POWER is not set # end of Performance monitoring -# CONFIG_X86_VSYSCALL_EMULATION is not set +CONFIG_X86_16BIT=y +CONFIG_X86_ESPFIX64=y +CONFIG_X86_VSYSCALL_EMULATION=y # CONFIG_X86_IOPL_IOPERM is not set # CONFIG_I8K is not set # CONFIG_MICROCODE is not set @@ -305,15 +320,19 @@ CONFIG_ARCH_SELECT_MEMORY_MODEL=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set CONFIG_X86_RESERVE_LOW=64 -# CONFIG_MTRR is not set -# CONFIG_ARCH_RANDOM is not set -# CONFIG_X86_SMAP is not set -# CONFIG_X86_UMIP is not set +CONFIG_MTRR=y +CONFIG_MTRR_SANITIZER=y +CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0 +CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1 +CONFIG_X86_PAT=y +CONFIG_ARCH_USES_PG_UNCACHED=y +CONFIG_ARCH_RANDOM=y +CONFIG_X86_SMAP=y +CONFIG_X86_UMIP=y # CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS is not set CONFIG_X86_INTEL_TSX_MODE_OFF=y # CONFIG_X86_INTEL_TSX_MODE_ON is not set # CONFIG_X86_INTEL_TSX_MODE_AUTO is not set -# CONFIG_SECCOMP is not set # CONFIG_HZ_100 is not set # CONFIG_HZ_250 is not set # CONFIG_HZ_300 is not set @@ -336,7 +355,7 @@ CONFIG_HOTPLUG_CPU=y # CONFIG_LEGACY_VSYSCALL_XONLY is not set CONFIG_LEGACY_VSYSCALL_NONE=y # CONFIG_CMDLINE_BOOL is not set -# CONFIG_MODIFY_LDT_SYSCALL is not set +CONFIG_MODIFY_LDT_SYSCALL=y CONFIG_HAVE_LIVEPATCH=y # end of Processor type and features @@ -370,8 +389,7 @@ CONFIG_ARCH_SUPPORTS_ACPI=y # # Bus options (PCI etc.) # -# CONFIG_ISA_BUS is not set -# CONFIG_ISA_DMA_API is not set +CONFIG_ISA_DMA_API=y # CONFIG_X86_SYSFB is not set # end of Bus options (PCI etc.) @@ -386,10 +404,12 @@ CONFIG_ARCH_SUPPORTS_ACPI=y # Firmware Drivers # # CONFIG_EDD is not set -# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_FIRMWARE_MEMMAP=y +# CONFIG_DMIID is not set +# CONFIG_DMI_SYSFS is not set +CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y # CONFIG_FW_CFG_SYSFS is not set # CONFIG_GOOGLE_FIRMWARE is not set -CONFIG_EFI_EARLYCON=y # # Tegra firmware driver @@ -413,6 +433,7 @@ CONFIG_OPROFILE_NMI_TIMER=y # CONFIG_KPROBES is not set CONFIG_JUMP_LABEL=y # CONFIG_STATIC_KEYS_SELFTEST is not set +# CONFIG_STATIC_CALL_SELFTEST is not set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_HAVE_IOREMAP_PROT=y @@ -447,7 +468,9 @@ CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y CONFIG_HAVE_CMPXCHG_LOCAL=y CONFIG_HAVE_CMPXCHG_DOUBLE=y +CONFIG_HAVE_ARCH_SECCOMP=y CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +# CONFIG_SECCOMP is not set CONFIG_HAVE_ARCH_STACKLEAK=y CONFIG_HAVE_STACKPROTECTOR=y CONFIG_STACKPROTECTOR=y @@ -478,8 +501,10 @@ CONFIG_STRICT_KERNEL_RWX=y CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y CONFIG_STRICT_MODULE_RWX=y CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y -CONFIG_ARCH_USE_MEMREMAP_PROT=y CONFIG_ARCH_HAS_MEM_ENCRYPT=y +CONFIG_HAVE_STATIC_CALL=y +CONFIG_HAVE_STATIC_CALL_INLINE=y +CONFIG_ARCH_WANT_LD_ORPHAN_WARN=y # # GCOV-based kernel profiling @@ -490,6 +515,7 @@ CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y CONFIG_HAVE_GCC_PLUGINS=y # end of General architecture-dependent options +CONFIG_RT_MUTEXES=y CONFIG_BASE_SMALL=0 CONFIG_MODULES=y # CONFIG_MODULE_FORCE_LOAD is not set @@ -501,9 +527,35 @@ CONFIG_MODULE_UNLOAD=y # CONFIG_MODULE_COMPRESS is not set # CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set # CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_TRIM_UNUSED_KSYMS is not set +CONFIG_TRIM_UNUSED_KSYMS=y +CONFIG_UNUSED_KSYMS_WHITELIST="" CONFIG_MODULES_TREE_LOOKUP=y -# CONFIG_BLOCK is not set +CONFIG_BLOCK=y +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_BLK_DEV_BSGLIB is not set +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_ZONED is not set +# CONFIG_BLK_CMDLINE_PARSER is not set +# CONFIG_BLK_WBT is not set +# CONFIG_BLK_SED_OPAL is not set +# CONFIG_BLK_INLINE_ENCRYPTION is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y +CONFIG_EFI_PARTITION=y +# end of Partition Types + +# +# IO Schedulers +# +# CONFIG_MQ_IOSCHED_DEADLINE is not set +# CONFIG_MQ_IOSCHED_KYBER is not set +# CONFIG_IOSCHED_BFQ is not set +# end of IO Schedulers + CONFIG_INLINE_SPIN_UNLOCK_IRQ=y CONFIG_INLINE_READ_UNLOCK=y CONFIG_INLINE_READ_UNLOCK_IRQ=y @@ -526,9 +578,10 @@ CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y # CONFIG_BINFMT_ELF=y CONFIG_ELFCORE=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y CONFIG_BINFMT_SCRIPT=y # CONFIG_BINFMT_MISC is not set -# CONFIG_COREDUMP is not set +CONFIG_COREDUMP=y # end of Executable file formats # @@ -547,6 +600,7 @@ CONFIG_COMPACTION=y # CONFIG_PAGE_REPORTING is not set CONFIG_MIGRATION=y CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_BOUNCE=y CONFIG_VIRT_TO_BUS=y # CONFIG_KSM is not set CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 @@ -565,6 +619,7 @@ CONFIG_GENERIC_EARLY_IOREMAP=y CONFIG_ARCH_HAS_PTE_DEVMAP=y # CONFIG_PERCPU_STATS is not set # CONFIG_GUP_BENCHMARK is not set +# CONFIG_READ_ONLY_THP_FOR_FS is not set CONFIG_ARCH_HAS_PTE_SPECIAL=y # end of Memory Management options @@ -592,13 +647,13 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y # # Firmware loader # -# CONFIG_FW_LOADER is not set +CONFIG_FW_LOADER=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER is not set +# CONFIG_FW_LOADER_COMPRESS is not set # end of Firmware loader -# CONFIG_ALLOW_DEV_COREDUMP is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set +CONFIG_ALLOW_DEV_COREDUMP=y # CONFIG_TEST_ASYNC_DRIVER_PROBE is not set CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_CPU_VULNERABILITIES=y @@ -615,10 +670,12 @@ CONFIG_GENERIC_CPU_VULNERABILITIES=y # CONFIG_OF is not set CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y # CONFIG_PARPORT is not set +# CONFIG_BLK_DEV is not set # # NVME Support # +# CONFIG_NVME_FC is not set # end of NVME Support # @@ -644,25 +701,25 @@ CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y # # Altera FPGA firmware download module (requires I2C) # - -# -# Intel MIC & related support -# -# CONFIG_VOP_BUS is not set -# end of Intel MIC & related support - # CONFIG_ECHO is not set # end of Misc devices CONFIG_HAVE_IDE=y +# CONFIG_IDE is not set # # SCSI device support # CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +# CONFIG_SCSI is not set # end of SCSI device support +# CONFIG_ATA is not set +# CONFIG_MD is not set +# CONFIG_TARGET_CORE is not set # CONFIG_MACINTOSH_DRIVERS is not set +# CONFIG_NVM is not set # # Input device support @@ -706,11 +763,11 @@ CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y # CONFIG_TTY=y CONFIG_VT=y -# CONFIG_CONSOLE_TRANSLATIONS is not set +CONFIG_CONSOLE_TRANSLATIONS=y CONFIG_VT_CONSOLE=y CONFIG_HW_CONSOLE=y # CONFIG_VT_HW_CONSOLE_BINDING is not set -# CONFIG_UNIX98_PTYS is not set +CONFIG_UNIX98_PTYS=y # CONFIG_LEGACY_PTYS is not set # CONFIG_LDISC_AUTOLOAD is not set @@ -748,19 +805,24 @@ CONFIG_SERIAL_CORE_CONSOLE=y # CONFIG_NULL_TTY is not set # CONFIG_TRACE_SINK is not set # CONFIG_SERIAL_DEV_BUS is not set -# CONFIG_TTY_PRINTK is not set +# CONFIG_VIRTIO_CONSOLE is not set # CONFIG_IPMI_HANDLER is not set # CONFIG_HW_RANDOM is not set # CONFIG_MWAVE is not set # CONFIG_DEVMEM is not set # CONFIG_DEVKMEM is not set # CONFIG_NVRAM is not set +# CONFIG_RAW_DRIVER is not set # CONFIG_HANGCHECK_TIMER is not set # CONFIG_TCG_TPM is not set # CONFIG_TELCLOCK is not set CONFIG_RUST_EXAMPLE=y +CONFIG_RUST_EXAMPLE_2=y +CONFIG_RUST_EXAMPLE_3=m +CONFIG_RUST_EXAMPLE_4=m # end of Character devices +# CONFIG_RANDOM_TRUST_CPU is not set # CONFIG_RANDOM_TRUST_BOOTLOADER is not set # @@ -787,7 +849,6 @@ CONFIG_RUST_EXAMPLE=y # CONFIG_PINCTRL is not set # CONFIG_GPIOLIB is not set # CONFIG_W1 is not set -# CONFIG_POWER_AVS is not set # CONFIG_POWER_RESET is not set # CONFIG_POWER_SUPPLY is not set # CONFIG_HWMON is not set @@ -843,7 +904,7 @@ CONFIG_BCMA_POSSIBLE=y # # Console display driver support # -# CONFIG_VGA_CONSOLE is not set +CONFIG_VGA_CONSOLE=y CONFIG_DUMMY_CONSOLE=y CONFIG_DUMMY_CONSOLE_COLUMNS=80 CONFIG_DUMMY_CONSOLE_ROWS=25 @@ -894,7 +955,6 @@ CONFIG_RTC_MC146818_LIB=y # CONFIG_GREYBUS is not set # CONFIG_STAGING is not set # CONFIG_X86_PLATFORM_DEVICES is not set -# CONFIG_MFD_CROS_EC is not set # CONFIG_CHROME_PLATFORMS is not set # CONFIG_MELLANOX_PLATFORM is not set # CONFIG_COMMON_CLK is not set @@ -904,6 +964,7 @@ CONFIG_RTC_MC146818_LIB=y # Clock Source drivers # CONFIG_CLKEVT_I8253=y +CONFIG_I8253_LOCK=y CONFIG_CLKBLD_I8253=y # end of Clock Source drivers @@ -986,7 +1047,7 @@ CONFIG_CLKBLD_I8253=y # CONFIG_BCM_KONA_USB2_PHY is not set # CONFIG_PHY_PXA_28NM_HSIC is not set # CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_PHY_INTEL_EMMC is not set +# CONFIG_PHY_INTEL_LGM_EMMC is not set # end of PHY Subsystem # CONFIG_POWERCAP is not set @@ -1028,8 +1089,21 @@ CONFIG_CLKBLD_I8253=y # CONFIG_DCACHE_WORD_ACCESS=y # CONFIG_VALIDATE_FS_PARSER is not set +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +# CONFIG_EXT4_FS is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_GFS2_FS is not set +# CONFIG_BTRFS_FS is not set +# CONFIG_NILFS2_FS is not set +# CONFIG_F2FS_FS is not set +# CONFIG_FS_DAX is not set +CONFIG_EXPORTFS=y # CONFIG_EXPORTFS_BLOCK_OPS is not set -# CONFIG_FILE_LOCKING is not set +CONFIG_FILE_LOCKING=y +# CONFIG_MANDATORY_FILE_LOCKING is not set # CONFIG_FS_ENCRYPTION is not set # CONFIG_FS_VERITY is not set # CONFIG_DNOTIFY is not set @@ -1047,13 +1121,34 @@ CONFIG_DCACHE_WORD_ACCESS=y # CONFIG_FSCACHE is not set # end of Caches +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set +# end of CD-ROM/DVD Filesystems + +# +# DOS/FAT/EXFAT/NT Filesystems +# +# CONFIG_MSDOS_FS is not set +# CONFIG_VFAT_FS is not set +# CONFIG_EXFAT_FS is not set +# CONFIG_NTFS_FS is not set +# end of DOS/FAT/EXFAT/NT Filesystems + # # Pseudo filesystems # -# CONFIG_PROC_FS is not set +CONFIG_PROC_FS=y +# CONFIG_PROC_KCORE is not set +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y # CONFIG_PROC_CHILDREN is not set +CONFIG_PROC_PID_ARCH_STATUS=y CONFIG_KERNFS=y CONFIG_SYSFS=y +# CONFIG_TMPFS is not set # CONFIG_HUGETLBFS is not set CONFIG_ARCH_HAS_GIGANTIC_PAGE=y # CONFIG_CONFIGFS_FS is not set @@ -1062,6 +1157,7 @@ CONFIG_ARCH_HAS_GIGANTIC_PAGE=y # CONFIG_MISC_FILESYSTEMS is not set # CONFIG_NLS is not set # CONFIG_UNICODE is not set +CONFIG_IO_WQ=y # end of File systems # @@ -1069,12 +1165,12 @@ CONFIG_ARCH_HAS_GIGANTIC_PAGE=y # # CONFIG_KEYS is not set # CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set # CONFIG_SECURITYFS is not set CONFIG_PAGE_TABLE_ISOLATION=y CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y CONFIG_HARDENED_USERCOPY=y CONFIG_HARDENED_USERCOPY_FALLBACK=y -# CONFIG_HARDENED_USERCOPY_PAGESPAN is not set CONFIG_FORTIFY_SOURCE=y # CONFIG_STATIC_USERMODEHELPER is not set CONFIG_DEFAULT_SECURITY_DAC=y @@ -1104,6 +1200,7 @@ CONFIG_INIT_STACK_NONE=y # Library routines # # CONFIG_PACKING is not set +CONFIG_BITREVERSE=y CONFIG_GENERIC_STRNCPY_FROM_USER=y CONFIG_GENERIC_STRNLEN_USER=y CONFIG_GENERIC_FIND_FIRST_BIT=y @@ -1118,7 +1215,12 @@ CONFIG_ARCH_USE_SYM_ANNOTATIONS=y # CONFIG_CRC16 is not set # CONFIG_CRC_T10DIF is not set # CONFIG_CRC_ITU_T is not set -# CONFIG_CRC32 is not set +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set # CONFIG_CRC64 is not set # CONFIG_CRC4 is not set # CONFIG_CRC7 is not set @@ -1139,12 +1241,11 @@ CONFIG_SWIOTLB=y CONFIG_HAVE_GENERIC_VDSO=y CONFIG_GENERIC_GETTIMEOFDAY=y CONFIG_GENERIC_VDSO_TIME_NS=y -CONFIG_FONT_SUPPORT=y -CONFIG_FONT_8x16=y -CONFIG_FONT_AUTOSELECT=y CONFIG_ARCH_HAS_PMEM_API=y CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE=y +CONFIG_ARCH_HAS_COPY_MC=y CONFIG_ARCH_STACKWALK=y +CONFIG_SBITMAP=y # CONFIG_STRING_SELFTEST is not set # end of Library routines @@ -1160,7 +1261,8 @@ CONFIG_PRINTK_TIME=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 CONFIG_CONSOLE_LOGLEVEL_QUIET=4 CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_BOOT_PRINTK_DELAY is not set +# CONFIG_DYNAMIC_DEBUG is not set +# CONFIG_DYNAMIC_DEBUG_CORE is not set CONFIG_SYMBOLIC_ERRNAME=y CONFIG_DEBUG_BUGVERBOSE=y # end of printk and dmesg options @@ -1168,17 +1270,13 @@ CONFIG_DEBUG_BUGVERBOSE=y # # Compile-time checks and compiler options # -# CONFIG_DEBUG_INFO is not set CONFIG_ENABLE_MUST_CHECK=y CONFIG_FRAME_WARN=2048 -# CONFIG_STRIP_ASM_SYMS is not set -# CONFIG_READABLE_ASM is not set +CONFIG_STRIP_ASM_SYMS=y # CONFIG_HEADERS_INSTALL is not set # CONFIG_DEBUG_SECTION_MISMATCH is not set # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set -# CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_32B is not set CONFIG_STACK_VALIDATION=y -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set # end of Compile-time checks and compiler options # @@ -1187,38 +1285,30 @@ CONFIG_STACK_VALIDATION=y # CONFIG_MAGIC_SYSRQ is not set # CONFIG_DEBUG_FS is not set CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y # CONFIG_UBSAN is not set +CONFIG_HAVE_ARCH_KCSAN=y +CONFIG_HAVE_KCSAN_COMPILER=y # end of Generic Kernel Debugging Instruments -CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_MISC is not set +# CONFIG_DEBUG_KERNEL is not set # # Memory Debugging # # CONFIG_PAGE_EXTENSION is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_PAGE_OWNER is not set # CONFIG_PAGE_POISONING is not set # CONFIG_DEBUG_RODATA_TEST is not set CONFIG_ARCH_HAS_DEBUG_WX=y # CONFIG_DEBUG_WX is not set CONFIG_GENERIC_PTDUMP=y -# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set # CONFIG_SLUB_STATS is not set CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_SCHED_STACK_END_CHECK is not set CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y -# CONFIG_DEBUG_VM is not set # CONFIG_DEBUG_VM_PGTABLE is not set CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y -# CONFIG_DEBUG_VIRTUAL is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set +CONFIG_DEBUG_MEMORY_INIT=y CONFIG_HAVE_ARCH_KASAN=y CONFIG_HAVE_ARCH_KASAN_VMALLOC=y CONFIG_CC_HAS_KASAN_GENERIC=y @@ -1227,19 +1317,13 @@ CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y # CONFIG_KASAN is not set # end of Memory Debugging -# CONFIG_DEBUG_SHIRQ is not set - # # Debug Oops, Lockups and Hangs # -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_ON_OOPS=y +CONFIG_PANIC_ON_OOPS_VALUE=1 CONFIG_PANIC_TIMEOUT=-1 -# CONFIG_SOFTLOCKUP_DETECTOR is not set CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y -# CONFIG_HARDLOCKUP_DETECTOR is not set -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_WQ_WATCHDOG is not set # CONFIG_TEST_LOCKUP is not set # end of Debug Oops, Lockups and Hangs @@ -1254,48 +1338,24 @@ CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y # Lock Debugging (spinlocks, mutexes, etc...) # CONFIG_LOCK_DEBUGGING_SUPPORT=y -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_RWSEMS is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_LOCK_TORTURE_TEST is not set # CONFIG_WW_MUTEX_SELFTEST is not set # end of Lock Debugging (spinlocks, mutexes, etc...) # CONFIG_STACKTRACE is not set # CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set -# CONFIG_DEBUG_KOBJECT is not set # # Debug kernel data structures # -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_PLIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_BUG_ON_DATA_CORRUPTION is not set # end of Debug kernel data structures -# CONFIG_DEBUG_CREDENTIALS is not set - # # RCU Debugging # -# CONFIG_RCU_PERF_TEST is not set -# CONFIG_RCU_TORTURE_TEST is not set -# CONFIG_RCU_REF_SCALE_TEST is not set CONFIG_RCU_CPU_STALL_TIMEOUT=21 -# CONFIG_RCU_TRACE is not set -# CONFIG_RCU_EQS_DEBUG is not set # end of RCU Debugging -# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set -# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set CONFIG_USER_STACKTRACE_SUPPORT=y CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y @@ -1309,7 +1369,6 @@ CONFIG_HAVE_C_RECORDMCOUNT=y CONFIG_TRACING_SUPPORT=y # CONFIG_FTRACE is not set # CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KCSAN=y CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y # CONFIG_STRICT_DEVMEM is not set @@ -1319,33 +1378,39 @@ CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y CONFIG_TRACE_IRQFLAGS_SUPPORT=y CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y # CONFIG_X86_VERBOSE_BOOTUP is not set -# CONFIG_EARLY_PRINTK is not set -# CONFIG_DEBUG_TLBFLUSH is not set +CONFIG_EARLY_PRINTK=y CONFIG_HAVE_MMIOTRACE_SUPPORT=y -# CONFIG_X86_DECODER_SELFTEST is not set # CONFIG_IO_DELAY_0X80 is not set # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_UDELAY is not set CONFIG_IO_DELAY_NONE=y -# CONFIG_CPA_DEBUG is not set -# CONFIG_DEBUG_ENTRY is not set -# CONFIG_DEBUG_NMI_SELFTEST is not set -# CONFIG_X86_DEBUG_FPU is not set CONFIG_UNWINDER_ORC=y # CONFIG_UNWINDER_FRAME_POINTER is not set -# CONFIG_UNWINDER_GUESS is not set # end of x86 Debugging # # Kernel Testing and Coverage # # CONFIG_KUNIT is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set CONFIG_ARCH_HAS_KCOV=y CONFIG_CC_HAS_SANCOV_TRACE_PC=y # CONFIG_KCOV is not set # CONFIG_RUNTIME_TESTING_MENU is not set # CONFIG_MEMTEST is not set # end of Kernel Testing and Coverage + +# +# Rust hacking +# +# CONFIG_RUST_DEBUG_ASSERTIONS is not set +# CONFIG_RUST_OVERFLOW_CHECKS is not set +CONFIG_RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C=y +# CONFIG_RUST_OPT_LEVEL_0 is not set +# CONFIG_RUST_OPT_LEVEL_1 is not set +# CONFIG_RUST_OPT_LEVEL_2 is not set +# CONFIG_RUST_OPT_LEVEL_3 is not set +# CONFIG_RUST_OPT_LEVEL_S is not set +# CONFIG_RUST_OPT_LEVEL_Z is not set +CONFIG_RUST_CODEGEN_UNITS=1 +# end of Rust hacking # end of Kernel hacking diff --git a/.github/workflows/qemu-init.sh b/.github/workflows/qemu-init.sh index 804cd582e22e42..5d623426b2a165 100755 --- a/.github/workflows/qemu-init.sh +++ b/.github/workflows/qemu-init.sh @@ -1,8 +1,8 @@ #!/bin/sh -if [ -f rust_example.ko ]; then - busybox insmod rust_example.ko my_i32=123321 - busybox rmmod rust_example.ko -fi +busybox insmod rust_example_3.ko my_i32=345543 +busybox insmod rust_example_4.ko my_i32=456654 +busybox rmmod rust_example_3.ko +busybox rmmod rust_example_4.ko busybox reboot -f diff --git a/.github/workflows/qemu-initramfs.desc b/.github/workflows/qemu-initramfs.desc index 842bf37880b203..e15d926a1cd889 100644 --- a/.github/workflows/qemu-initramfs.desc +++ b/.github/workflows/qemu-initramfs.desc @@ -1,7 +1,8 @@ -dir /bin 0755 0 0 -dir /sys 0755 0 0 -dir /dev 0755 0 0 -file /bin/busybox /bin/busybox 0755 0 0 -slink /bin/sh /bin/busybox 0755 0 0 -file /init .github/workflows/qemu-init.sh 0755 0 0 -file /rust_example.ko drivers/char/rust_example/rust_example.ko 0755 0 0 +dir /bin 0755 0 0 +dir /sys 0755 0 0 +dir /dev 0755 0 0 +file /bin/busybox /bin/busybox 0755 0 0 +slink /bin/sh /bin/busybox 0755 0 0 +file /init .github/workflows/qemu-init.sh 0755 0 0 +file /rust_example_3.ko drivers/char/rust_example_3.ko 0755 0 0 +file /rust_example_4.ko drivers/char/rust_example_4.ko 0755 0 0 diff --git a/.gitignore b/.gitignore index c4e97ecdf7c700..41f449fec21577 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ *.o *.o.* *.patch +*.rlib *.s *.so *.so.dbg @@ -158,6 +159,3 @@ x509.genkey # Documentation toolchain sphinx_*/ - -# Rust (cargo) compilation artifacts -/target/ diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 1238e5fbdc531f..00000000000000 --- a/Cargo.lock +++ /dev/null @@ -1,26 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "kernel" -version = "0.1.0" -dependencies = [ - "bitflags", - "module", -] - -[[package]] -name = "module" -version = "0.1.0" - -[[package]] -name = "rust_example" -version = "0.1.0" -dependencies = [ - "kernel", -] diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index e9a9b0f15d6293..00000000000000 --- a/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 - -# TODO: generate automatically -[workspace] -members = [ - "rust/module", - "rust/kernel", - "drivers/char/rust_example", -] - diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst index 5444cb0a7cbd2e..408d286118accc 100644 --- a/Documentation/rust/quick-start.rst +++ b/Documentation/rust/quick-start.rst @@ -3,97 +3,131 @@ Quick Start =========== -This document describes how to get started with Rust kernel development. +This document describes how to get started with kernel development in Rust. Requirements ------------ -rustc and cargo -*************** +This section explains how to fetch the requirements to work with Rust. +If you have worked previously with Rust, this will only take a moment. -A recent nightly Rust toolchain (with, at least, ``rustc`` and ``cargo``) -is required, e.g. ``nightly-2020-08-27``. In the future, this restriction -will be lifted. +Some of these requirements might be available from your Linux distribution +under names like ``rustc``, ``rust-src``, ``rust-bindgen``, etc. However, +at the time of writing, they are likely to not be recent enough. + + +rustc +***** + +A recent *nightly* Rust toolchain (with, at least, ``rustc``) is required, +e.g. ``nightly-2020-08-27``. Our goal is to use a stable toolchain as soon +as possible, but for the moment we depend on a handful of nightly features. If you are using ``rustup``, run:: rustup toolchain install nightly -Otherwise, fetch a standalone installer from: +Otherwise, fetch a standalone installer or install ``rustup`` from: https://www.rust-lang.org -rustc sources -************* +Rust standard library source +**************************** -The sources for the compiler are required to be available because the standard -library (``core`` and ``alloc``) is cross-compiled. +The Rust standard library source (``core`` and ``alloc``, at least) is required +because the build system will cross-compile it. If you are using ``rustup``, run:: rustup component add rust-src -Otherwise, if you used a standalone installer, you can clone the Rust compiler -sources and create a symlink to them in the installation folder of -your nightly toolchain:: +Otherwise, if you used a standalone installer, you can clone the Rust +repository into the installation folder of your nightly toolchain:: + + git clone https://github.com/rust-lang/rust `rustc --print sysroot`/lib/rustlib/src/rust + + +compiler-builtins source +************************ - git clone https://github.com/rust-lang/rust - ln -s rust .../rust-nightly/lib/rustlib/src +The source for ``compiler-builtins`` (a Rust port of LLVM's ``compiler-rt``) +is required. + +The build system expects the sources alongside the Rust ones we just installed, +so you can clone it into the installation folder of your nightly toolchain:: + + git clone https://github.com/rust-lang/compiler-builtins `rustc --print sysroot`/lib/rustlib/src/compiler-builtins bindgen ******* The bindings to the C side of the kernel are generated at build time using -``bindgen``. Currently we assume the latest version available, but that -may change in the future. +the ``bindgen`` tool. A recent version should work, e.g. ``0.57.0``. Install it via:: - cargo install bindgen + cargo install --locked --version 0.57.0 bindgen rustfmt ******* -Optionally, if you install ``rustfmt``, then you will get the generated -C bindings automatically formatted. It is also useful to have the tool -to format your own code, too. +Optionally, if you install the ``rustfmt`` tool, then the generated C bindings +will be automatically formatted. It is also useful to have the tool to format +your own code, too. -If you are using ``rustup``, its ``default`` profile already installs it, -so you should be good to go. If you are using another one, you can also -install the component:: +If you are using ``rustup``, its ``default`` profile already installs the tool, +so you should be good to go. If you are using another profile, you can install +the component manually:: rustup component add rustfmt The standalone installers also come with ``rustfmt``. -Testing a simple driver ------------------------ +Configuration +------------- + +``Rust support`` (``CONFIG_RUST``) needs to be enabled in the ``General setup`` +menu. The option is only shown if the build system can locate ``rustc``. +In turn, this will make visible the rest of options that depend on Rust. + +Afterwards, go to ``Character devices`` under ``Device Drivers`` and enable +the example Rust driver ``Rust example`` (``CONFIG_RUST_EXAMPLE``). + + +Building +-------- -If the kernel configuration system is able to find ``rustc`` and ``cargo``, -it will enable Rust support (``CONFIG_HAS_RUST``). In turn, this will make -visible the rest of options that depend on Rust. +Building the kernel with either GCC, Clang or a full ``LLVM=1`` should all +work. However, please note that using GCC is more experimental at the moment. -A simple driver you can compile to test things out is at -``drivers/char/rust_example`` (``CONFIG_RUST_EXAMPLE``). Enable it and compile -the kernel with: - make LLVM=1 +Hacking +------- -TODO: drop LLVM=1, allowing to mix GCC with LLVM +If you want to dive deeper, take a look at the source code of the example +driver at ``drivers/char/rust_example.rs``, the Rust support code under +``rust/`` and the ``Rust hacking`` menu under ``Kernel hacking``. +If you use GDB/Binutils and Rust symbols aren't getting demangled, the reason +is your toolchain doesn't support Rust's new v0 mangling scheme yet. There are +a few ways out: -Avoiding the network --------------------- + - If you don't mind building your own tools, we provide the following fork + with the support cherry-picked from GCC on top of very recent releases: -You can prefetch the dependencies that ``cargo`` will download by running:: + https://github.com/ojeda/binutils-gdb/releases/tag/gdb-10.1-release-rust + https://github.com/ojeda/binutils-gdb/releases/tag/binutils-2_35_1-rust - cargo fetch + - If you only need GDB and can enable ``CONFIG_DEBUG_INFO``, do so: + some versions of GDB (e.g. vanilla GDB 10.1) are able to use + the pre-demangled names embedded in the debug info. -in the kernel sources root. After this step, a network connection is -not needed anymore. + - If you don't need loadable module support, you may compile without + the ``-Z symbol-mangling-version=v0`` flag. However, we don't maintain + support for that, so avoid it unless you are in a hurry. diff --git a/Makefile b/Makefile index c76b3abfed0bf1..21729cac514957 100644 --- a/Makefile +++ b/Makefile @@ -86,11 +86,9 @@ endif ifeq ($(KBUILD_VERBOSE),1) quiet = Q = - CARGO_VERBOSE = --verbose else quiet=quiet_ Q = @ - CARGO_VERBOSE = # TODO: could be --quiet if needed endif # If the user is running make -s (silent mode), suppress echoing of @@ -447,7 +445,6 @@ READELF = $(CROSS_COMPILE)readelf STRIP = $(CROSS_COMPILE)strip endif RUSTC = rustc -CARGO = cargo BINDGEN = bindgen PAHOLE = pahole RESOLVE_BTFIDS = $(objtree)/tools/bpf/resolve_btfids/resolve_btfids @@ -474,12 +471,10 @@ CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ NOSTDINC_FLAGS := CFLAGS_MODULE = RUSTCFLAGS_MODULE = -CARGOFLAGS_MODULE = AFLAGS_MODULE = LDFLAGS_MODULE = CFLAGS_KERNEL = RUSTCFLAGS_KERNEL = -CARGOFLAGS_KERNEL = AFLAGS_KERNEL = LDFLAGS_vmlinux = @@ -507,24 +502,20 @@ KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \ -Werror=return-type -Wno-format-security \ -std=gnu89 KBUILD_CPPFLAGS := -D__KERNEL__ -KBUILD_RUSTCFLAGS := -# TODO: a simple way to update `Cargo.lock` when we add a new driver -KBUILD_CARGOFLAGS := $(CARGO_VERBOSE) --locked \ - -Z build-std=core,alloc -Z unstable-options \ - --target=$(srctree)/arch/$(SRCARCH)/rust/target.json +KBUILD_RUSTCFLAGS := --emit=dep-info,obj,link -Z binary_dep_depinfo=y \ + -C panic=abort -C embed-bitcode=n -C lto=n -C rpath=n \ + -C force-unwind-tables=n -Z symbol-mangling-version=v0 KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := KBUILD_RUSTCFLAGS_KERNEL := -KBUILD_CARGOFLAGS_KERNEL := KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_RUSTCFLAGS_MODULE := --cfg MODULE -KBUILD_CARGOFLAGS_MODULE := KBUILD_LDFLAGS_MODULE := KBUILD_LDFLAGS := CLANG_FLAGS := -export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC RUSTC CARGO BINDGEN +export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC RUSTC BINDGEN export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD @@ -533,10 +524,9 @@ export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export KBUILD_RUSTCFLAGS RUSTCFLAGS_KERNEL RUSTCFLAGS_MODULE -export KBUILD_CARGOFLAGS CARGOFLAGS_KERNEL CARGOFLAGS_MODULE export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE -export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_RUSTCFLAGS_MODULE KBUILD_CARGOFLAGS_MODULE KBUILD_LDFLAGS_MODULE -export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL KBUILD_RUSTCFLAGS_KERNEL KBUILD_CARGOFLAGS_KERNEL +export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_RUSTCFLAGS_MODULE KBUILD_LDFLAGS_MODULE +export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL KBUILD_RUSTCFLAGS_KERNEL # Files to ignore in find ... statements @@ -752,23 +742,47 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) -# TODO: perhaps we could have some independent options for Rust only -KBUILD_CARGOFLAGS += --release +ifdef CONFIG_RUST_DEBUG_ASSERTIONS +KBUILD_RUSTCFLAGS += -C debug-assertions=y +else +KBUILD_RUSTCFLAGS += -C debug-assertions=n +endif + +ifdef CONFIG_RUST_OVERFLOW_CHECKS +KBUILD_RUSTCFLAGS += -C overflow-checks=y +else +KBUILD_RUSTCFLAGS += -C overflow-checks=n +endif ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE KBUILD_CFLAGS += -O2 -KBUILD_RUSTCFLAGS += # TODO: do we want -C opt-level=2 here? -KBUILD_CARGOFLAGS += +KBUILD_RUSTCFLAGS_OPT_LEVEL_MAP := 2 else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 KBUILD_CFLAGS += -O3 -KBUILD_RUSTCFLAGS += # flags already passed by cargo's --release -KBUILD_CARGOFLAGS += +KBUILD_RUSTCFLAGS_OPT_LEVEL_MAP := 3 else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os +KBUILD_RUSTCFLAGS_OPT_LEVEL_MAP := z +endif + +ifdef CONFIG_RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C +KBUILD_RUSTCFLAGS += -C opt-level=$(KBUILD_RUSTCFLAGS_OPT_LEVEL_MAP) +else ifdef CONFIG_RUST_OPT_LEVEL_0 +KBUILD_RUSTCFLAGS += -C opt-level=0 +else ifdef CONFIG_RUST_OPT_LEVEL_1 +KBUILD_RUSTCFLAGS += -C opt-level=1 +else ifdef CONFIG_RUST_OPT_LEVEL_2 +KBUILD_RUSTCFLAGS += -C opt-level=2 +else ifdef CONFIG_RUST_OPT_LEVEL_3 +KBUILD_RUSTCFLAGS += -C opt-level=3 +else ifdef CONFIG_RUST_OPT_LEVEL_S +KBUILD_RUSTCFLAGS += -C opt-level=s +else ifdef CONFIG_RUST_OPT_LEVEL_Z KBUILD_RUSTCFLAGS += -C opt-level=z -KBUILD_CARGOFLAGS += endif +KBUILD_RUSTCFLAGS += -C codegen-units=$(CONFIG_RUST_CODEGEN_UNITS) + # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) @@ -816,6 +830,7 @@ endif KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls +KBUILD_RUSTCFLAGS += -C force-frame-pointers=y else # Some targets (ARM with Thumb2, for example), can't be built with frame # pointers. For those, we don't have FUNCTION_TRACER automatically @@ -848,9 +863,6 @@ DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-track endif DEBUG_RUSTCFLAGS := -DEBUG_CARGOFLAGS := - -# TODO: see what we should set for rustc/cargo for debug ifdef CONFIG_DEBUG_INFO @@ -862,6 +874,11 @@ endif ifneq ($(LLVM_IAS),1) KBUILD_AFLAGS += -Wa,-gdwarf-2 +ifdef CONFIG_DEBUG_INFO_REDUCED +DEBUG_RUSTCFLAGS += -C debuginfo=1 +else +DEBUG_RUSTCFLAGS += -C debuginfo=2 +endif endif ifdef CONFIG_DEBUG_INFO_DWARF4 @@ -887,9 +904,6 @@ export DEBUG_CFLAGS KBUILD_RUSTCFLAGS += $(DEBUG_RUSTCFLAGS) export DEBUG_RUSTCFLAGS -KBUILD_CARGOFLAGS += $(DEBUG_CARGOFLAGS) -export DEBUG_CARGOFLAGS - ifdef CONFIG_FUNCTION_TRACER ifdef CONFIG_FTRACE_MCOUNT_RECORD # gcc 5 supports generating the mcount tables directly @@ -1008,12 +1022,11 @@ include $(addprefix $(srctree)/, $(include-y)) # Do not add $(call cc-option,...) below this line. When you build the kernel # from the clean source tree, the GCC plugins do not exist at this point. -# Add user supplied CPPFLAGS, AFLAGS, CFLAGS, RUSTCFLAGS and CARGOFLAGS as the last assignments +# Add user supplied CPPFLAGS, AFLAGS, CFLAGS and RUSTCFLAGS as the last assignments KBUILD_CPPFLAGS += $(KCPPFLAGS) KBUILD_AFLAGS += $(KAFLAGS) KBUILD_CFLAGS += $(KCFLAGS) KBUILD_RUSTCFLAGS += $(KRUSTCFLAGS) -KBUILD_CARGOFLAGS += $(KCARGOFLAGS) KBUILD_LDFLAGS_MODULE += --build-id=sha1 LDFLAGS_vmlinux += --build-id=sha1 @@ -1144,11 +1157,7 @@ export MODORDER := $(extmod-prefix)modules.order export MODULES_NSDEPS := $(extmod-prefix)modules.nsdeps ifeq ($(KBUILD_EXTMOD),) -core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ - -ifdef CONFIG_HAS_RUST -core-y += rust/ -endif +core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ rust/ vmlinux-dirs := $(patsubst %/,%,$(filter %/, \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ @@ -1250,6 +1259,7 @@ archprepare: outputmakefile archheaders archscripts scripts include/config/kerne prepare0: archprepare $(Q)$(MAKE) $(build)=scripts/mod $(Q)$(MAKE) $(build)=. + $(Q)$(MAKE) $(build)=rust # All the preparing.. prepare: prepare0 prepare-objtool prepare-resolve_btfids @@ -1535,17 +1545,13 @@ DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS # clean: rm-files := $(CLEAN_FILES) -PHONY += archclean vmlinuxclean cargoclean +PHONY += archclean vmlinuxclean vmlinuxclean: $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) -# TODO: clean particular subfolders via `Makefile.clean` -cargoclean: - $(Q)$(CARGO) clean - -clean: archclean vmlinuxclean cargoclean +clean: archclean vmlinuxclean # mrproper - Delete all generated files, including .config # @@ -1865,6 +1871,7 @@ clean: $(clean-dirs) $(call cmd,rmfiles) @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ \( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \ + -o -name '*.rlib' \ -o -name '*.ko.*' \ -o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \ -o -name '*.dwo' -o -name '*.lst' \ diff --git a/arch/x86/rust/target.json b/arch/x86/rust/target.json index 92ffaebf59c9a5..ee6ca664f5e08b 100644 --- a/arch/x86/rust/target.json +++ b/arch/x86/rust/target.json @@ -5,6 +5,7 @@ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "disable-redzone": true, "eliminate-frame-pointer": false, + "emit-debug-gdb-scripts": false, "env": "gnu", "features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float", "function-sections": false, diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index a975b045078272..ab6c55821f4e6a 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -472,7 +472,7 @@ config ADI driver include crash and makedumpfile. config RUST_EXAMPLE - depends on HAS_RUST + depends on RUST tristate "Rust Example" default n help @@ -483,6 +483,48 @@ config RUST_EXAMPLE If unsure, say N. +# XXX: Only for GitHub -- do not commit into mainline +config RUST_EXAMPLE_2 + depends on RUST + tristate "Rust Example 2" + default n + help + This option builds a second example module written in Rust. + It is intended to test several Rust modules at the same time. + + To compile this as a module, choose M here: + the module will be called rust_example_2. + + If unsure, say N. + +# XXX: Only for GitHub -- do not commit into mainline +config RUST_EXAMPLE_3 + depends on RUST + tristate "Rust Example 3" + default n + help + This option builds a third example module written in Rust. + It is intended to test several Rust modules at the same time. + + To compile this as a module, choose M here: + the module will be called rust_example_3. + + If unsure, say N. + +# XXX: Only for GitHub -- do not commit into mainline +config RUST_EXAMPLE_4 + depends on RUST + tristate "Rust Example 4" + default n + help + This option builds a fourth example module written in Rust. + It is intended to test several Rust modules at the same time. + + To compile this as a module, choose M here: + the module will be called rust_example_4. + + If unsure, say N. + endmenu config RANDOM_TRUST_CPU diff --git a/drivers/char/Makefile b/drivers/char/Makefile index b254119cb97df0..b51ec3a8345f54 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -48,4 +48,7 @@ obj-$(CONFIG_XILLYBUS) += xillybus/ obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o obj-$(CONFIG_ADI) += adi.o -obj-$(CONFIG_RUST_EXAMPLE) += rust_example/ +obj-$(CONFIG_RUST_EXAMPLE) += rust_example.o +obj-$(CONFIG_RUST_EXAMPLE_2) += rust_example_2.o +obj-$(CONFIG_RUST_EXAMPLE_3) += rust_example_3.o +obj-$(CONFIG_RUST_EXAMPLE_4) += rust_example_4.o diff --git a/drivers/char/rust_example/src/lib.rs b/drivers/char/rust_example.rs similarity index 98% rename from drivers/char/rust_example/src/lib.rs rename to drivers/char/rust_example.rs index 2c15dd163ac5ac..0dbc5e7ef7beeb 100644 --- a/drivers/char/rust_example/src/lib.rs +++ b/drivers/char/rust_example.rs @@ -3,8 +3,6 @@ #![no_std] #![feature(global_asm)] -extern crate alloc; - use alloc::boxed::Box; use core::pin::Pin; use kernel::prelude::*; diff --git a/drivers/char/rust_example/Cargo.toml b/drivers/char/rust_example/Cargo.toml deleted file mode 100644 index 27232fd0634758..00000000000000 --- a/drivers/char/rust_example/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 - -# No need for details like `authors` here -- that goes in the modinfo -# via the `module!` macro -[package] -name = "rust_example" -version = "0.1.0" -edition = "2018" -publish = false - -[lib] -crate-type = ["staticlib"] - -[dependencies] -kernel = { path = "../../../rust/kernel" } - diff --git a/drivers/char/rust_example/Makefile b/drivers/char/rust_example/Makefile deleted file mode 100644 index f8847c8cad82c9..00000000000000 --- a/drivers/char/rust_example/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 - -obj-$(CONFIG_RUST_EXAMPLE) += rust_example.o diff --git a/drivers/char/rust_example_2.rs b/drivers/char/rust_example_2.rs new file mode 100644 index 00000000000000..d71272a1a1f201 --- /dev/null +++ b/drivers/char/rust_example_2.rs @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0 + +#![no_std] +#![feature(global_asm)] + +use kernel::prelude::*; + +module! { + type: RustExample2, + name: b"rust_example_2", + author: b"Rust for Linux Contributors", + description: b"An example kernel module written in Rust", + license: b"GPL v2", + params: { + my_bool: bool { + default: true, + permissions: 0, + description: b"Example of bool", + }, + my_i32: i32 { + default: 42, + permissions: 0o644, + description: b"Example of i32", + }, + }, +} + +struct RustExample2 { + message: String, +} + +impl KernelModule for RustExample2 { + fn init() -> KernelResult { + println!("[2] Rust Example (init)"); + println!("[2] Am I built-in? {}", !cfg!(MODULE)); + println!("[2] Parameters:"); + println!("[2] my_bool: {}", my_bool.read()); + println!("[2] my_i32: {}", my_i32.read()); + Ok(RustExample2 { + message: "on the heap!".to_owned(), + }) + } +} + +impl Drop for RustExample2 { + fn drop(&mut self) { + println!("[2] My message is {}", self.message); + println!("[2] Rust Example (exit)"); + } +} + +// XXX: Only for GitHub -- do not commit into mainline diff --git a/drivers/char/rust_example_3.rs b/drivers/char/rust_example_3.rs new file mode 100644 index 00000000000000..18bc1d541ee8ff --- /dev/null +++ b/drivers/char/rust_example_3.rs @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0 + +#![no_std] +#![feature(global_asm)] + +use kernel::prelude::*; + +module! { + type: RustExample3, + name: b"rust_example_3", + author: b"Rust for Linux Contributors", + description: b"An example kernel module written in Rust", + license: b"GPL v2", + params: { + my_bool: bool { + default: true, + permissions: 0, + description: b"Example of bool", + }, + my_i32: i32 { + default: 42, + permissions: 0o644, + description: b"Example of i32", + }, + }, +} + +struct RustExample3 { + message: String, +} + +impl KernelModule for RustExample3 { + fn init() -> KernelResult { + println!("[3] Rust Example (init)"); + println!("[3] Am I built-in? {}", !cfg!(MODULE)); + println!("[3] Parameters:"); + println!("[3] my_bool: {}", my_bool.read()); + println!("[3] my_i32: {}", my_i32.read()); + Ok(RustExample3 { + message: "on the heap!".to_owned(), + }) + } +} + +impl Drop for RustExample3 { + fn drop(&mut self) { + println!("[3] My message is {}", self.message); + println!("[3] Rust Example (exit)"); + } +} + +// XXX: Only for GitHub -- do not commit into mainline diff --git a/drivers/char/rust_example_4.rs b/drivers/char/rust_example_4.rs new file mode 100644 index 00000000000000..0c40d4b1e58ae7 --- /dev/null +++ b/drivers/char/rust_example_4.rs @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0 + +#![no_std] +#![feature(global_asm)] + +use kernel::prelude::*; + +module! { + type: RustExample4, + name: b"rust_example_4", + author: b"Rust for Linux Contributors", + description: b"An example kernel module written in Rust", + license: b"GPL v2", + params: { + my_bool: bool { + default: true, + permissions: 0, + description: b"Example of bool", + }, + my_i32: i32 { + default: 42, + permissions: 0o644, + description: b"Example of i32", + }, + }, +} + +struct RustExample4 { + message: String, +} + +impl KernelModule for RustExample4 { + fn init() -> KernelResult { + println!("[4] Rust Example (init)"); + println!("[4] Am I built-in? {}", !cfg!(MODULE)); + println!("[4] Parameters:"); + println!("[4] my_bool: {}", my_bool.read()); + println!("[4] my_i32: {}", my_i32.read()); + Ok(RustExample4 { + message: "on the heap!".to_owned(), + }) + } +} + +impl Drop for RustExample4 { + fn drop(&mut self) { + println!("[4] My message is {}", self.message); + println!("[4] Rust Example (exit)"); + } +} + +// XXX: Only for GitHub -- do not commit into mainline diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index d26c41520ad5bf..95abf7b408ae86 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -14,7 +14,7 @@ #include -#define KSYM_NAME_LEN 256 +#define KSYM_NAME_LEN 512 #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 6388eb9734a514..f19edac3398439 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -18,7 +18,7 @@ #endif /* Chosen so that structs with an unsigned long line up. */ -#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) +#define MAX_PARAM_PREFIX_LEN (256 - sizeof(unsigned long)) #define __MODULE_INFO(tag, name, info) \ static const char __UNIQUE_ID(name)[] \ diff --git a/init/Kconfig b/init/Kconfig index c7bfc039415ba6..c778f9c1a0a730 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -52,18 +52,13 @@ config LLD_VERSION default $(shell,$(srctree)/scripts/lld-version.sh $(LD)) config HAS_RUST - def_bool $(success,$(RUSTC) --version && $(CARGO) --version) + def_bool $(success,$(RUSTC) --version) config RUSTC_VERSION depends on HAS_RUST int default $(shell,$(srctree)/scripts/rust-version.sh $(RUSTC)) -config CARGO_VERSION - depends on HAS_RUST - int - default $(shell,$(srctree)/scripts/rust-version.sh $(CARGO)) - config CC_CAN_LINK bool default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(m64-flag)) if 64BIT @@ -2039,6 +2034,24 @@ config PROFILING Say Y here to enable the extended profiling support mechanisms used by profilers such as OProfile. +config RUST + bool "Rust support" + depends on X86_64 + depends on HAS_RUST + default n + help + Enables Rust support in the kernel. + + This allows other Rust-related options, like drivers written in Rust, + to be selected. + + It is also required to be able to load external kernel modules + written in Rust. + + See Documentation/rust/ for more information. + + If unsure, say N. + # # Place an empty function call at each tracepoint site. Can be # dynamically changed for a probe function. diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index fe9de067771c34..0e85d22e677a7a 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -73,6 +73,13 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, */ off += len + 1; + /* If zero, it is a "big" symbol, so a two byte length follows. */ + if (len == 0) { + len = (data[0] << 8) | data[1]; + data += 2; + off += len + 2; + } + /* * For every byte on the compressed symbol data, copy the table * entry for that byte. diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index c51f2ca5094e41..14caee3e7e238a 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c @@ -211,10 +211,10 @@ static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab, * and KSYM_NAME_LEN have the values we expect them to have. * * Because the value of MODULE_NAME_LEN can differ among architectures, - * we use the smallest/strictest upper bound possible (56, based on + * we use the smallest/strictest upper bound possible (248, based on * the current definition of MODULE_NAME_LEN) to prevent overflows. */ - BUILD_BUG_ON(MODULE_NAME_LEN < 56 || KSYM_NAME_LEN != 256); + BUILD_BUG_ON(MODULE_NAME_LEN < 248 || KSYM_NAME_LEN != 512); relas = (Elf_Rela *) relasec->sh_addr; /* For each rela in this klp relocation section */ @@ -228,7 +228,7 @@ static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab, /* Format: .klp.sym.sym_objname.sym_name,sympos */ cnt = sscanf(strtab + sym->st_name, - ".klp.sym.%55[^.].%255[^,],%lu", + ".klp.sym.%247[^.].%511[^,],%lu", sym_objname, sym_name, &sympos); if (cnt != 3) { pr_err("symbol %s has an incorrectly formatted name\n", diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index c789b39ed52717..e6603d4a79f0f0 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2446,6 +2446,119 @@ config HYPERV_TESTING endmenu # "Kernel Testing and Coverage" +menu "Rust hacking" + +config RUST_DEBUG_ASSERTIONS + bool "Debug assertions" + default n + depends on RUST + help + Enables rustc's `-C debug-assertions` codegen option. + + This flag lets you turn `cfg(debug_assertions)` conditional + compilation on or off. This can be used to enable extra debugging + code in development but not in production. For example, it controls + the behavior of the standard library's `debug_assert!` macro. + + If unsure, say N. + +config RUST_OVERFLOW_CHECKS + bool "Overflow checks" + default n + depends on RUST + help + Enables rustc's `-C overflow-checks` codegen option. + + This flag allows you to control the behavior of runtime integer + overflow. When overflow-checks are enabled, a panic will occur + on overflow. + + If unsure, say N. + +choice + prompt "Optimization level" + default RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C + depends on RUST + help + Controls rustc's `-C opt-level` codegen option. + + This flag controls the optimization level. + + If unsure, say "Similar as chosen for C". + +config RUST_OPT_LEVEL_SIMILAR_AS_CHOSEN_FOR_C + bool "Similar as chosen for C" + help + This choice will pick a similar optimization level as chosen in + the "Compiler optimization level" for C: + + -O2 is currently mapped to -C opt-level=2 + -O3 is currently mapped to -C opt-level=3 + -Os is currently mapped to -C opt-level=z + + The mapping may change over time to follow the intended semantics + of the choice for C as sensibly as possible. + + This is the default. + +config RUST_OPT_LEVEL_0 + bool "No optimizations (-C opt-level=0)" + help + Not recommended for most purposes. It may come in handy for debugging + suspected optimizer bugs, unexpected undefined behavior, etc. + + Note that this level will *not* enable debug assertions nor overflow + checks on its own (like it happens when interacting with rustc + directly). Use the corresponding configuration options to control + that instead, orthogonally. + +config RUST_OPT_LEVEL_1 + bool "Basic optimizations (-C opt-level=1)" + help + Useful for debugging without getting too lost, but without + the overhead and boilerplate of no optimizations at all. + +config RUST_OPT_LEVEL_2 + bool "Some optimizations (-C opt-level=2)" + help + The sensible choice in most cases. + +config RUST_OPT_LEVEL_3 + bool "All optimizations (-C opt-level=3)" + help + Yet more performance (hopefully). + +config RUST_OPT_LEVEL_S + bool "Optimize for size (-C opt-level=s)" + help + Smaller kernel, ideally without too much performance loss. + +config RUST_OPT_LEVEL_Z + bool "Optimize for size, no loop vectorization (-C opt-level=z)" + help + Like the previous level, but also turn off loop vectorization. + +endchoice + +config RUST_CODEGEN_UNITS + int "Codegen units (1-256)" + range 1 256 + default "1" + depends on RUST + help + Controls rustc's `-C codegen-units` codegen option. + + This flag controls how many code generation units the crate is + split into. When a crate is split into multiple codegen units, + LLVM is able to process them in parallel. Increasing parallelism + may speed up compile times, but may also produce slower code. + Setting this to 1 may improve the performance of generated code, + but may be slower to compile. + + If unsure, say 1. + +endmenu # "Rust" + source "Documentation/Kconfig" endmenu # Kernel hacking diff --git a/rust/.gitignore b/rust/.gitignore new file mode 100644 index 00000000000000..554ba815dfc75a --- /dev/null +++ b/rust/.gitignore @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 + +bindings_generated.rs +exports_*_generated.h diff --git a/rust/Makefile b/rust/Makefile index 02f2459083e4ec..31a4cb4fc735b1 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -1,4 +1,106 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_HAS_RUST) = helpers.o +obj-$(CONFIG_RUST) += helpers.o exports.o +obj-$(CONFIG_RUST) += core.o compiler_builtins.o alloc.o kernel.o +extra-$(CONFIG_RUST) += bindings_generated.rs libmodule.so +extra-$(CONFIG_RUST) += exports_core_generated.h exports_alloc_generated.h +extra-$(CONFIG_RUST) += exports_kernel_generated.h +ifdef CONFIG_CC_IS_CLANG +bindgen_c_flags = $(c_flags) +else +# bindgen relies on libclang to parse C. Ideally, bindgen would support a GCC +# plugin backend and/or the Clang driver would be perfectly compatible with GCC. +# +# For the moment, here we are just hoping the generated bindings are correct +# for our usage. At least between LLVM 11 and GCC 10.1, in a minimal release +# kernel configuration, there are no relevant differences. However, some config +# options may not work (e.g. `GCC_PLUGIN_RANDSTRUCT` if we end up using one +# of those structs). +bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 \ + -mskip-rax-setup -fconserve-stack -falign-jumps=1 -falign-loops=1 \ + -fno-ipa-cp-clone -fno-partial-inlining -fno-reorder-blocks \ + -fno-allow-store-data-races -fasan-shadow-offset=% \ + -Wno-packed-not-aligned -Wno-format-truncation -Wno-format-overflow \ + -Wno-stringop-truncation -Wno-unused-but-set-variable \ + -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized \ + -Werror=designated-init -Wno-zero-length-bounds \ + --param=% --param asan-% +bindgen_extra_c_flags := -Wno-address-of-packed-member +bindgen_c_flags = $(filter-out $(bindgen_skip_c_flags), $(c_flags)) \ + $(bindgen_extra_c_flags) +endif + +bindgen_opaque_types := xregs_state desc_struct arch_lbr_state + +quiet_cmd_bindgen = BINDGEN $@ + cmd_bindgen = \ + $(BINDGEN) $< $(addprefix --opaque-type , $(bindgen_opaque_types)) \ + --use-core --with-derive-default --ctypes-prefix c_types \ + --size_t-is-usize -o $@ -- $(bindgen_c_flags) + +$(objtree)/rust/bindings_generated.rs: $(srctree)/rust/kernel/bindings_helper.h FORCE + $(call if_changed_dep,bindgen) + +rustc_sysroot := $(shell $(RUSTC) --print sysroot) +rustc_src := $(rustc_sysroot)/lib/rustlib/src/rust +compiler_builtins_src := $(rustc_sysroot)/lib/rustlib/src/compiler-builtins + +quiet_cmd_rustc_procmacro = RUSTC P $@ + cmd_rustc_procmacro = \ + $(RUSTC) $(rustc_flags) --edition 2018 --extern proc_macro \ + --crate-type proc-macro --out-dir $(objtree)/rust/ \ + --crate-name $(patsubst lib%.so,%,$(notdir $@)) $<; \ + mv $(objtree)/rust/$(patsubst lib%.so,%,$(notdir $@)).d $(depfile); \ + sed -i '/^\#/d' $(depfile) + +$(objtree)/rust/libmodule.so: $(srctree)/rust/module.rs FORCE + $(call if_changed_dep,rustc_procmacro) + +quiet_cmd_rustc_library = RUSTC L $@ + cmd_rustc_library = \ + RUST_BINDINGS_FILE=$(abspath $(objtree)/rust/bindings_generated.rs) \ + $(RUSTC) $(rustc_flags) $(rustc_cross_flags) $(rustc_target_flags) \ + --crate-type rlib --out-dir $(objtree)/rust/ -L $(objtree)/rust/ \ + --crate-name $(patsubst %.o,%,$(notdir $@)) $<; \ + mv $(objtree)/rust/$(patsubst %.o,%,$(notdir $@)).d $(depfile); \ + sed -i '/^\#/d' $(depfile) + +$(objtree)/rust/core.o: rustc_target_flags = --edition 2018 +$(objtree)/rust/core.o: $(rustc_src)/library/core/src/lib.rs FORCE + $(call if_changed_dep,rustc_library) + +$(objtree)/rust/compiler_builtins.o: rustc_target_flags = --edition 2015 \ + --cfg 'feature="compiler-builtins"' --cfg 'feature="default"' +$(objtree)/rust/compiler_builtins.o: $(compiler_builtins_src)/src/lib.rs \ + $(objtree)/rust/core.o FORCE + $(call if_changed_dep,rustc_library) + +$(objtree)/rust/alloc.o: rustc_target_flags = --edition 2018 +$(objtree)/rust/alloc.o: $(rustc_src)/library/alloc/src/lib.rs \ + $(objtree)/rust/compiler_builtins.o FORCE + $(call if_changed_dep,rustc_library) + +$(objtree)/rust/kernel.o: rustc_target_flags = --edition 2018 --extern alloc +$(objtree)/rust/kernel.o: $(srctree)/rust/kernel/lib.rs $(objtree)/rust/alloc.o \ + $(objtree)/rust/libmodule.so $(objtree)/rust/bindings_generated.rs FORCE + $(call if_changed_dep,rustc_library) + +quiet_cmd_exports = EXPORTS $@ + cmd_exports = \ + $(NM) -p --defined-only $< \ + | grep -F ' T ' | cut -d ' ' -f 3 | grep -E '^(__rust_|_R)' \ + | xargs -n1 -Isymbol \ + echo 'EXPORT_SYMBOL$(exports_target_type)(symbol);' > $@ + +$(objtree)/rust/exports_core_generated.h: exports_target_type := _RUST +$(objtree)/rust/exports_core_generated.h: $(objtree)/rust/core.o FORCE + $(call if_changed,exports) + +$(objtree)/rust/exports_alloc_generated.h: exports_target_type := _RUST +$(objtree)/rust/exports_alloc_generated.h: $(objtree)/rust/alloc.o FORCE + $(call if_changed,exports) + +$(objtree)/rust/exports_kernel_generated.h: exports_target_type := _RUST_GPL +$(objtree)/rust/exports_kernel_generated.h: $(objtree)/rust/kernel.o FORCE + $(call if_changed,exports) diff --git a/rust/exports.c b/rust/exports.c new file mode 100644 index 00000000000000..fda4c2e1b6be9a --- /dev/null +++ b/rust/exports.c @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// A hack to export Rust symbols for loadable modules without having to redo +// the entire `include/linux/export.h` logic in Rust. +// +// Note that this requires `-Z symbol-mangling-version=v0` because Rust's +// default ("legacy") mangling scheme 1) uses a hash suffix which cannot +// be predicted across compiler versions and 2) uses invalid characters +// for C identifiers (thus we cannot use the `EXPORT_SYMBOL_*` macros). + +#include + +#define EXPORT_SYMBOL_RUST(sym) extern int sym; EXPORT_SYMBOL(sym); +#define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym); + +#include "exports_core_generated.h" +#include "exports_alloc_generated.h" +#include "exports_kernel_generated.h" diff --git a/rust/kernel/Cargo.toml b/rust/kernel/Cargo.toml deleted file mode 100644 index bd116a6fc7db48..00000000000000 --- a/rust/kernel/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 - -[package] -name = "kernel" -version = "0.1.0" -authors = ["Rust for Linux Contributors"] -edition = "2018" -publish = false - -[dependencies] -bitflags = "1" -module = { path = "../module" } - diff --git a/rust/kernel/allocator.rs b/rust/kernel/allocator.rs new file mode 100644 index 00000000000000..383f85e8046e2c --- /dev/null +++ b/rust/kernel/allocator.rs @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: GPL-2.0 + +use core::alloc::{GlobalAlloc, Layout}; +use core::ptr; + +use crate::bindings; +use crate::c_types; + +pub struct KernelAllocator; + +unsafe impl GlobalAlloc for KernelAllocator { + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + // krealloc is used instead of kmalloc because kmalloc is an inline function and can't be + // bound to as a result + bindings::krealloc(ptr::null(), layout.size(), bindings::GFP_KERNEL) as *mut u8 + } + + unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) { + bindings::kfree(ptr as *const c_types::c_void); + } +} + +#[alloc_error_handler] +fn oom(_layout: Layout) -> ! { + panic!("Out of memory!"); +} + +// `rustc` only generates these for some crate types. Even then, we would need +// to extract the object file that has them from the archive. For the moment, +// let's generate them ourselves instead. +#[no_mangle] +pub fn __rust_alloc(size: usize, _align: usize) -> *mut u8 { + unsafe { bindings::krealloc(core::ptr::null(), size, bindings::GFP_KERNEL) as *mut u8 } +} + +#[no_mangle] +pub fn __rust_dealloc(ptr: *mut u8, _size: usize, _align: usize) { + unsafe { bindings::kfree(ptr as *const c_types::c_void) }; +} + +#[no_mangle] +pub fn __rust_realloc(ptr: *mut u8, _old_size: usize, _align: usize, new_size: usize) -> *mut u8 { + unsafe { bindings::krealloc(ptr as *const c_types::c_void, new_size, bindings::GFP_KERNEL) as *mut u8 } +} + +#[no_mangle] +pub fn __rust_alloc_zeroed(size: usize, _align: usize) -> *mut u8 { + unsafe { bindings::krealloc(core::ptr::null(), size, bindings::GFP_KERNEL | bindings::__GFP_ZERO) as *mut u8 } +} + +#[no_mangle] +pub fn __rust_alloc_error_handler(_size: usize, _align: usize) -> ! { + panic!("Out of memory!"); +} diff --git a/rust/kernel/src/bindings.rs b/rust/kernel/bindings.rs similarity index 86% rename from rust/kernel/src/bindings.rs rename to rust/kernel/bindings.rs index f0c31a36dc7600..0d46abfd6f23d1 100644 --- a/rust/kernel/src/bindings.rs +++ b/rust/kernel/bindings.rs @@ -14,3 +14,4 @@ mod bindings_raw { pub use bindings_raw::*; pub const GFP_KERNEL: gfp_t = BINDINGS_GFP_KERNEL; +pub const __GFP_ZERO: gfp_t = BINDINGS___GFP_ZERO; diff --git a/rust/kernel/src/bindings_helper.h b/rust/kernel/bindings_helper.h similarity index 88% rename from rust/kernel/src/bindings_helper.h rename to rust/kernel/bindings_helper.h index b4cdf67602acdc..3c2063484e003d 100644 --- a/rust/kernel/src/bindings_helper.h +++ b/rust/kernel/bindings_helper.h @@ -12,3 +12,4 @@ // bindgen gets confused at certain things const gfp_t BINDINGS_GFP_KERNEL = GFP_KERNEL; +const gfp_t BINDINGS___GFP_ZERO = __GFP_ZERO; diff --git a/rust/kernel/src/c_types.rs b/rust/kernel/c_types.rs similarity index 100% rename from rust/kernel/src/c_types.rs rename to rust/kernel/c_types.rs diff --git a/rust/kernel/src/chrdev.rs b/rust/kernel/chrdev.rs similarity index 100% rename from rust/kernel/src/chrdev.rs rename to rust/kernel/chrdev.rs diff --git a/rust/kernel/src/error.rs b/rust/kernel/error.rs similarity index 100% rename from rust/kernel/src/error.rs rename to rust/kernel/error.rs diff --git a/rust/kernel/src/file_operations.rs b/rust/kernel/file_operations.rs similarity index 97% rename from rust/kernel/src/file_operations.rs rename to rust/kernel/file_operations.rs index 5a3c1dfe7aef64..c67c2ef9c53a58 100644 --- a/rust/kernel/src/file_operations.rs +++ b/rust/kernel/file_operations.rs @@ -11,12 +11,6 @@ use crate::c_types; use crate::error::{Error, KernelResult}; use crate::user_ptr::{UserSlicePtr, UserSlicePtrReader, UserSlicePtrWriter}; -bitflags::bitflags! { - pub struct FileFlags: c_types::c_uint { - const NONBLOCK = bindings::O_NONBLOCK; - } -} - pub struct File { ptr: *const bindings::file, } @@ -29,10 +23,6 @@ impl File { pub fn pos(&self) -> u64 { unsafe { (*self.ptr).f_pos as u64 } } - - pub fn flags(&self) -> FileFlags { - FileFlags::from_bits_truncate(unsafe { (*self.ptr).f_flags }) - } } // Matches std::io::SeekFrom in the Rust stdlib diff --git a/rust/kernel/src/lib.rs b/rust/kernel/lib.rs similarity index 98% rename from rust/kernel/src/lib.rs rename to rust/kernel/lib.rs index 6b2c46c532871b..681a87054fa61c 100644 --- a/rust/kernel/src/lib.rs +++ b/rust/kernel/lib.rs @@ -7,11 +7,9 @@ // Ensure conditional compilation based on the kernel configuration works; // otherwise we may silently break things like initcall handling. -#[cfg(not(CONFIG_HAS_RUST))] +#[cfg(not(CONFIG_RUST))] compile_error!("Missing kernel configuration for conditional compilation"); -extern crate alloc; - use alloc::boxed::Box; use core::alloc::Layout; use core::mem::MaybeUninit; diff --git a/rust/kernel/src/miscdev.rs b/rust/kernel/miscdev.rs similarity index 100% rename from rust/kernel/src/miscdev.rs rename to rust/kernel/miscdev.rs diff --git a/rust/kernel/src/prelude.rs b/rust/kernel/prelude.rs similarity index 76% rename from rust/kernel/src/prelude.rs rename to rust/kernel/prelude.rs index 36d9e2104f681a..a23a54858e38ee 100644 --- a/rust/kernel/src/prelude.rs +++ b/rust/kernel/prelude.rs @@ -2,6 +2,9 @@ //! The `kernel` prelude +/// ICE if we use `--extern module` +extern crate module; + pub use alloc::{borrow::ToOwned, string::String}; pub use module::module; diff --git a/rust/kernel/src/printk.rs b/rust/kernel/printk.rs similarity index 100% rename from rust/kernel/src/printk.rs rename to rust/kernel/printk.rs diff --git a/rust/kernel/src/random.rs b/rust/kernel/random.rs similarity index 100% rename from rust/kernel/src/random.rs rename to rust/kernel/random.rs diff --git a/rust/kernel/src/allocator.rs b/rust/kernel/src/allocator.rs deleted file mode 100644 index 27647be92b5134..00000000000000 --- a/rust/kernel/src/allocator.rs +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -use core::alloc::{GlobalAlloc, Layout}; -use core::ptr; - -use crate::bindings; -use crate::c_types; - -pub struct KernelAllocator; - -unsafe impl GlobalAlloc for KernelAllocator { - unsafe fn alloc(&self, layout: Layout) -> *mut u8 { - // krealloc is used instead of kmalloc because kmalloc is an inline function and can't be - // bound to as a result - bindings::krealloc(ptr::null(), layout.size(), bindings::GFP_KERNEL) as *mut u8 - } - - unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) { - bindings::kfree(ptr as *const c_types::c_void); - } -} - -#[alloc_error_handler] -fn oom(_layout: Layout) -> ! { - panic!("Out of memory!"); -} diff --git a/rust/kernel/src/sysctl.rs b/rust/kernel/sysctl.rs similarity index 100% rename from rust/kernel/src/sysctl.rs rename to rust/kernel/sysctl.rs diff --git a/rust/kernel/src/types.rs b/rust/kernel/types.rs similarity index 100% rename from rust/kernel/src/types.rs rename to rust/kernel/types.rs diff --git a/rust/kernel/src/user_ptr.rs b/rust/kernel/user_ptr.rs similarity index 100% rename from rust/kernel/src/user_ptr.rs rename to rust/kernel/user_ptr.rs diff --git a/rust/module/src/lib.rs b/rust/module.rs similarity index 99% rename from rust/module/src/lib.rs rename to rust/module.rs index b8bdbc9eb847c3..051a58bac8da65 100644 --- a/rust/module/src/lib.rs +++ b/rust/module.rs @@ -2,8 +2,6 @@ //! Implements the `module!` macro magic -extern crate proc_macro; - use proc_macro::{token_stream, Delimiter, Group, TokenStream, TokenTree}; fn expect_ident(it: &mut token_stream::IntoIter) -> String { diff --git a/rust/module/Cargo.toml b/rust/module/Cargo.toml deleted file mode 100644 index c61e6d2c192cb3..00000000000000 --- a/rust/module/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 - -[package] -name = "module" -version = "0.1.0" -authors = ["Rust for Linux Contributors"] -edition = "2018" -publish = false - -[lib] -proc-macro = true - diff --git a/scripts/Makefile.build b/scripts/Makefile.build index dccbbe97257971..8f19b8b6fb2760 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -23,14 +23,11 @@ subdir-y := subdir-m := EXTRA_AFLAGS := EXTRA_CFLAGS := -EXTRA_RUSTCFLAGS := -EXTRA_CARGOFLAGS := EXTRA_CPPFLAGS := EXTRA_LDFLAGS := asflags-y := ccflags-y := rustcflags-y := -cargoflags-y := cppflags-y := ldflags-y := @@ -299,30 +296,23 @@ quiet_cmd_cc_lst_c = MKLST $@ $(obj)/%.lst: $(src)/%.c FORCE $(call if_changed_dep,cc_lst_c) -# Compile Rust sources (.rs) via cargo +# Compile Rust sources (.rs) # --------------------------------------------------------------------------- -quiet_cmd_cargo = CARGO $(quiet_modtag) $@ - cmd_cargo = export RUST_BINDINGS_FILE=$(shell readlink -f include/generated/rust_bindings.rs) && $(CARGO) build --manifest-path $(srctree)/$(src)/Cargo.toml --out-dir $(src) $(cargo_flags) - -include/generated/rust_bindings.rs: FORCE - $(Q)$(BINDGEN) $(srctree)/rust/kernel/src/bindings_helper.h \ - --opaque-type xregs_state \ - --opaque-type desc_struct \ - --use-core \ - --with-derive-default \ - --ctypes-prefix c_types \ - --size_t-is-usize \ - -o include/generated/rust_bindings.rs \ - -- $(c_flags) - -# The .o from the Rust staticlib -$(obj)/%.o: $(src)/lib%.a - $(Q)$(LD) -r -o $@ --whole-archive $< - -# The Rust staticlib from cargo -$(obj)/lib%.a: include/generated/rust_bindings.rs FORCE - $(call cmd,cargo) +rustc_cross_flags := --target=$(srctree)/arch/$(SRCARCH)/rust/target.json + +quiet_cmd_rustc_o_rs = RUSTC $(quiet_modtag) $@ + cmd_rustc_o_rs = \ + RUST_MODFILE=$(modfile) \ + $(RUSTC) $(rustc_flags) $(rustc_cross_flags) --edition 2018 \ + --extern alloc --extern kernel \ + --crate-type rlib --out-dir $(obj) -L $(objtree)/rust/ \ + --crate-name $(patsubst %.o,%,$(notdir $@)) $<; \ + mv $(obj)/$(subst .o,,$(notdir $@)).d $(depfile); \ + sed -i '/^\#/d' $(depfile) + +$(obj)/%.o: $(src)/%.rs FORCE + $(call if_changed_dep,rustc_o_rs) # Compile assembler sources (.S) # --------------------------------------------------------------------------- diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7a72565d1174f3..9c45bf628a4619 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -21,7 +21,6 @@ endif KBUILD_AFLAGS += $(subdir-asflags-y) KBUILD_CFLAGS += $(subdir-ccflags-y) KBUILD_RUSTCFLAGS += $(subdir-rustcflags-y) -KBUILD_CARGOFLAGS += $(subdir-cargoflags-y) # Figure out what we need to build from the various variables # =========================================================================== @@ -132,10 +131,6 @@ _rustc_flags = $(filter-out $(RUSTCFLAGS_REMOVE_$(target-stem).o), \ $(filter-out $(rustcflags-remove-y), \ $(KBUILD_RUSTCFLAGS) $(rustcflags-y)) \ $(RUSTCFLAGS_$(target-stem).o)) -_cargo_flags = $(filter-out $(CARGOFLAGS_REMOVE_$(target-stem).o), \ - $(filter-out $(cargoflags-remove-y), \ - $(KBUILD_CARGOFLAGS) $(cargoflags-y)) \ - $(CARGOFLAGS_$(target-stem).o)) _a_flags = $(filter-out $(AFLAGS_REMOVE_$(target-stem).o), \ $(filter-out $(asflags-remove-y), \ $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(asflags-y)) \ @@ -209,11 +204,6 @@ modkern_rustcflags = \ $(KBUILD_RUSTCFLAGS_MODULE) $(RUSTCFLAGS_MODULE), \ $(KBUILD_RUSTCFLAGS_KERNEL) $(RUSTCFLAGS_KERNEL)) -modkern_cargoflags = \ - $(if $(part-of-module), \ - $(KBUILD_CARGOFLAGS_MODULE) $(CARGOFLAGS_MODULE), \ - $(KBUILD_CARGOFLAGS_KERNEL) $(CARGOFLAGS_KERNEL)) - modkern_aflags = $(if $(part-of-module), \ $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \ $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL)) @@ -223,26 +213,7 @@ c_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ $(_c_flags) $(modkern_cflags) \ $(basename_flags) $(modname_flags) -# Needed for the Rust bindings -# TODO: we unconditionally pass `KBUILD_CFLAGS_MODULE` to avoid having -# dual bindings, but ideally we should generate two set of bindings -RUST_BINDGEN_CFLAGS = $(c_flags) $(KBUILD_CFLAGS_MODULE) -export RUST_BINDGEN_CFLAGS - -KCONFIG_RUSTC_CFG ?= ./include/generated/rustc_cfg - -rustc_flags = $(_rustc_flags) $(modkern_rustcflags) @$(shell readlink -f $(KCONFIG_RUSTC_CFG)) - -# Passed by cargo -RUSTFLAGS = $(rustc_flags) -export RUSTFLAGS - -# For the `module!` macro -# TODO: should be `$(modfile)`, but it is not correct for us -RUST_MODFILE = $(obj)/$(notdir $(obj)) -export RUST_MODFILE - -cargo_flags = $(_cargo_flags) $(modkern_cargoflags) +rustc_flags = $(_rustc_flags) $(modkern_rustcflags) @$(objtree)/include/generated/rustc_cfg a_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ $(_a_flags) $(modkern_aflags) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 1996530a354bc0..528fbb93d51501 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -27,7 +27,7 @@ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) -#define KSYM_NAME_LEN 256 +#define KSYM_NAME_LEN 512 struct sym_entry { unsigned long long addr; @@ -464,12 +464,37 @@ static void write_src(void) if ((i & 0xFF) == 0) markers[i >> 8] = off; - printf("\t.byte 0x%02x", table[i]->len); + /* + * There cannot be any symbol of length zero -- we use that + * to mark a "big" symbol (and it doesn't make sense anyway). + */ + if (table[i]->len == 0) { + fprintf(stderr, "kallsyms failure: " + "unexpected zero symbol length\n"); + exit(EXIT_FAILURE); + } + + /* Only lengths that fit in up to two bytes are supported. */ + if (table[i]->len > 0xFFFF) { + fprintf(stderr, "kallsyms failure: " + "unexpected huge symbol length\n"); + exit(EXIT_FAILURE); + } + + if (table[i]->len <= 0xFF) { + /* Most symbols use a single byte for the length. */ + printf("\t.byte 0x%02x", table[i]->len); + off += table[i]->len + 1; + } else { + /* "Big" symbols use a zero and then two bytes. */ + printf("\t.byte 0x00, 0x%02x, 0x%02x", + (table[i]->len >> 8) & 0xFF, + table[i]->len & 0xFF); + off += table[i]->len + 3; + } for (k = 0; k < table[i]->len; k++) printf(", 0x%02x", table[i]->sym[k]); printf("\n"); - - off += table[i]->len + 1; } printf("\n"); diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 0494111d2d98e4..cd0145e7c9da54 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -1155,9 +1155,7 @@ int conf_write_autoconf(int overwrite) if (rename(".tmpconfig", autoconf_name)) return 1; - name = getenv("KCONFIG_RUSTC_CFG"); - if (!name) - name = "include/generated/rustc_cfg"; + name = "include/generated/rustc_cfg"; if (make_parent_dir(name)) return 1; if (rename(".tmp_rustc_cfg", name)) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index f882ce0d9327f8..222fd7ebb9dd53 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -49,7 +49,7 @@ enum export { * here we use Elf_Addr instead of long for covering cross-compile */ -#define MODULE_NAME_LEN (64 - sizeof(Elf_Addr)) +#define MODULE_NAME_LEN (256 - sizeof(Elf_Addr)) void __attribute__((format(printf, 2, 3))) modpost_log(enum loglevel loglevel, const char *fmt, ...) diff --git a/tools/include/linux/kallsyms.h b/tools/include/linux/kallsyms.h index 5e9d717e339396..5a37ccbec54fbc 100644 --- a/tools/include/linux/kallsyms.h +++ b/tools/include/linux/kallsyms.h @@ -6,7 +6,7 @@ #include #include -#define KSYM_NAME_LEN 256 +#define KSYM_NAME_LEN 512 struct module; diff --git a/tools/include/linux/lockdep.h b/tools/include/linux/lockdep.h index b497a16548a6cf..d9c163f3ab2422 100644 --- a/tools/include/linux/lockdep.h +++ b/tools/include/linux/lockdep.h @@ -47,7 +47,7 @@ static inline int debug_locks_off(void) #define task_pid_nr(tsk) ((tsk)->pid) -#define KSYM_NAME_LEN 256 +#define KSYM_NAME_LEN 512 #define printk(...) dprintf(STDOUT_FILENO, __VA_ARGS__) #define pr_err(format, ...) fprintf (stderr, format, ## __VA_ARGS__) #define pr_warn pr_err diff --git a/tools/lib/perf/include/perf/event.h b/tools/lib/perf/include/perf/event.h index 988c539bedb6e4..6549c5d7845490 100644 --- a/tools/lib/perf/include/perf/event.h +++ b/tools/lib/perf/include/perf/event.h @@ -83,7 +83,7 @@ struct perf_record_throttle { }; #ifndef KSYM_NAME_LEN -#define KSYM_NAME_LEN 256 +#define KSYM_NAME_LEN 512 #endif struct perf_record_ksymbol { diff --git a/tools/lib/symbol/kallsyms.h b/tools/lib/symbol/kallsyms.h index 72ab9870454baf..542f9b059c3bd2 100644 --- a/tools/lib/symbol/kallsyms.h +++ b/tools/lib/symbol/kallsyms.h @@ -7,7 +7,7 @@ #include #ifndef KSYM_NAME_LEN -#define KSYM_NAME_LEN 256 +#define KSYM_NAME_LEN 512 #endif static inline u8 kallsyms2elf_binding(char type)