BlackArch / blackarch

An ArchLinux based distribution for penetration testers and security researchers.
https://www.blackarch.org
Other
2.73k stars 551 forks source link

pfring-dkms nuking linux-headers files #4144

Closed nvzeppelin closed 1 month ago

nvzeppelin commented 1 month ago

Bug description

When installing the module, it removes e.g. KERNEL_HEADER_DIR/include/generated/autoconf.h which is needed for building this package. Im not sure but I think thus is related to make clean.

Steps to reproduce

Actual result: It fails to build the dkms module and some kernel header files are gone

Expected result: Mod builds fine and doesn't remove system files

Screenshots

Info for developers

GNU/Linux distribution: Arch Linux x86_64 Tool version: 1:3824.8cda9fc2-1

noraj commented 1 month ago

I have a hard time seeing how. It's definitely not from the PKGBUILD. Maybe the *# on this line?

https://github.com/ntop/PF_RING/blob/8cda9fc2ee0a3eb34493ac28f42d274d685c44b3/kernel/Makefile#L77

nvzeppelin commented 1 month ago

I'm not really familiar with what that syntax means but someone on the arch forums also suggested something like that

noraj commented 1 month ago

@nvzeppelin Would you retry with pkgver=3825.eb42f879? It may be fixed upstream in https://github.com/ntop/PF_RING/commit/eb42f8795516c096ca2f93f1b0747d31bbedb15d (see https://github.com/ntop/PF_RING/issues/934).

nvzeppelin commented 1 month ago

Still doesn't work. Have tracked it to be $(MAKE) -C $(KERNEL_SRC) SUBDIRS=$(HERE) clean which expands to make -C /lib/modules/6.9.1-arch1-1/build SUBDIRS=/usr/src/pfring-8.7.0.4317 clean. When executed manually this outputs

make: Entering directory '/usr/lib/modules/6.9.1-arch1-1/build'
scripts/Makefile.clean:12: arch/x86/math-emu/Makefile: No such file or directory
make[2]: *** No rule to make target 'arch/x86/math-emu/Makefile'.  Stop.
scripts/Makefile.clean:12: Documentation/Makefile: No such file or directory
make[2]: *** No rule to make target 'Documentation/Makefile'.  Stop.
scripts/Makefile.clean:12: arch/x86/power/Makefile: No such file or directory
make[2]: *** No rule to make target 'arch/x86/power/Makefile'.  Stop.
make[1]: *** [/usr/lib/modules/6.9.1-arch1-1/build/Makefile:1924: _clean_Documentation] Error 2
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [/usr/lib/modules/6.9.1-arch1-1/build/Makefile:1924: _clean_arch/x86/math-emu] Error 2
scripts/Makefile.clean:12: arch/x86/pci/Makefile: No such file or directory
make[2]: *** No rule to make target 'arch/x86/pci/Makefile'.  Stop.
make[1]: *** [/usr/lib/modules/6.9.1-arch1-1/build/Makefile:1924: _clean_arch/x86/power] Error 2
scripts/Makefile.clean:12: arch/x86/video/Makefile: No such file or directory
make[2]: *** No rule to make target 'arch/x86/video/Makefile'.  Stop.
make[1]: *** [/usr/lib/modules/6.9.1-arch1-1/build/Makefile:1924: _clean_arch/x86/pci] Error 2
make[1]: *** [/usr/lib/modules/6.9.1-arch1-1/build/Makefile:1924: _clean_arch/x86/video] Error 2
make[2]: *** No rule to make target 'clean'.  Stop.
make[1]: *** [/usr/lib/modules/6.9.1-arch1-1/build/Makefile:1344: resolve_btfids_clean] Error 2
  SYNC    include/config/auto.conf
  HOSTLD  scripts/kconfig/conf
error: rustup could not choose a version of rustc to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.
crypto/Kconfig:1486: can't open file "arch/arm/crypto/Kconfig"
make[4]: *** [scripts/kconfig/Makefile:85: syncconfig] Error 1
make[3]: *** [Makefile:688: syncconfig] Error 2
make[2]: *** [Makefile:789: include/config/auto.conf] Error 2
make[2]: *** [include/config/auto.conf] Deleting file 'include/generated/rustc_cfg'
make[2]: *** [include/config/auto.conf] Deleting file 'include/generated/autoconf.h'
make[1]: *** [/usr/lib/modules/6.9.1-arch1-1/build/Makefile:1924: _clean_.] Error 2
make: *** [Makefile:240: __sub-make] Error 2
make: Leaving directory '/usr/lib/modules/6.9.1-arch1-1/build'

For some reason I don't quite get this deletes the files in question

nvzeppelin commented 1 month ago

After looking at how other modules handle this, i've discovered that by replacing SUBDIRS= with M= it fixes the problem. This fix is in PR ntop/PF_RING#925