volatilityfoundation / volatility

An advanced memory forensics framework
http://volatilityfoundation.org/
GNU General Public License v2.0
7.38k stars 1.29k forks source link

Linux Profile Against HWE Kernel #803

Open chrisanag1985 opened 3 years ago

chrisanag1985 commented 3 years ago

Hi , i am trying to build the module.c against the 5.11.0-27 kernel (HWE Kernel) and it fails. I had compiled the the module.c with previous GA Kernels.

root@ubuntu:/home/user/volatility/tools/linux# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"
root@ubuntu:/home/user/volatility/tools/linux# hwe-support-status 
Your Hardware Enablement Stack (HWE) is supported until April 2025.
root@ubuntu:/home/user/volatility/tools/linux# uname -a
Linux ubuntu 5.11.0-27-generic #29~20.04.1-Ubuntu SMP Wed Aug 11 15:58:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu:/home/user/volatility/tools/linux# make
make -C //lib/modules/5.11.0-27-generic/build CONFIG_DEBUG_INFO=y M="/home/user/volatility/tools/linux" modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-27-generic'
  MODPOST /home/user/volatility/tools/linux/Module.symvers
ERROR: modpost: missing MODULE_LICENSE() in /home/user/volatility/tools/linux/module.o
make[2]: *** [scripts/Makefile.modpost:124: /home/user/volatility/tools/linux/Module.symvers] Error 1
make[2]: *** Deleting file '/home/user/volatility/tools/linux/Module.symvers'
make[1]: *** [Makefile:1752: modules] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-27-generic'
make: *** [Makefile:10: dwarf] Error 2

if i try to bypass the error the module.dwarf is not correct

root@ubuntu:/home/user/volatility/tools/linux# make -i
make -C //lib/modules/5.11.0-27-generic/build CONFIG_DEBUG_INFO=y M="/home/user/volatility/tools/linux" modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-27-generic'
  MODPOST /home/user/volatility/tools/linux/Module.symvers
ERROR: modpost: missing MODULE_LICENSE() in /home/user/volatility/tools/linux/module.o
make[2]: [scripts/Makefile.modpost:124: /home/user/volatility/tools/linux/Module.symvers] Error 1 (ignored)
  CC [M]  /home/user/volatility/tools/linux/module.mod.o
  LD [M]  /home/user/volatility/tools/linux/module.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-27-generic'
dwarfdump -di module.ko > module.dwarf
make -C //lib/modules/5.11.0-27-generic/build M="/home/user/volatility/tools/linux" clean
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-27-generic'
  CLEAN   /home/user/volatility/tools/linux/Module.symvers
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-27-generic'
root@ubuntu:/home/user/volatility/tools/linux# cat module.dwarf 

.debug_info
<cu_header> signature<0x754f3cdeccdc36fa> typeoffset<0x00000000>

<0><0x0+0xb><DW_TAG_compile_unit> DW_AT_stmt_list<0x00000000> DW_AT_GNU_dwo_name</home/user/volatility/tools/linux/module.dwo> DW_AT_comp_dir</usr/src/linux-headers-5.11.0-27-generic> DW_AT_GNU_pubnames<yes(1)> DW_AT_GNU_addr_base<0x00000000> DW_AT_GNU_dwo_id<0x754f3cdeccdc36fa>
<cu_header> signature<0x2047dd707af9ac1a> typeoffset<0x00000000>

<0><0x24+0xb><DW_TAG_compile_unit> DW_AT_stmt_list<0x000016c5> DW_AT_GNU_dwo_name</home/user/volatility/tools/linux/module.mod.dwo> DW_AT_comp_dir</usr/src/linux-headers-5.11.0-27-generic> DW_AT_GNU_pubnames<yes(1)> DW_AT_GNU_addr_base<0x00000110> DW_AT_GNU_dwo_id<0x2047dd707af9ac1a>

i also tried to rebuild the linux-headers modpost.c of HWE Kernel

/usr/src/linux-headers-5.11.0-27-generic/scripts/mod/modpost.c

cause the difference between this kernel version and a previous GA linux-headers is the "error" is "warn" in the code below

        if (!mod->is_vmlinux) {
                license = get_modinfo(&info, "license");
                if (!license)
                        error("missing MODULE_LICENSE() in %s\n", modname);

but with no luck.

Can someone tell me what i make wrong?

thnx

tomioe commented 3 years ago

See this issue:

https://github.com/volatilityfoundation/volatility/issues/812