Skip to content

Commit

Permalink
projet_creation: fixed missing jinja template parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianherrera committed Jan 1, 2019
1 parent f61ec23 commit 757f69d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 22 deletions.
4 changes: 2 additions & 2 deletions s2e_env/dat/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ required_versions:
- 16
- 18
# images.json must have this version
guest_images: 2
guest_images: 3

# Repo. Used for managing the S2E git repositories
repo:
url: https://storage.googleapis.com/git-repo-downloads/repo

# Directories that will automatically be built when running ``s2e init``
# Directories that will automatically be created when running ``s2e init``
dirs:
- build
- images
Expand Down
10 changes: 5 additions & 5 deletions s2e_env/templates/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#
# This file was automatically generated by s2e-env at {{ creation_time }}
#
# This bootstrap file is used to control the execution of the Linux target
# program in S2E.
# This bootstrap script is used to control the execution of the target program
# in an S2E guest VM.
#
# When you run launch-s2e.sh, the guest VM calls s2eget to fetch and execute this
# bootstrap script. This bootstrap script and the S2E config file determine how
# the target program is analyzed.
# When you run launch-s2e.sh, the guest VM calls s2eget to fetch and execute
# this bootstrap script. This bootstrap script and the S2E config file
# determine how the target program is analyzed.
#

set -x
Expand Down
4 changes: 2 additions & 2 deletions s2e_env/templates/instructions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include:
{% endif %}

{#############################################################################}
{% if dynamically_linked and image.group_name == 'linux' %}
{% if dynamically_linked and image.image_group == 'linux' %}

s2e.so
======
Expand Down Expand Up @@ -113,4 +113,4 @@ If something does not run as expected, you can troubleshoot like this:
* Run S2E in GDB using ./launch-s2e.sh debug

-------
Project {{ project_name }} created.
Project {{ project_dir }} created.
4 changes: 2 additions & 2 deletions s2e_env/templates/launch-s2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#
# This file was automatically generated by s2e-env at {{ creation_time }}
#
# This script can be used to run the S2E analysis. Additional QEMU command line
# arguments can be passed to this script at run time
# This script is used to run the S2E analysis. Additional QEMU command line
# arguments can be passed to this script at run time.
#

ENV_DIR="{{ env_dir }}"
Expand Down
7 changes: 4 additions & 3 deletions s2e_env/templates/s2e-config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
This is the main S2E configuration file
=======================================
This file was automatically generated by s2e-env at {{ creation_time }}.
This file was automatically generated by s2e-env at {{ creation_time }}
Changes can be made by the user where appropriate.
]]--

-------------------------------------------------------------------------------
-- This section configures the S2E engine.
s2e = {
logging = {
-- Possible values include "info", "warn", "debug", "none".
-- Possible values include "all", "debug", "info", "warn" and "none".
-- See Logging.h in libs2ecore.
console = "debug",
logLevel = "debug",
Expand Down Expand Up @@ -236,7 +237,7 @@ pluginsConfig.CUPASearcher = {
-- Otherwise too frequent state switching may decrease performance.
"batch",

{% if use_pov_generation %}
{% if enable_pov_generation %}
-- This class is used with the Recipe plugin in order to prioritize
-- states that have a high chance of containing a vulnerability.
"group",
Expand Down
15 changes: 9 additions & 6 deletions s2e_env/utils/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ def _validate_version(descriptor, filename):
version = descriptor.get('version')
required_version = CONSTANTS['required_versions']['guest_images']
if version != required_version:
raise CommandError('Need version %s for %s. Make sure that you have '
'the correct revision of the guest-images '
'repository' % (required_version, filename))
raise CommandError('%s versions do not match (s2e-env: %.2f, image: '
'%.2f). Make sure that you have the correct '
'revision of the guest-images repository' %
(filename, required_version, version))


def get_image_templates(img_build_dir):
Expand Down Expand Up @@ -144,6 +145,8 @@ def get_image_descriptor(image_dir):
ret['path'] = os.path.join(image_dir, 'image.raw.s2e')

return ret
except Exception:
raise CommandError('Unable to open image description %s. Check that '
'the image exists, was built, or downloaded' % img_json_path)
except CommandError:
raise
except Exception, e:
raise CommandError('Unable to open image description %s: %s' %
(img_json_path, e))
4 changes: 2 additions & 2 deletions s2e_env/utils/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import os
import stat

from jinja2 import Environment, FileSystemLoader
from jinja2 import Environment, FileSystemLoader, StrictUndefined

from .memoize import memoize

Expand All @@ -46,7 +46,7 @@ def _init_template_env(templates_dir=TEMPLATES_DIR):
given directory.
"""
env = Environment(loader=FileSystemLoader(templates_dir),
autoescape=False)
autoescape=False, undefined=StrictUndefined)
env.filters['datetimefilter'] = _datetimefilter

return env
Expand Down

0 comments on commit 757f69d

Please sign in to comment.