Closed frakman1 closed 10 months ago
you want to use --kernel=$dir
Thank you.
Are you sure it's a directory path though?
I checked the code and help output seems to want to point to a kconfig file (not a directory)
--kernel[=kconfig]
I am not sure I understand all of it but it seems to also look at other files it expects like in /proc or /boot.
Anyway, if I specify the path of the directory that contains the cross-compiled kernel (the one that contains the .config and vmlinux files) then it doesn't work and reverts to /boot/config... of the host.
However, if I specify the path to the actual .config
file instead, I do get some meaningful and relevant output.
Not sure if I'm using it properly or not so any help would be appreciated. I also didn't see an example using this option in this way in the README.
There are several things that it doesn't check in offline mode for kernel. This is because the runtime parameters have influence on it
if [[ -e "${CHK_KERNEL}" ]] && [[ ! -d "${CHK_KERNEL}" ]]; then
if [[ -s "$(pwd -P)/${CHK_KERNEL}" ]]; then
configfile=$(pwd -P)/${CHK_KERNEL}
elif [[ -s "${CHK_KERNEL}" ]]; then
configfile=${CHK_KERNEL}
else
"Error: config file specified do not exist"
exit 1
fi
It does have to be the actual config file. It doesn't search the directory
I am working on a refactor at the moment and its slowing coming along but I will look at finding the .config
in the directory.
Well, I looked at kernelcheck()
again and it seems that in this case, only the parts that looks at the ${kconfig}
file and does a grep for certain parameters are valid. Everything else seems to want to run a sysctl -n
command on something and that can only happen on the host.
This means that the results are a mix of the cross compiled kernel and the host's kernel!
That doesn't seem right.
Yea. The kernel
feature was intended to analyze the running host with different kernel configurations
Understood. I look forward to testing the next version and happy to provide results.
I also want to point out that checksec
aborts when it can't find some tools like readelf
etc. However, those tools are not necessary for the kernel check to complete so perhaps you can skip the abort in that case.
The refactor removes all dependencies on external tools so it won't be an issue once completed
Issue tracker
Issue
I normally run checksec against the target rootfs on my workstation works using the
--dir=
option. However, running it with--kernel
doesn't let you specify the target directory and wants to run on the host machine's native linux kernel. I am cross compiling an embedded linux system and wish to use checksec's--kernel
option against it. If I specify both, I get the error:The problem is that the embedded system does not have the necessary tools to conduct the checksec checks. Running it on the device returns the usual 'file not found errors'
Is there a way to do this?
Debug Report
include the output of
checksec --debug_report
Command run to produce the error
When run from device (expected as these tools are not available on the device and cannot be):
When run from host:
Running it without the --dir is not desired because it will just return information about the host, and not the device.
OS version and Kernel version
Host:
VERSION="18.04.6 LTS (Bionic Beaver)"
Device: Yocto arm based embedded systemDebug output
Not applicable.