Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running an IKOS scan from tutorial does not work #138

Closed
xfiderek opened this issue Feb 20, 2024 · 3 comments
Closed

Running an IKOS scan from tutorial does not work #138

xfiderek opened this issue Feb 20, 2024 · 3 comments

Comments

@xfiderek
Copy link
Contributor

xfiderek commented Feb 20, 2024

After trying to run IKOS scan as per this tutorial, I've encountered 3 problems.

Problem A: colcon build command throws basic errors

Following the readme, I try to execute

spaceros-user@d10d85c68f0e:~/spaceros$ CC="ikos-scan-cc" CXX="ikos-scan-c++" LD="ikos-scan-cc" colcon build --build-base build_ikos --install-base install_ikos --cmake-args -DSECURITY=ON -DINSTALL_EXAMPLES=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --no-warn-unused-cli

First impediment is that ikos-scan-cc executable is missing, which can easily be fixed. Apart from that, we also need to set IKOS_SCAN_NOTIFIER_FILES env variable in the container. Otherwise it throws:

error: ikos-scan-cc: missing environment variable IKOS_SCAN_SERVER or IKOS_SCAN_NOTIFIER_FILES

Problem B: building cobra_vendor package fails when ikos-scan-cc is used as a compiler

The exact error thrown by cobra_vendor package is:

# compile command
ikos-scan-cc -Wall -pedantic -Werror -Wshadow -O2 -DYY_NO_INPUT -I. -std=c99 -o scope_check scope_check.c cwe_util.c c.ar -pthread
# error
clang: error: c.ar: 'linker' input unused [-Werror,-Wunused-command-line-argument]

c.ar is a library that is build earlier and which should be linked at this step.

Changing the end of compile command from c.ar -pthread to -Wl,c.ar -pthread fixes the issue, so i presume there is something wrong with how ikos-scan-cc forwards arguments to clang. The easiest will be to fix that in ament’s cobra_vendor package. Two other alternatives are to either fix it in ikos side or directly in cobra.

Problem C: ament_ikos timeouts for large packages (e.g. rclcpp)

The reason is that ament_ikos uses default timeout time of 60 seconds. We should modify this value in the repo.

After addressing these 3 issues, I was able to run ikos scan as expected in spaceros workspace. I will create 3 PRs, first for this repo (problem A), second for ament_cobra repo (problem B), and third for ament_ikos repo (problem C)

xfiderek added a commit to xfiderek/spaceros-docker that referenced this issue Feb 20, 2024
This commit adjusts the Earthfile, entrypoint.sh, and README.md, so that IKOS tutorial is runnable.
xfiderek added a commit to xfiderek/ament_cobra that referenced this issue Feb 20, 2024
This commit fixes compilation with ikos-scan, by modifying linker flags
xfiderek added a commit to xfiderek/ament_ikos that referenced this issue Feb 20, 2024
This commit increases timeout for ikos linter in `ament_cmake_ikos` package
@xfiderek
Copy link
Contributor Author

@ivanperez-keera, tagging you for visibility.

I have created 3 PRs:
Problem A: #139
Problem B: ament/ament_cobra#16
Problem C: ament/ament_ikos#4

@ivanperez-keera
Copy link
Contributor

This is extremely useful! Thank you @xfiderek for doing this.

@ivanperez-keera
Copy link
Contributor

(I'll review in more detail later but I wanted to send you that quick note 😃 )

@mkhansenbot mkhansenbot added this to the humble-2024.04.0 milestone Feb 22, 2024
sloretz pushed a commit to ament/ament_ikos that referenced this issue Feb 23, 2024
This commit increases timeout for ikos linter in `ament_cmake_ikos` package
xfiderek added a commit to xfiderek/spaceros-docker that referenced this issue Feb 29, 2024
This commit adjusts the Earthfile, entrypoint.sh, and README.md, so that IKOS tutorial is runnable.
xfiderek added a commit to xfiderek/spaceros-docker that referenced this issue Feb 29, 2024
This commit adjusts the Earthfile, entrypoint.sh, and README.md, so that IKOS tutorial is runnable.
xfiderek added a commit to xfiderek/spaceros-docker that referenced this issue Apr 23, 2024
xfiderek added a commit to xfiderek/spaceros-docker that referenced this issue Apr 23, 2024
Add additional environment variable to entrypoint of spaceros image.
This lets ikos generate .ikosbin files.
xfiderek added a commit to xfiderek/spaceros-docker that referenced this issue Apr 23, 2024
ivanperez-keera pushed a commit to xfiderek/spaceros-docker that referenced this issue Apr 25, 2024
Add environment variable to entrypoint of spaceros image. This variable is
required for ikos-scan to execute and generate .ikosbin files without having to
run the ikos-scan server.
ivanperez-keera pushed a commit to xfiderek/spaceros-docker that referenced this issue Apr 25, 2024
The current instructions specify how to re-run all tests, which takes
substantial time. This change explains how to run ikos-scan specifically, which
should be faster than running all tests.
ivanperez-keera pushed a commit to xfiderek/spaceros-docker that referenced this issue Apr 26, 2024
Add environment variable to entrypoint of spaceros image. This variable is
required for ikos-scan to execute and generate .ikosbin files without having to
run the ikos-scan server.
ivanperez-keera pushed a commit to xfiderek/spaceros-docker that referenced this issue Apr 26, 2024
The current instructions specify how to re-run all tests, which takes
substantial time. This change explains how to run ikos-scan specifically, which
should be faster than running all tests.
@github-project-automation github-project-automation bot moved this from In Review to Done in Space ROS Project Development Apr 26, 2024
eholum pushed a commit to eholum/space-ros that referenced this issue Jun 26, 2024
Add environment variable to entrypoint of spaceros image. This variable is
required for ikos-scan to execute and generate .ikosbin files without having to
run the ikos-scan server.
eholum pushed a commit to eholum/space-ros that referenced this issue Jun 26, 2024
).

The current instructions specify how to re-run all tests, which takes
substantial time. This change explains how to run ikos-scan specifically, which
should be faster than running all tests.
eholum pushed a commit to eholum/space-ros that referenced this issue Jun 26, 2024
Add environment variable to entrypoint of spaceros image. This variable is
required for ikos-scan to execute and generate .ikosbin files without having to
run the ikos-scan server.
eholum pushed a commit to eholum/space-ros that referenced this issue Jun 26, 2024
).

The current instructions specify how to re-run all tests, which takes
substantial time. This change explains how to run ikos-scan specifically, which
should be faster than running all tests.
eholum pushed a commit to eholum/space-ros that referenced this issue Jun 26, 2024
eholum pushed a commit to eholum/space-ros that referenced this issue Jun 26, 2024
Add environment variable to entrypoint of spaceros image. This variable is
required for ikos-scan to execute and generate .ikosbin files without having to
run the ikos-scan server.
eholum pushed a commit to eholum/space-ros that referenced this issue Jun 26, 2024
).

The current instructions specify how to re-run all tests, which takes
substantial time. This change explains how to run ikos-scan specifically, which
should be faster than running all tests.
eholum pushed a commit to eholum/space-ros that referenced this issue Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

3 participants