Skip to content
This repository has been archived by the owner on Jun 25, 2019. It is now read-only.

Add ISA_dep_plugin for dependency checking and visualization #26

Open
wants to merge 35 commits into
base: pkg_dep
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
6eeace0
Merge pull request #17 from 01org/devel
ereshetova Jan 19, 2016
d3dff22
checksec: Add explicit runtime dependency on binutils
Jan 20, 2016
b180439
Making junit xml output work for every plugin
ereshetova Jan 25, 2016
44676da
Merge pull request #20 from 01org/devel
ereshetova Jan 28, 2016
74bcd9d
Adding checks for executable stack to CFA plugin
ereshetova Jan 28, 2016
203d831
Merge pull request #21 from 01org/devel
ereshetova Jan 28, 2016
40716d0
Adding checks for executables that don't drop groups while calling s…
ereshetova Jan 29, 2016
0bcc404
Merge pull request #22 from 01org/devel
ereshetova Jan 29, 2016
161654c
Adding a check for CONFIG_X86_INTEL_MPX to KCA plugin
ereshetova Feb 1, 2016
6885a77
Adding checks for mpx for executables in CFA plugin
ereshetova Feb 1, 2016
36f79b0
Merge pull request #23 from 01org/devel
ereshetova Feb 2, 2016
82d56b8
isafw.bbclass: Use Base Package Name (BPN) instead of just Package Na…
Feb 4, 2016
359d420
isafw.bbclass: Add documentation strings describing common layer tasks
Feb 4, 2016
ba16be9
README.md: Add more Markdown styles to the text
Feb 4, 2016
bfe3ad8
Additional fixes for xml output
ereshetova Feb 4, 2016
859837e
Add ISA_dep_plugin for dependency checking and visualization
dallagi Feb 4, 2016
fa430c5
Merge pull request #25 from 01org/devel
ereshetova Feb 5, 2016
9ad299a
Merge pull request #24 from popovich-sergei/next
ereshetova Feb 5, 2016
f0e5ed6
Fetch checksec instead of storing the sript
ereshetova Feb 5, 2016
a731d80
Merge pull request #27 from 01org/devel
ereshetova Feb 8, 2016
4a97ed9
Render dependency graph
dallagi Feb 8, 2016
a39479d
Merge remote-tracking branch 'origin_old/pkg_dep' into pkg_dep
dallagi Feb 12, 2016
d2479e2
Making plugins full reports produced only on request
ereshetova Feb 22, 2016
c7559f9
adding check of range for pkg list
ereshetova Feb 23, 2016
7524314
Adding machine name to report names, small cleanup
ereshetova Feb 23, 2016
d492e10
Generate run-time dependency graph
dallagi Feb 26, 2016
829becb
Merge remote-tracking branch 'origin_old/master' into pkg_dep
dallagi Feb 26, 2016
4dc6101
Save graphs as svg instead of png
dallagi Mar 1, 2016
9361a7a
Add `repr` and `str` methods on `Dependency` class.
dallagi Mar 1, 2016
b6ed403
Move graphs loading from temp into dedicated method
dallagi Mar 23, 2016
7766ed2
Generate partial dependency graphs for vulnerability reports
dallagi Mar 23, 2016
4365063
Add hooks for complete/partial vulnerability graph generation
dallagi Mar 23, 2016
7248172
Add hooks for build-time vulnerability graph generation
dallagi Mar 29, 2016
1606cfe
Add cleanup method to isafw
dallagi Mar 29, 2016
7b5ec56
Add method to get a list of all the binaries generated by some source…
dallagi May 15, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@ Usage
In order to enable the isafw during the image build, please add
the following line to your build/conf/local.conf file:

```python
INHERIT += "isafw"
```

Next you need to update your build/conf/bblayers.conf file with the
location of meta-security-isafw layer on your filesystem along with
any other layers needed. e.g.:

```python
BBLAYERS ?= " \
/OE/oe-core/meta \
/OE/meta-security-isafw \
"
```

Also, some isafw plugins require network connection, so in case of a
proxy setup please make sure to export http_proxy variable into your
Expand All @@ -49,12 +53,16 @@ environment.
In order to produce image reports, you can execute image build
normally. For example:

```shell
bitbake core-image-minimal
```

If you are only interested to produce a report based on packages
and without building an image, please use:

```shell
bitbake -c analyse_sources_all core-image-minimal
```


Logs
Expand Down
10 changes: 7 additions & 3 deletions classes/isafw.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ python do_analysesource() {
fetch.unpack(workdir, (url,))

recipe = isafw.ISA_package()
recipe.name = d.getVar('PN', True)
recipe.name = d.getVar('BPN', True)
recipe.version = d.getVar('PV', True)
recipe.version = recipe.version.split('+git', 1)[0]

Expand Down Expand Up @@ -125,13 +125,15 @@ addtask do_process_reports after do_${PR_ORIG_TASK}
# These tasks are intended to be called directly by the user (e.g. bitbake -c)

addtask do_analyse_sources after do_analysesource
do_analyse_sources[doc] = "Produce ISAFW reports based on given package without building it"
do_analyse_sources[nostamp] = "1"
do_analyse_sources[postfuncs] = "do_process_reports"
do_analyse_sources() {
:
}

addtask do_analyse_sources_all after do_analysesource
do_analyse_sources_all[doc] = "Produce ISAFW reports for all packages in given target without building them"
do_analyse_sources_all[recrdeptask] = "do_analyse_sources_all do_analysesource"
do_analyse_sources_all[recideptask] = "do_${PR_ORIG_TASK}"
do_analyse_sources_all[nostamp] = "1"
Expand Down Expand Up @@ -190,18 +192,19 @@ python analyse_image() {
}

do_rootfs[depends] += "checksec-native:do_populate_sysroot"
do_rootfs[depends] += "prelink-native:do_populate_sysroot"
analyse_image[fakeroot] = "1"

def isafw_init(isafw, d):
import re, errno

isafw_config = isafw.ISA_config()

isafw_config.proxy = d.getVar('HTTP_PROXY', True)
if not isafw_config.proxy :
isafw_config.proxy = d.getVar('http_proxy', True)
bb.debug(1, 'isafw: proxy is %s' % isafw_config.proxy)

isafw_config.machine = d.getVar('MACHINE', True)
isafw_config.timestamp = d.getVar('DATETIME', True)
isafw_config.reportdir = d.getVar('ISAFW_REPORTDIR', True) + "_" + isafw_config.timestamp
if not os.path.exists(os.path.dirname(isafw_config.reportdir + "/test")):
Expand Down Expand Up @@ -234,7 +237,8 @@ def manifest2pkglist(d):
with open(manifest_file, 'r') as finput:
for line in finput:
items = line.split()
foutput.write(items[0] + " " + items[2] + "\n")
if items and (len(items) >= 3):
foutput.write(items[0] + " " + items[2] + "\n")

return pkglist

Expand Down
21 changes: 21 additions & 0 deletions lib/isafw/isafw.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class ISA_config:
reportdir = "" # location of produced reports
logdir = "" # location of produced logs
timestamp = "" # timestamp of the build provided by build system
full_reports = False # produce full reports for plugins, False by default
machine = "" # name of machine build is produced for


class ISA:
Expand Down Expand Up @@ -201,5 +203,24 @@ def process_report(self):
except:
print("Exception in plugin: ", sys.exc_info())

def cleanup(self):
for name in isaplugins.__all__:
plugin = getattr(isaplugins, name)
try:
# see if the plugin has a 'cleanup' attribute
cleanup = plugin.cleanup
except AttributeError:
# if it doesn't, it is ok, won't call this plugin
pass
else:
if self.ISA_config.plugin_whitelist and plugin.getPluginName() not in self.ISA_config.plugin_whitelist:
continue
if self.ISA_config.plugin_blacklist and plugin.getPluginName() in self.ISA_config.plugin_blacklist:
continue
try:
cleanup()
except:
print("Exception in plugin cleanup: ", sys.exc_info())



Loading