在尝试编译适用于WSA的内核(Linux android-lts/latte-2/5.15.104.4)并集成SukiSU Ultra(main分支)时,遇到了多个与kpm.c相关的编译错误。这些错误的核心是调用了一个被声明为错误的‘__bad_copy_from’函数,具体错误信息是‘copy source size is too small’,这影响了sukisu_kpm_load_module_path和sukisu_kpm_unload_module等函数。以下是详细的复现步骤和相关信息:

请在提交问题前检查

  • [x] 我已经搜索过问题,但没有找到相关内容
  • [x] 我将在KernelSU Manager的设置-报告日志中上传bug报告文件
  • [x] 我知道如何重现这个问题,它可能不特定于我的设备

描述问题

在编译适用于WSA的内核(Linux android-lts/latte-2/5.15.104.4)时,集成SukiSU Ultra(main分支)后出现多个与kpm.c相关的编译错误,核心报错为调用被声明为错误的‘__bad_copy_from’:copy source size is too small,具体涉及sukisu_kpm_load_module_path、sukisu_kpm_unload_module等函数,关键日志如下:

In function ‘check_copy_size’,
inlined from ‘copy_to_user’ at ./include/linux/uaccess.h:199:6,
inlined from ‘sukisu_kpm_load_module_path’ at drivers/kernelsu/kpm/kpm.c:66:8:
./include/linux/thread_info.h:211:25: error: call to ‘__bad_copy_from’ declared with attribute error: copy source size is too small
211 |                         __bad_copy_from();
|                         ^~~~~~~~~~~~~~~~~

如何复现

  1. 获取内核源码并解压:
    https://github.com/microsoft/WSA-Linux-Kernel/releases/tag/android-lts%2Flatte-2%2F5.15.104.4/
  2. 集成SukiSU Ultra

    curl -LSs "https://raw.githubusercontent.com/SukiSU/SukiSU/main/kernel/setup.sh" | bash -s main
  3. 配置编译参数:

    make ARCH=x86_64 WSA_DEFCONFIG=1 defconfig
    make ARCH=x86_64 menuconfig

    在显示的图形化界面中启用以下选项并保存:

    • Virtualization ---> Kernel-based Virtual Machine (KVM) support ---> KVM for Intel (and compatible) processors support
    • KVM for AMD processors support
    • File systems ---> Overlay filesystem support(这个启用后展开的项我只勾选了第二项,即 Overlayfs:follow redirects even if redirects are turn off )
    • Device Drivers ---> KernelSU ---> KernelSU function support ---> KernelSU debug mode
    • Enable SukiSU KPM
  4. 执行编译:

    make ARCH=x86_64 KCFLAGS="-std=gnu99 -Wno-error" -j$(nproc)
  5. 观察错误:
    编译过程中,在drivers/kernelsu/kpm/模块编译阶段,出现__bad_copy_from相关错误(如日志所示)。

补充:使用的编译工具链:

export CROSS_COMPILE=x86_64-linux-android-
export PATH=/path/to/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH

预期行为

正常编译出内核,无报错

截图

Image Image

日志

2025.07.27.Compile.Logs.txt 以上是完整编译日志。

设备信息

  • Device: Ubuntu 22.04 物理机(CPU: AMD Ryzen R5 9600X)(编译设备)
  • OS Version: Ubuntu 24.04 LTS
  • KernelSU Version: SukiSU Ultra main分支 Commit 115206b
  • Kernel Version: Linux android-lts/latte-2/5.15.104.4 (来自微软Github仓库)

附加信息

No response